New topic: Proper way to pause when checking for existence of a file
<http://forums.realsoftware.com/viewtopic.php?t=47041> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message mbrogdon Post subject: Proper way to pause when checking for existence of a filePosted: Fri Feb 22, 2013 7:25 pm Joined: Thu Jan 24, 2013 5:10 pm Posts: 10 What is the proper way to pause when checking for existence of a file? I know I can do this with a loop that checks for a FolderItem, but I also know that's frowned upon. In method1 I download a zip file. >From a loop, Method1 calls Method2 which unzips the downloaded file by >creating a VBS file, writing VBS code to it and launching it. Once the VBS >file has finished unzipping the downloaded file, it deletes itself. Since the VBS file is not a part of the RB application, knowing it has finished unzipping is an issue. Since the VBS file deletes itself when done, I thought I would check for the existence of the VBS file. If it's not there, continue executing code in RB. After method1 calls method2, method2 needs to return to the loop in method1. I would assume I would use a timer and bounce back and forth somehow between the timer action event and method2. This seems like an easy concept, but having a hard time wrapping my head around it. Top markmark Post subject: Re: Proper way to pause when checking for existence of a filPosted: Sat Feb 23, 2013 12:09 am Joined: Fri Sep 24, 2010 6:12 pm Posts: 31 If I understand you correctly, it sounds like you're trying to fit a structured methodology to an event driven one? I am assuming you don't know the name of the .zip file. Why not? I don't know what VBS is, I am assuming it's a language on some platform (windows/Mac?) Cannot this VBS set an environment variable with the name of the file/location and your timer event periodically check for it. Otherwise, you might consider using shell to block/wait until the VBS has completed? Top charonn0 Post subject: Re: Proper way to pause when checking for existence of a filPosted: Sat Feb 23, 2013 12:29 am Joined: Mon Apr 02, 2007 2:08 am Posts: 1136 Location: San Francisco, CA, USA Is there a reason for using the VBS script to unzip the file? There are easier ways to unzip files in RB: RealZip plugin Zip Archive classes for REALbasic MonkeyBread Compression plugin Or calling a command-line unzip tool using an RB shell. _________________ Boredom Software Top timhare Post subject: Re: Proper way to pause when checking for existence of a filPosted: Sat Feb 23, 2013 2:06 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 12078 Location: Portland, OR USA You need to break the method into 2 parts. Your method basically looks like Do some stuff before unzip Start the unzip process <wait> Do some stuff after unzip Break it into Do some stuff before unzip Start the unzip process Start the timer Do some stuff after unzip The timer keeps checking for the existance of the file (or absence of the VBS file). When it finally senses the unzip is done, it calls the second part of the code. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
