简体   繁体   中英

Pass quotation marks into shell script from AppleScript

I have this portion of my AppleScript:

set msgDate to "05-06-2013"
set quotedmsgDate to quoted form of "\"" & msgDate & "\"" as string
do shell script "echo send message in folder \"" & quotedmsgDate & "\">> ~/Library/Outlook/" & msgDate & ".txt"

What I'm trying to accomplish is writing 'send message in folder "05-06-2013"' to ~/Library/Outlook/05-06-2013.txt.

What it actually writes is 'send message in folder 05-06-2013'.

Everything is working just fine except echoing out the quotation marks around quotedmsgDate.(By the way, the only reason that second line is in there was because I was testing around the 'quoted form of' in AppleScript to see if it made a difference. It didn't.) I feel like I've tried everything, but for some reason I just can't get the do shell script statement to put quotation marks where they need to be.

Any assistance or insight is greatly appreciated!

Try:

set msgDate to "05-06-2013"
set quotedmsgDate to "\"" & msgDate & "\"" as string
do shell script "echo send message in folder " & quoted form of quotedmsgDate & " >> ~/Library/Outlook/" & msgDate & ".txt"

A quotation mark in AppleScript is known as quote .

You can use it like this:

set myString to "Joe " & quote & "the Hammer" & quote & " Doe"

to get this string:

Joe "the Hammer" Doe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM