Making the script wait 'til a file exists

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
rozling
Newbie
Posts: 4
Joined: Wed Apr 06, 2005 2:54 pm
Location: Dublin, Ireland

Making the script wait 'til a file exists

Post by rozling » Fri Jun 10, 2005 4:28 pm

Hi, I'm trying to get my script to wait until a file exists before it continues.

Sorry I'm sure this is a really obvious one... :oops:

My instinct is to use iffileexists>itdoes,itdoesnt but I'm not sure what to use for label>itdoesnt. Should I stick a label before the iffileexists command & stick in a wait, or is there a more efficient way to go about this?

Thanks

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jun 10, 2005 4:53 pm

I think you're on the right track.

Label>WaitForFile
Wait>1
IfFileExists>[file path and name],Continue,WaitForFile
Label>Continue

Hope this helps,
Dick

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Jun 10, 2005 7:03 pm

I have had problems using IfFileExists. Not because of Macro Scheduler, but because how the file was created. So at times I need to check the FileSize every few seconds. Once the size stops growing then I know I can work with it safely.

This has happened frequently when using FTP to up/download a file. The filename will exist, but the file size is not complete. May also check the original size being up/downloaded and wait until result size equals original source size.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

rozling
Newbie
Posts: 4
Joined: Wed Apr 06, 2005 2:54 pm
Location: Dublin, Ireland

Post by rozling » Fri Jun 10, 2005 9:31 pm

Thanks guys - that might be a factor Bob, as the file in question (a large PDF) is being created by the script, so its filesize is definitely changing.

Thanks a lot for the quick replies!! I'll have to wait til Monday to try your suggestions but it looks like I'll be able to manage with it now :)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts