Jump to content
Server Maintenance This Week. ×

Need help creating a script that takes the user to a specific folder, similar to "Reveal in Finder"


This topic is 471 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I need help writing (or obtaining) a script that will, with a click of a button, take the user to a folder in the finder.

I'm using FileMaker Pro 17 on a Mac. I'm also illiterate when it comes to scripting. I know what I want it to do but I don't know how to do it.

Some background: The database I'm working with holds information and a video clip. I use it to quickly search keywords and to see the video clips in the results. What I'd like to have is a button next to the "VIRIN" number (field 2 from top left) that will take me to the folder that contains the original video clip. These clips are stored on an external SAN. The path will be the same for each group of clips, i.e. Tape # 2916 in the case below. As I change tapes, I will have to redirect the path.

Here is an image of the database. The second image below it is of the path to that specific record file. 

Again, I'm awful at scripting so I may be asking a lot. Thanks for any and all help. 

spacer.png

52622016455_12def07e1c_c.jpg

 

Link to comment
Share on other sites

There are a couple of ways you could do that (Perform AppleScript, Open URL). Both require you to provide the path to the folder you wish to open. I suppose the path can be calculated from the data stored in the record, but you did not tell us how.

Once you have the formula to calculate the path it should be very simple. 

 

Link to comment
Share on other sites

  • Newbies

Thanks for the responses. 

I had to add the video clips via drag and drop. Not the best way to do it, but as I said before, I can't scripting. As for URL, these files are in a self-contained system that's not connected to the internet. AppleScript sounds right but I'm clueless.

 

Link to comment
Share on other sites

  • Newbies

I tried this as a test and it works for my local hard drive. Am I on the right track? I can't test the real path bc it's at work.

set targetFolder to POSIX file "/Users/krichey/desktop/test"

tell application "Finder"

open targetFolder

activate

end tell

Link to comment
Share on other sites

8 hours ago, KRichey said:

As for URL, these files are in a self-contained system that's not connected to the internet.

The Open URL script step can open files (and folders) on your local system just as well. If you have a folder named "test" on your desktop, then:

Open URL [ "file://localhost/Users/krichey/Desktop/test" ]

will open it and bring it to front.

 

But again,  if not all clips are in the same folder, then the path to the folder needs to be calculated - whether you use Open URL or AppleScript. 

 

Edited by comment
Link to comment
Share on other sites

5 minutes ago, KRichey said:

Would you be willing to show me how to calculate it?

I don't know how to calculate it, because I don't know what do you have as the input/s to such calculation, nor what should the result be.

I can give you a hint how to determine the expected result: assuming you want to use AppleScript, run the following script in Script Editor:

tell application "Finder"
	set myfolder to (choose folder)
	POSIX path of myfolder
end tell

When prompted, select one of the folders on the external volume. The result will tell you what the POSIX path to the selected folder needs to look like.  Then you need to find a way to calculate such result from your data and pass it to your AppleScript. That's assuming your record has the necessary data to produce the result.

 

Link to comment
Share on other sites

This topic is 471 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.