Jump to content
Sign in to follow this  
mad_mickey

Opening Remote Database with AppleScripts

Recommended Posts

Can anybody please shed some light on this one.

I'm trying to use Applescript to open a remote database on a certain day each week and automatically run a report. I am wording the Applescript to the format as per Filemakers Applescript dictionary, but the database is not actually opening. It is opening the remote access window and showing all the databases available but not actually opening the requested database.

My script is as follows:

tell application "Finder"

if weekday is Thursday then

tell application "FileMaker Pro"

activate

get remote URL "FMP5://[url address]/database.fp5"

end tell

else

display dialog "This script should only be run on Thursdays"

end if

end tell

Share this post


Link to post
Share on other sites

>get remote URL "FMP5://[url address]/database.fp5"

You are putting the actual name of the database in here I presume as in "contacts.fp5" or the like?

But that syntax is not correct to open the file. Try this one instead:

getURL "fmp5@password@12.34.56.78/contacts.fp5"

substitute your password for password

substitute your URL for 12.34.56.78

substitute the name of your database for contacts.fp5

HTH

Old Advance Man

Share this post


Link to post
Share on other sites

Remove "remote" from the script and just use "getURL"

tell application "FileMaker Pro"

activate

getURL "FMP5://ip_address_or_dns_name/database.fp5"

end tell

Share this post


Link to post
Share on other sites

Thanks for the help on this one guys. Spragueg's option worked but unfortunately the database is password protected and the "with password string" option doesn't seem to work with the "getURL" script commands!

Any ideas?

Share this post


Link to post
Share on other sites

I have the password thing sorted now. Next thing is more of a general Applescript query. I am trying to get the script to run the report only on a Thursday. My initial trial of the line:

if weekday is Thursday then

tell Filemaker..............

end if

This does not work!

How do I word the Applescript command to get the script to run only on a Thursday?

[ December 06, 2001: Message edited by: mad_mickey ]

Share this post


Link to post
Share on other sites

I don't think there is any weekday function in Applescript, but you can calculate it as follows:

-- This will produce a number in the range 0..6 with Sunday=0

set dayofweek to ((current date - "December 31, 2000") mod 7)

-- and Thursday is 4

if dayofweek is 4 then

tell Filemaker..............

end

[ December 06, 2001: Message edited by: BobWeaver ]

Share this post


Link to post
Share on other sites

word 1 of date string of (current date)

will yield the day of the week of the current date (as per the CPU clock)

HTH

Old Advance Man

Share this post


Link to post
Share on other sites

You can get the three letter weekday(curDay) by using the following applescript...

set dateStamp to current date

set curDay to weekday of dateStamp

[ December 06, 2001: Message edited by: spragueg ]

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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