Jump to content

Calculated Applescript Syntax

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

Recommended Posts

  • Newbies

Hello, I have this applescript who is working well:

do shell script "curl \"*nome file.jpg\""

Since I should replace “nome file.jpg” with a Filemaker field value, I modified it to be a Calculated Applescript like this:

"do shell script \"curl \"*" & OrderLines::CustomerFileName & "\"\"""

But this script always report me an error about “”” I guess there is some syntax error but I don’t see where. Anyone can help me to understand the logic and correct the syntax?

Link to comment
Share on other sites

You seem to be running into the same issue again and again. Here is a generic method you can use to solve this kind of problem:

1. Paste your native, working AppleScript into a text field.

2. Use a calculation field or the Data Viewer to calculate: 

Quote ( Texfield )

This will return, in your example:

"do shell script \"curl \\\"*nome file.jpg\\\"\""

3. Locate the string you want to replace with a field value. Place a closing quote before this string and an opening quote after it and insert a reference to your field in between:

"do shell script \"curl \\\"*" & OrderLines::CustomerFileName & "\\\"\""


Another option is to start by replacing any variables that need to use field values with placeholders - for example:

do shell script "curl \"*«fileName»\""

Applying Quote() to the result produces:

"do shell script \"curl \\\"*«fileName»\\\"\""

Now you can make your calculation =

Let (
template = "do shell script \"curl \\\"*«fileName»\\\"\"¶"
Substitute ( template ; "«fileName»" ; OrderLines::CustomerFileName )

This is especially convenient when you have more than one field value to insert into the AppleScript.


In recent versions you can also use the Insert Calculated Result[] script step to populate a variable with the text of the native AppleScript (with placeholders), without having to use the Quote() function. Then you can do just =

Substitute ( $template ; "«fileName»" ; OrderLines::CustomerFileName )

to calculate the final AppleScript.


Finally, keep in mind the option to read Filemaker fields directly from the AppleScript.


Edited by comment
Link to comment
Share on other sites

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