Jump to content

Applescript works in Applescript but won't run in FM 8


mz123
 Share

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

Recommended Posts

Hey There -

I have an apple script:

set TextOfFile to read choose file with prompt "Choose file to import."

Set file_path to "(I have a FilePath here)"

open for access file file_path with write permission

write TextOfFile to file file_path

close access file file_path

It works perfectly when I run it through the Applescript editor, but in FM, after I enter it as a native Applescript, it says:

Expected End of line, etc. but found identifier.

and then it highlights TextofFile in the "Write" line.

Help?

I attempted to create a calculated applescript too, but when I ran the FM script, the same message popped up.

Thanks in advance!

Link to comment
Share on other sites

Awesome! Thanks so much : It worked.

I wonder why Filemaker doesn't like the write script.

I ended up changing my applescript a bit because I was having some permissions issues with the location where the text file was being created.

I just learned that an applescript from Filemaker does not need the "Tell Application "Filemaker Pro" block, so I just have

Tell Database "DatabaseName"

set field "fieldname" of current record to TextOfFile

end tell

This is great because we are running a multi-user database, with some on FM Pro 8, FM Pro 8 Advanced, and even an FM Pro 7. and the applescript would get hung up on the "Tell application "Filemaker Pro" unless I had a calculated applescript which specified which version of Filemaker the user was on.

Anywho, after all that, thank you, Fenton!!

Link to comment
Share on other sites

This topic is 5660 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
 Share

×
×
  • Create New...

Important Information

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