I am running into the following error in Automator when attempting to run multiple AppleScript actions, the 2nd and 3rd setting variables:
-[NSAppleEventDescriptor fileSystemRepresentation]: unrecognized selector sent to instance 0x6000009e51a0
As long as there is only one of the second or third “Run AppleScript” actions in the workflow (either one), it runs successfully. So it does not seem to be an issue with the content of either AppleScript.
The first AppleScript is merely to get an “Ask For Text” window to appear:
activate
The next AppleScript (first one to prompt to get a variable) is:
--
-- a sample AppleScript program to prompt a user to select an item from a list
--
-- display a dialog to prompt the user to select a dayname from a list
set myDay to {"m", "t", "w", "h", "f", "s", "x"}
-- get the file the user selected from the list
set selectedDay to item 1 of {choose from list myDay}
and the third one, again to set a variable:
set chosenTime to choose from list {"today", "yesterday"}
set UserChoice to item 1 of chosenTime
set myTime to "" -- good practice to initialise a variable
if UserChoice is "today" then
set myTime to "0"
else if UserChoice is "yesterday" then
set myTime to "1"
end if
I can run with AppleScript 1 and 2, or AppleScript 1 and 3, and no errors. But if I run with 1, 2 & 3 I get the error.
Here is the shell script in case that helps:
[format]FILE_CONTENT=$1
DATE=$(date -v-$3d +“%Y-%m-%d”)
echo -e “$DATE $2 | $FILE_CONTENT \n___\n” | cat - /Users/George/Dropbox/Notes/|\•\ recap_test\ “$DATE”.txt > /tmp/tempfile && mv /tmp/tempfile /Users/George/Dropbox/Notes/|\•\ recap_test\ “$DATE”.txt
echo -e “$DATE $2 | $FILE_CONTENT \n___\n” | cat - /Users/George/Dropbox/Notes/|\•\ 1journal_test.txt > /tmp/tempfile && mv /tmp/tempfile /Users/George/Dropbox/Notes/|\•\ 1journal_test.txt[/format]
Ultimately, I am trying to modify the date variable in the shell script using the variable from the 3rd AppleScript (the idea being to subtract the value in the variable from the 3rd AppleScript).