1

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!

2 Answers2

1

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"
adayzdone
  • 11,120
  • 2
  • 20
  • 37
  • 1
    That did it! Thanks so much @adayzdone I really appreciate the assist! –  May 09 '13 at 01:03
0

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

Monolo
  • 18,205
  • 17
  • 69
  • 103
  • Thanks for the quick response @Monolo. If I modify the script to reflect that with `set msgDate to "05-06-2013"` `set quotedmsgDate to quote & msgDate & quote as string` `do shell script "echo send message in folder " & quotedmsgDate & ">> ~/Library/Outlook" & msgDate & ".txt"` it still outputs the unquoted date in the text file. What I'm trying to do is pass the _quoted_ text into the text file. –  May 08 '13 at 22:24