Reputation: 353
I'm brand new to Applescript and also have some limited experience with Terminal. I made simple shell script today that I saved on my desktop. It's named "Test.sh" and just copies a file from one folder to another. When I run sh ~/Desktop/Test.sh
from within Terminal, everything runs just fine. However, when I type do shell script "/Volumes/volume_name/Users/username/Desktop/Test.sh"
inside Xcode as an Applescript command, nothing happens. I am using Xcode 4.4.1 on Mac OS 10.7.4 (though I guess it's irrelevant). What am I missing?
Upvotes: 2
Views: 2964
Reputation: 7191
Because the path of the startup disk doesn't begin with "/Volumes/"
Use this to get the correct path
set shScript to quoted form of POSIX path of ((path to desktop folder as string) & "Test.sh")
do shell script shScript
Upvotes: 2
Reputation: 174
Let us consider that the applescript you want to run inside the shell script is to empty the trash. Follow these steps:
osascript -e 'tell application "Finder" empty trash end tell'
Upvotes: 0