Re: Ignore responses from do shell script
Re: Ignore responses from do shell script
- Subject: Re: Ignore responses from do shell script
- From: Shane Stanley <email@hidden>
- Date: Sat, 09 Jul 2016 22:14:21 +1000
On 9 Jul 2016, at 9:59 PM, Phil Stokes <email@hidden> wrote:
The answer is to run the shell command as a background task using the “&” function.
do shell script theCommand & " &> /dev/null &"
If you're not interested in the result (other than success or failure) and you don't need admin privileges, you can also do it this way:
use AppleScript version "2.4" use scripting additions use framework "Foundation"
set theTask to current application's NSTask's launchedTaskWithLaunchPath:"/bin/mkdir" arguments:{"-p", "/Users/shane/Desktop/Test_folder"} repeat -- update progress or whatever you want to do here if theTask's isRunning() as boolean then exit repeat delay 1.0E-5 end repeat if theTask's terminationStatus() is not 0 then -- there was an error end if
You can also use NSTask if you need the result, but it's a bit more code.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden