Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Progress indicators and "do shell script" Freeze



Apple have a page discussing this at:

http://developer.apple.com/technotes/tn2002/tn2065.html

The basic deal is that you can start a shell script but have it return something other than a result, such as it's process id (pid). Then you check something using a loop, a log file perhaps, or checking the filesize of whatever is being downloaded, and use this information to update your progress. When you're loop determines that the download is complete, you can try to kill the process using the pid returned earlier. You need to put this in a try statement, otherwise if your shell script exited cleanly, there won't be a process with your pid to kill, and your app will throw an error.

I attached the following to a stop button in my dialog box containing the progess bar.
--
property pid : "nothing"

on stopProcessingReport(pid)
if pid is equal to "nothing" then
display dialog "FunnelWeb Anaylizer Command line was never started."
else
try
do shell script "kill " & pid
log "The process " & pid & " was terminated"
on error
log "The task has already finished"
end try
end if
close panel window "progress"
end stopProcessingReport


On 01/12/2003, at 6:16 AM, DJ MacIntosh wrote:

I'm having trouble getting progress indicators and shell scripts to play
together nicely.

While executing a " do shell script "curl -LO " & URL " command where I'm
downloading an 18 MB file from the web, the progress indicator stops, as a
matter of fact the entire app freezes up until the shell script is done.
I've even tried URL Access Scripting, but that does the same thing, and I'm
not sure if I can use URL access scripting under Jaguar, I know I can under
Panther, since this app would be used potentially under both.

Is there a way to keep my indeterminate progress indicator spinning while
the curl "do shell script" is downloading? And is there a way to get the
file size of the file I want to download before I download it and use it's
size in a incremental progress bar?

DJ MacIntosh
_______________________________________________
applescript-studio mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-studio
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.