Jump to content

AppleScript escapes the escape marks in Calculated AppleScript


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

Recommended Posts

Running on Mac OS, and need this script to move come files (.jpgs) out of a particular calculated folder/filename sequence.

 

I've got this working in a separate applescript (to install said jpg files), but it's built slightly differently.

The issue I'm getting is this: it errors out, and I get "Expected expression but found uknown token."...

Not really sure what's causing this, but I suspect it's my escape marks that are not setup properly....

 

could any kind soul look at this and give me a little feedback?

Here's the calculated AppleScript:

"set myShCMD to \\\"mv /Volume/FOLDERNAME/FOLDERNAME/ \\\" & CALCULATEDFILENAME & " \".jpg /Volumes/FOLDER2/FOLDER2/\\\"" & ¶ &

"myMountAFPVol()"  & ¶ &

"do shell script myShCMD"  & ¶ &

"myUmountAFPVol()"  & ¶ &

"on myMountAFPVol()"  & ¶ &

"            tell application \"Finder\""  & ¶ &

"                        mount volume \"afp://IPADDRESS/FOLDERNAME\" as user name \"LOGINID\" with password \"MYPASSWORD\""  & ¶ &

"            end tell"  & ¶ &

"end myMountAFPVol"  & ¶ &

"on myUmountAFPVol()"  & ¶ &

"            tell application \"Finder\""  & ¶ &

"                        eject \"MOUNT\""  & ¶ &

"            end tell"  & ¶ &

"end myUmountAFPVol" & ¶

 

 

BTW, this is running in Server 9.0v3, though i'm rather doubtful that matters(?)....

Link to comment
Share on other sites

The issue I'm getting is this: it errors out, and I get "Expected expression but found uknown token."...

1. The formula as presented here isn't valid FileMaker … drop this into a calculation dialog, and you'll get a syntax error. So I'm wondering how you set this up.

2. You can set a variable to the result of the formula (once you've fixed it), or evaluate it in the Data Viewer; then copy that result and try it directly in the (Apple)Script Editor. Debug it there, then make the necessary changes in the FileMaker calc. 

Link to comment
Share on other sites

Escaping is messy and error-prone; and it can be avoided. 

Write your applescript into a text field, using expressions that allow you to perform substitutions to generate the final script.

Example in a bit.

Link to comment
Share on other sites

1. The formula as presented here isn't valid FileMaker … drop this into a calculation dialog, and you'll get a syntax error. So I'm wondering how you set this up.

2. You can set a variable to the result of the formula (once you've fixed it), or evaluate it in the Data Viewer; then copy that result and try it directly in the (Apple)Script Editor. Debug it there, then make the necessary changes in the FileMaker calc. 

This is likely as my background is linux & Mac, not filemaker...  so porting various patchwork ideas into FMP...

i've typically written stuff in terminal then try to push applescript to run it..

 

Link to comment
Share on other sites

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