set theString to {"First Name\\r", "Last Name\\r"} as string
do shell script "cd desktop; echo " & theString & "&>>output.txt"
Basically, I want to append theString to the contents of output.txt on the desktop
Why doesn’t this work?
set theString to {"First Name\\r", "Last Name\\r"} as string
do shell script "cd desktop; echo " & theString & "&>>output.txt"
Basically, I want to append theString to the contents of output.txt on the desktop
Why doesn’t this work?
Hi,
syntax, syntax, syntax
set theString to {"First Name" & return, "Last Name" & return} as string
do shell script "cd ~/Desktop; echo " & theString & " >> output.txt"
Stefan has you covered, but for future reference, do shell script
starts at the root directory.
do shell script "pwd" -- print working directory
--> "/"
Thanks
@stefanK –
But
Say I have 2 strings in 2 variables var1 = “One” and var2= “Two”.
I can convert the 2 strings to a list {“One”, “Two”}
using the code –
set var1 to "One"
set var2 to "Two"
set finalList to {} as list
set end of finalList to var1
set end of finalList to var2
How do I make a list that is shown in your code as {“One”& return, “Two”&return}
If I modify the script as
set var1 to "One" & return
set var2 to "Two" & return
set finalList to {} as list
set end of finalList to var1
set end of finalList to var2
the result is {“One\r”, “Two\r”}
Hi
the keyword return (used with a string) is the same as “\r” or “ASCII character 13”
Thanks.