Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Calculated Applescript Syntax

Featured Replies

  • Newbies

Hello, I have this applescript who is working well:

do shell script "curl \"http://127.0.0.1:4490/action.html?macro=4A91C4B8*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 \"http://127.0.0.1:4490/action.html?macro=4A91C4B8*" & 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?

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 \\\"http://127.0.0.1:4490/action.html?macro=4A91C4B8*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 \\\"http://127.0.0.1:4490/action.html?macro=4A91C4B8*" & 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 \"http://127.0.0.1:4490/action.html?macro=4A91C4B8*«fileName»\""

Applying Quote() to the result produces:

"do shell script \"curl \\\"http://127.0.0.1:4490/action.html?macro=4A91C4B8*«fileName»\\\"\""

Now you can make your calculation =

Let (
template = "do shell script \"curl \\\"http://127.0.0.1:4490/action.html?macro=4A91C4B8*«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

  • Author
  • Newbies

Hello comment, I appreciated very much your effort and your explanation!!! I’m very happy, finally I finally understood the method. Thank you!!!

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.