Comments

JohnnyRoy wrote on 5/29/2011, 5:44 AM
If you want it to pause and return control to Vegas that is impossible. Scripts must run to completion before Vegas gets control again. If you just want it to wait, you could tell the thread to sleep but then all of Vegas would be unresponsive while the script is sleeping.

~jr
Kit wrote on 5/29/2011, 7:46 AM
Thanks, I'm looking for a way to get a script to wait while a folder is created on a USB stick. It's actually a Sound Forge script that allows the user to select a folder to export mp3 files. The user has the option to create a new folder and I've found that this is so slow on a USB2 stick that the script fails to export the files because the directory hasn't been made by the time the script is ready to export.

Kit
JohnnyRoy wrote on 5/29/2011, 6:02 PM
You could check for the folder existence in a loop. Use Thread.Sleep(5000) to sleep 5 seconds then check again. You could add a counter so that you only do this a certain number of times before declaring something went wrong so that you don't wait infinitely. You might want to also switch your cursor to a wait cursor to let the end user know you are waiting.

~jr
Kit wrote on 5/30/2011, 8:41 AM
Cheers - Thread.Sleep(5000) etc gave me an error message - it wouldn't compile. I did set up a loop to check the folder existence. It seems to work when I run the script from the script window but not if I run it from a keyboard shortcut command. I guess something isn't right but have been unable to figure out what.
JohnnyRoy wrote on 5/30/2011, 5:25 PM
> "Thread.Sleep(5000) etc gave me an error message - it wouldn't compile."

You need to add:
using System.Threading;
to the top of your script.

~jr
Kit wrote on 5/31/2011, 5:19 PM
Arh -that's what I missed! Thanks.

Kit