Open a filemaker database with apple script

I have been attempting to write a script to simply on a remote database. The script works fine in the filemaker application is open, but immediately times out if the application is closed. Can some one explain why this does not work?

Thanks

with timeout of 120 seconds
	tell application "/Applications/FileMaker Pro 13/FileMaker Pro.app"
		activate
		getURL "fmp://192.168.100.6/iBase"
	end tell
end timeout

Hello. :slight_smile:

I won’t speculate as to why it doesn’t work, but to me, the url scheme your are using, seems malformed, when using it towards the operating system (outside FileMaker Pro). (I haven’t seen posix paths used when specifying path to applications before either, but, if you know that it works, then it probably isn’t that that makes Filemaker Pro return so fast.)

I don’t think it is Filemaker Pro that times out directly, it is more proable that Filemaker pro throws an error for some reason.

You may try this in script editor, while Filemaker pro isn’t running:


try
with timeout of 120 seconds
   tell application "/Applications/FileMaker Pro 13/FileMaker Pro.app"
       activate
       getURL "fmp://192.168.100.6/iBase"
   end tell
end timeout
on error e 
display alert e
end try

However: I have high hopes for this way to do it: (if you have several versions of FileMaker Pro, then you consider to rename, or make a copy of Filemaker Pro, and name it Filemaker Pro13 for instance.)

if not running of application "FileMaker Pro" then
	tell application "FileMaker Pro" to activate
end if
tell application "FileMaker Pro"
	-- run script (Filemaker Pro script) that gets the url
end tell

Not sure I understand the --run script line. What would go there? Remember the database is not open.

The first script received an error when run 'Filemaker got an error: AppleEvent timed out.

The reason for that may be that the url you are sending Filemaker Pro is malformed, this is just a speculation, as I don’t have the dictionary for Filemaker Pro 13, however, for my earlier version, the get url is specified as follows in the dictionary:


The parameter is the parameter to the getUrl command, and earlier at least, it required, username with an optional password before the filename was specified. Please consult the dictionary. I have no idea why how you do it works from within Filemaker Pro, and not from the outside, when Filemaker Pro isn’t running.

Specifying a username is something worth trying. If that doesn’t work, then I hope someone more proficient with Filemaker Pro 13 are able to help you.

Edit

One more thing: it may help to insert a little delay after you have activated it, if it wasn’t running, so that it can get to grips with itself, before you ask it to open a url.


tell application "Filemaker Pro"
activate
delay 0.6
# try to open the url here
end tell

why not have the script just open a local database, which when opened, executes a FM script to open the final database?

Back to your original problem, it sounds like you are not allowing any time for the application to launch before issuing your open command.

Depending on how fast or how slow your computer is, you may want include some code to verify the app is fully launched before continuing.

tell application "System Events" to set theProcs to name of every process
if theProcs does not contain "FileMaker Pro" then
	tell application "Finder" to launch application "FileMaker Pro"
end if