Jump to content
Server Maintenance This Week. ×

Run Applescript - No Fun


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

Recommended Posts

  • Newbies

I'm trying to run a simple applescript which will open a FileMaker database and run a script.

When the script runs, it opens the FileMaker database and displays the following message with the "do script" line highlighed

"FileMaker Pro got an error: Object not found."


tell application "FileMaker Pro"

   activate

   open file "RemoteHD:Nightly.fp7"

   do script FileMaker script "Test"

end tell

I've tried a number of variations such as:

- Shorten the script line to 'do script "Test"'

- insert before the "do script" line:

database "Nightly"

For debugging, I've tried to make the script as simple as possible.

Thanks for your help.

Link to comment
Share on other sites

Because FileMaker 7 introduced multiple windows you sometimes have to be more explicit in terms of your object references.

do script FileMaker script "Script Name" of database "Database.fp7"




Otherwise, FileMaker doesn't know which (of potentially all the databases that could be opened) script to run in which database. Also of note is the situation where running an AppleScript within FileMaker does not require the tell statement. Because the script is run from within FileMaker the concept of self or me (in AppleScript speak) takes effect.



So you can get away with just this part within an AppleScript




do script FileMaker script "Script Name" of database "Database.fp7"

Nothing else is needed except the open - and if you're using one FileMaker file to open another then you should just use an Open File script step. If you're running the AppleScript from something like cron then "yes" you need all the other stuff - including the tell statements.

Unless you need something more dynamic, then any extra steps in AppleScript could just slow down the whole process. Although in this case it would be negligible.

If you're looking for more information about launching scripts automatically then I have two great articles at my site. One deals with OS based launching and the other uses freely available plug-ins.

Scheduling Scripts (and Backups too!)

http://www.filemakermagazine.com/articles/scheduling-scripts-and-backups-too.html

Scheduling Scripts - Automating The Process

http://www.filemakermagazine.com/videos/scheduling-scripts-automating-the-process.html

Edited by Guest
Link to comment
Share on other sites

This topic is 6156 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.