Jump to content
Sign in to follow this  
oleung

Use applescript to open file

Recommended Posts

Hello

Just need help on using applescript to open a filemaker file.

Sounds like simple but spend sometime to look around and found nothing easy to follow.

Following is a snap of script want to use and not sure how to script the open file statement. I need to access to a file under a document folder and what could the syntax be looked like.

tell application "FileMaker Pro Advanced"

open file "Drive:filename.fp7"

end tell

Many thanks,

Share this post


Link to post
Share on other sites

Hi Oleung,

Try this:

tell application "FileMaker Pro Advanced"

open "the disk name:folder name:file name.fp7"

end tell

or simply this:

tell application "Finder"

open "the disk name:folder name:file name.fp7"

end tell

Share this post


Link to post
Share on other sites

Or the short form, which needs only 1 line:

tell application "Finder" to open "the disk name:folder name:file name.fp7"

Share this post


Link to post
Share on other sites

And just adding on to this, can someone tell me what is the right syntax in Applescript to "Open remote" in Filemaker?

Share this post


Link to post
Share on other sites

I know this post is old, but it didn't appear to have a resolution. In FileMaker Pro 12/13, use this syntax:

tell application "FileMaker Pro"
    set openDBs to name of every database
    if openDBs contains "[filename].fmp12" then
    	show database "[filename].fmp12"
    else
        getURL "fmp://[account]:[password]@[host]/[filename].fmp12"
    end if
end tell

Hope this helps!

Share this post


Link to post
Share on other sites

Hello CreativeDataPro

 

I wonder if you can help a relative novice to sort out this Applescript conundrum. Glad to see your post is recent, as I have been wading through so-called solutions for days now, and most seem to relate to earlier versions of FMP or indeed OSX. None work for me!

 

I am running FMP Advanced 13 on a Mac running OSX Mavericks, and three further machines have remote access to it using simple FM peer-to-peer sharing (using FMP 13 and FMP Advanced 13). It works fine.

 

I want to automate the opening of the database each morning (it is a timesheet and job trafficking system we have built). The Mac is set to shut down each evening and start up each morning, but we have to manually open the FMP database each morning before we can all access it from our client machines.

 

I have tried creating an Applescript 'Application' to run as a Login item on startup, and it gets as far as opening the application, but does not open the database in question and simply hangs with its icon bouncing in the Mac tray until we click on it to get FMP going each day.

 

The script DOES work when tested in the Applescript Editor, but DOES NOT work when used as a Login Item when the Mac starts up.

 

The script I have been using (based on information found elsewhere in various forums) is:

 

tell applicaction "Filemaker Pro Advanced"

open "Users:Macmini:Documents:Projects.fmp.12"

delay 5

activate "Filemaker Pro Advanced"

go to window "Projects"

end tell

 

I suspect the 'activate' and 'go to' commands are pretty much redundant, as the script works just the same without them (i.e. hangs without displaying the database). However, it was an attempt to make FMP show the database in the foreground. In fact, it gets as far as the Open Database dialogue, inviting me to double-click on the databadse itself and open it.

 

I am unable to fathom the syntax you have put in your post (did I mention, I am a relative novice?), and as a consequence was hoping you might be able to help - since you mention v13 and you have clearly posted a 'solution' more recently than several years ago!

 

Any suggestions?

 

Thanks

Share this post


Link to post
Share on other sites

Hi David,

There's several ways to skin this cat, both very simple:

 

1) AppleScript saved as an application and added to Login items -

 

set theFile to ((path to desktop) as text) & "[filename].fmp12"

tell application "Finder" to open file theFile

 

2) Add [filename].fmp12 directly to Login items

 

Regards,

CDP

 

 

Share this post


Link to post
Share on other sites

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

Sign in to follow this  

×

Important Information

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