Jump to content

Applescript syntax?


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

Recommended Posts

When I use Apple's Script Editor I can run my little applescript without any problems. However I can't enter the same commands in filemaker's "Perform Applescript" script step because it gives me the following error:

Expected end of line, etc. but found ")".

Here are the applescript commands:

set MyFile to open for access (path to desktop as text) & "Results.txt" with write permission

write (the clipboard as text) to MyFile

close access MyFile

The script creates a text file on the desktop using the contents of the clipboard.

Any ideas about why filemaker objects?

Edited by Guest
Link to comment
Share on other sites

Hi,

Yes there is a problem with a Write command in applsecript in conjusction with FM. There are two alternatives..

Create a separate applescript with ONLY that command and call it from your script..

OR

Create an applicatio of the entire applescript and call the application..

Regards,

MetaSys

Link to comment
Share on other sites

You can use "write" inside a Perform AppleScript step, but you have to wrap inside another tell app block, like this:

set theFile to ((path to desktop as string) & "Results.txt")

tell application "Finder"

set MyFile to open for access theFile with write permission

write (the clipboard as text) to MyFile

close access MyFile

end tell

Link to comment
Share on other sites

However do I have reservations, using the clipboard is bad practice from a developer not quite aware of his jurisdiction.

At least must measures ensure that the users data in the clipboard is saved before tampering with it, so it can be reinstated when the script is done!

But with fm8 shouldn't Copy All Records be needed, except when exorbitant speed is required, GetNthRecord in a recursive CF is much safer in it's dealings.

Try to investigate Fentons template here:

http://www.fmforums.com/forum/attachment.php?attid/3566/

...and notice how you can do it with shell scripting especially his CAR_ example is nice when you fix a tiny error in the first line, he forgot to make the refernce to a hidden field!

--sd

Link to comment
Share on other sites

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