To: James Nierodzik
Thanks for the guidance about:
"Note with execScript above, you need the full path again because as soon as your
"first script finishes, you have left the shell session. When your second script runs it
“is running from your default shell location, not where you cd’d to in the first script.”
So, learning from this, I simply:
set comboScript to "cd " & itsFolder & "; " & "chmod +x " & theScript
do shell script comboScript
Now, that you solved that problem, let’s go to the running of a AppleScript within a do shell script – and without calling
osascript << EOSA
-- whatever
EOSA
What am I doing wrong in the following such that an error returns = “cannot execute binary file”:
set runScript to itsFolder & "/" & theScript & ¬
" \"" & theSrcDisk & "\" \"" & theDestDisk & "\""
do shell script (runScript) -- doesn't work = "cannot execute binary file" ???
The strings theScript, theSrcDisk and theDestDisk are defined earlier in the AppleScript. theScript has a
on run parms
set theSrcDisk to item 1 of parms
set theDestDisk to item 2 of parms
copyAllFiles(theSrcDisk, theDestDisk)
end run
on copyAllFiles(src, dest)
-- whatever
end copyAllFiles
In finishing, you are absolutely correct if you are thinking that the following in AppleScript does the job:
set runScript to load script file (chosenScript)
tell runScript to copyAllFiles(theSrcDisk, theDestDisk)
However, my only excuse is to learn more.
John Love