Re: making an app wait for external process
Re: making an app wait for external process
- Subject: Re: making an app wait for external process
- From: Jason Staloff <email@hidden>
- Date: Thu, 31 Jul 2003 11:54:52 -0400
Hi Ron,
Thank you so much for your advice, it works great. My code is included
below on the chance it will benefit someone.
Cheers! -Jason
tell application "GraphicConverter"
TWAIN acquire
end tell
--wait for scanner to finish scanning...
set gcwindows to "null"
repeat until gcwindows contains "untitled"
with timeout of 1 second
try
set gcwindows to name of window "untitled" of application
"GraphicConverter"
end try
end timeout
end repeat
-- now we can save to disk, copy contents to clipboard, or maybe
-- return data directly to FileMaker
set destFldr to "Macintosh HD:Users:jason:Desktop:"
tell application "GraphicConverter"
save window "untitled" in destFldr & "scanimage.jpg" as JPEG
quit
end tell
On Friday, July 25, 2003, at 11:35 AM, Ron Bishop wrote:
>
I usually have a repeat loop that tests for the existence of an
>
object. It keeps repeating until it returns true; then the script
>
continues.
>
>
Example~
>
>
tell application "Finder"
>
set mounted_disks to name of disks
>
if mounted_disks does not contain "MACSERVE.VOLUME" then open
>
location > "afp://.username.starnds:email@hidden/MACSERVE.VOLUME"
>
repeat until mounted_disks contains "MACSERVE.VOLUME"
>
set mounted_disks to name of disks
>
end repeat
>
--do whatever I'm going to do with that volume...
>
end tell
>
>
Maybe you can have Graphic Converter test for the existence of
>
"document 1" or whatever (I not familiar with scripting GC)
>
>
Ron Bishop
>
>
On Friday, July 25, 2003, at 10:05 AM, Mania Bug wrote:
>
>
> I've searched the archives and have not come across anything that
>
> looks like the right solution for this... I'm scripting Graphic
>
> Converter to acquire an image via twain, and I need my script to wait
>
> for the scan to complete before trying to write the file. The delay
>
> command won't work because it pauses the whole computer: when it
>
> ends, Graphic Converter still isn't ready to accept more instructions
>
> and the script dies.
>
>
>
> Please send me your favorite strategy for waiting. Thanks!
>
>
>
> Jason
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.