Jump to content
Server Maintenance This Week. ×

Double quotes in applescript - do shell script


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

Recommended Posts

I am sorry if this has been posted already. But the search system would not let me use those words.

I am trying to enclose double quotes in a "send apple script", script.

Here is my script.

"¶tell application "& """ & "Finder" & """ & "¶set myTest to do shell script "& """ &"md5 -q "& """ & "/Volumes/Extended/tmp/" & Duplicates::Filename & """ &"¶end tell ¶tell application "& """ &"FileMaker Pro Advanced"& """ &"¶set cell "& """ &"Duplicates::MD5"& """ &" of current record to myTest¶end tell"

"Duplicates::Filename" contains single quotes within the field, so I am unsure how to get that across to the terminal app.

Link to comment
Share on other sites

Quoting problems are exactly why I don't suggest ever using that approach.

Use a script to move the data to global fields and then use Perform applescript command instead, something like this.

The purpose of using global fields is that you can use a table reference, you do not need to refer to a layout or current record.

Also, the "herestring" operator "<<<" means you don't have to actually write out the data to a file on disk.

set cellname1 to "zASData"

set cellname2 to "zASResult"

set tableName1 to "Gtest"

get data cell cellname1 of table tableName1

set mydata to result

set cmd to "md5 -q <<< " & quoted form of myData

do shell script cmd

copy result to cell cellname2 of table tableName1

Link to comment
Share on other sites

BruceR,

Okay, I had a chance to implement the new applescript, but I noticed a problem... The here-string is generating the md5 for the actual text within myData, but myData refers to a file location and name that needs to be evaluated by md5.

for example myData = /Volumes/Extended/tmp/_Alice's Restaurant Original Version.mp3 I want to evaluate that file not the text.

Could you please help?

Thanks again.

Link to comment
Share on other sites

I figured it out. I have never used the here-string before and looked it up. I just removed it from the calculation and that solved the problem. Thanks again!!!

Thomas

Link to comment
Share on other sites

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