Jump to content
Sign in to follow this  

Quotation marks in a calculated AppleScript

Recommended Posts

Hello, the following is the essence of a problem I need to resolve. The code is AppleScript 

display dialog "Hello \"world\" " 

This code needs to run in FMP18 as a calculated applescript.


I tried:

Perform AppleScript [display dialog \"Hello "world" \"] 

Perform AppleScript [display dialog \"Hello \""world"\" \"]

Perform AppleScript [display dialog \"Hello "\"world"\" \"]

Perform AppleScript [display dialog \"Hello \""world\"" \"]

and other permutations of 1 backslash and 2 quotation marks cause the calculation to be unsavable b/o error.

Perform AppleScript [display dialog \"Hello \"world\" \"] results in "A identifier can’t go after this “"”." -- after the calculation is saved. (Yes, "A identifier")

Perform AppleScript [display dialog \"Hello \"\"world\"\" \"] results in A “"” can’t go after this “"”. -- after the calculation is saved

and an error message of -2740.

Can anyone help me please?





Edited by Asu
added last line

Share this post

Link to post
Share on other sites

Enter this into FileMaker's calculation dialog ( in the 'Calculated AppleScript' dialog ).

"display dialog \"Hello \\\"world\\\"\""
  • " - opening quote required for text in FileMaker
  • display dialog - applescript command
  • \" - escaped quote mark reduces to a " when evaluated by FileMaker.
  • Hello - the string to appear inside the quoted string being fed to the AppleScript.
  • \\ - an escaped backward slash, that reduces to a single backward slash when evaluated by FileMaker.
  • \" - an escaped quote, that pairs with the previous backward slash, to open the string to pass to the AppleScript command.
  • world - string for inside the escaped quotes to feed into AppleScript.
  • \\ - an escaped backward slash, that reduces to a single backward slash when evaluated by FileMaker.
  • \" - an escaped quotation mark, that pairs with the previous backward slash, to form an escaped quotation mark to pass to AppleScript.
  • \" - another escaped quotation mark to close the string to pass into the AppleScript command.
  • " - closing quote required for text in FileMaker.


Visually it looks like this ( red characters reduce down when evaluated in FileMaker 😞

"display dialog \"Hello \\\"world\\\"\""

  • Like 1

Share this post

Link to post
Share on other sites

The easy way to solve such problems is to:

1. Enter the "native" version of your AppleScript into a text field:

display dialog "Hello \"world\" " 

2. Open the Data Viewer and enter:

Quote ( YourTable::Textfield )

3. Paste the result into your calculated AppleScript formula:

"display dialog \"Hello \\\"world\\\" \" "


Edited by comment
  • Like 2

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By sal88
      Hi all
      This the last thing I need to implement on our Server as per FileMaker's installation and configuration guide:
      Make the virtual memory swap file a static size so Windows doesn’t attempt to adjust it. Use the recommended file size amount
      Am I right in thinking that this is in the attached section?
      If so, on which drives should I be specifying the swap file size? And what would the initial and maximum size be?

      Thank you
    • By Todd W Carter
      When I launch the exe for upgrading to FM 18.0.3, I get a window showing msiexec options. Installation will not start. I am running win 10 Pro, version 1909. Any help will be appreciated.

      Found a way around the issue... Had to drill down to the msp file in the package, clicked on that and the install ran without issue...
    • By Hurlz
      Hi, in the attached database, we collect a range of readings per date. I need to calculate the median for each element (eg temperature, pH etc) across a range of dates. There is one record per date.
      The user will change the range of dates depending on what time period they want to view. The data doesn't need to be summarised by anything.
      I am most of the way there, thanks to this great post: https://www.briandunning.com/cf/298. I have run the script in that link on a field doing a summary list. However, the list doesn't seem to sort as specified in the script, and the median value returned is not always accurate.
      The lab results layout has been temporarily set up so I can see the summary field for each element below the median calculation field, with the actual data in the body. This way I could see what the sort was etc. I've just put in 5 records to test this, and to test what happens when there are odd and even records. sign in is admin/admin.
      Grateful for any help!
    • By MacFileman
      Thanks in advance for your thoughts and the time reading this. 
      I am currently running server 17, no issues, however, my SSL certificate just expired. Before I go through all the new motions and get a new certificate, you think I should switch to 18 now? Since the world is ending, my server is slower and its a good time to back it up and upgrade to 18. Are there anything noteworthy about switching to 18 at this point and will installing a certificate be any easier in 18? I thought installing a certificate on 17 was a pain in the you know what.
      Any thought appreciated.
      I am also running my server on a Mac. Been very happy, no issues to speak of.
    • By crayfish
      Hi, I'm trying to do a cURL PUT request using Insert from URL to Discord's API.
      I've successfully completed the PUT request using Postman, but I can't get it to work in Filemaker. 
      I've successfully completed GET and POST requests with Filemaker, so I know my Discord authorization is working.
      Here's the url I'm using (with IDs removed):
      "https://discordapp.com/api/channels/<channel_id>/messages/<message_id>/reactions/<:name:id>/@me" Here are my curl options (with authorization removed):
      --request PUT --header "Authorization: <token>" --header "User-Agent: <user>" --header "Content-Type: application/json"  
      I'm getting this error response:
      <!DOCTYPE html> <html lang=en> <meta charset=utf-8> <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width"> <title>Error 411 (Length Required)!!1</title> <a href=//www.google.com/><span id=logo aria-label=Google></span></a> <p><b>411.</b> <ins>That’s an error.</ins> <p>POST requests require a <code>Content-length</code> header. <ins>That’s all we know.</ins> The last line of the response makes me wonder if Filemaker is submitting it as POST and not PUT?
      Any suggestions are appreciated!
  • Create New...

Important Information

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