Another wait for process to finish

Thanks Kai for the trash tip. Heres another

I have a script that checks ftp address’s from a database through fetch. After it the checks another script runs to upload to a different address (it just does OK!)

I have have tried timeouts but it will always skip to the next script before completeing the first,

Any ideas

repeat while bla bla 
delay 2
end repeat

or you could just work out the time it will take to finish
and do

delay 400 -- or what ever

I realise this bigkm. The problem is when you don’t know how long a process will take. I am trying to get applescript to recognise a process is going on before moving to next process. Intelligent timeout, delay, whatever

Couldn’t you write a “flag” file out of the first script when it completed, and not start the second one until it saw the “flag”? The second one could start by deleting the flag, so it could look for it again next time.

Not sure what you mean. How do I flag a process when its finished? Applescript does not recognise the process is going on ie

tell app “Fetch”

upload blah balh blah

end tell

choose folder

the choose folder step will appear before the upload finishes. (the upload could take 1 second or 10mins…)

I am having a heck of a time with this too. I’m also using 10.3.9 at work and Fetch 4.0.3.

Question: Is there a way to have the AppleScript look at the Cursor? If it could tell the cursor wasn’t a “running dog” anymore, it would know the process of uploading/downloading is done.

I can’t get the “with timeout of…” to work in any fashion. If I could get it to wait for the little running dog to go away and turn back into the regular Arrow cursor that would do the job.

There MUST be a way.

Thanks Jacques.

I am using the first of your two examples and it is indeed pausing and allowiing the files to upload. My problem now is that I get a AppleScript Timeout Error before it continues to the next step (moving the files into a “Sent” folder). Any suggestions?

And thanks again for the help.

I think I figured out part of the problem. I am uploading a folder and everything in it. When the folder gets sent, the script looks to see if the Item was sent, and it (the folder) was sent. It then proceeds to the next part of the script. Thats all the longer it thinks it needs to wait.

I just need it to wait long enough to get the files in the folder through.