Re: Getting pid and error from do shell script
Re: Getting pid and error from do shell script
- Subject: Re: Getting pid and error from do shell script
- From: Luther Fuller <email@hidden>
- Date: Tue, 26 Dec 2006 11:53:45 -0600
On Dec 26, 2006, at 10:56 AM, David Simerly wrote:
On 12/23/06 1:47 PM, "Luther Fuller" <email@hidden> wrote:
My problem is that I also need to get a pid from the second script if
the user does NOT click Cancel. I have read TN2065 "do shell script
in AppleScript" for the third time, but it offers no understanding of
this problem. (It recommends that I "See the sh man page under
"Redirection" for more details." ... but there is no man page for
sh!)
Well, first, if the hdiutil returns the pid, then it will be
returned by do shell script. So you can do something like:
set the_pid to do shell script quoted form of ( "hdiutil
convert " & inFile & " -format UDZO -encryption -o " & outFile )
Not having scripted hdiutil in several years, I don’t recall
whether this will work.
It won't work. First, you need the & " &> /dev/null & echo $!" to
return a pid. Second, the pid is returned immediately, and without
error, after "do shell script ...", allowing my script to proceed
while the dialog displayed by "-encryption " is still showing.
The solution, if possible, is to combine the pid and error code into
a single result that is returned AFTER the user clicks "Cancel" or
"OK" in the hdiutil encryption dialog. My AppleScript code would then
read the result and act accordingly.
_______________________________________________
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/mailman//archives/applescript-users
This email sent to email@hidden