Force function to wait for SendKeys

casikmeier wrote on 11/6/2005, 6:09 AM
Hi,

I've read several threads belonging to this subject, but I found no working solution.

How can I force a script function to wait for some "SendKeys"?

example:
the function "GoOnAfterKeystrokes()" should wait for the key actions, but the function is running before.


WshShell.SendKeys("s");
WshShell.SendKeys("{DEL}");
GoOnAfterKeystrokes();

Hope someone can help.

Thanx in advance

Comments

jetdv wrote on 11/6/2005, 11:36 AM
Vegas can't process those keys until after the script ends. Therefore, it will do you no good to wait as the keys would never be processed.
casikmeier wrote on 11/7/2005, 12:07 PM
Thanks for the reply.

I found this out after several trial and error actions ... no sleep function did work - I confirm as you described.

The subject was to delete the selected events by key cause the rippling functions within the timeline only work correctly by using the delete key. If I would use scripting functions to delete the events I had to ripple all events manually via scripting.

Greetings
jetdv wrote on 11/7/2005, 1:22 PM
If I would use scripting functions to delete the events I had to ripple all events manually via scripting.

Yep, that's the way it works. Can be a royal pain if you want it to automatically ripple.
casikmeier wrote on 11/11/2005, 1:53 AM
Now I've got my script working well.
But there is one question left:

how can I detect whether ripple mode is on or off ? Is there a registry key ?

If I could find this out I would be happy with my script.

Thank you in advance
JohnnyRoy wrote on 11/11/2005, 1:05 PM
You can’t query ripple mode from within a script. I don’t know what your script does but if it has a GUI just add a Ripple checkbox and ask the customer if they want to ripple or not.

You should also be aware that if you are writing this script to work in both Vegas 5 and Vegas 6, moving events have VERY different behavior in the two versions! Your code will have to compensate for this.

~jr
casikmeier wrote on 11/12/2005, 3:29 AM
Thank you, JohnnyRoy,

I don't want to use a GUI due to fast script action while editing.

My script has the function cutIn and cutOut as many scripts within this forum. But I combined a cut via script and deleting the selected events by KeySend{DEL} at least.
So I don't have to ripple all events manually but the ripple mode does his best ;-)

The only thing I have to do is to set the cursor to the timecode at cutting time (if rippling is off) and move the cursor to the start of the deleted event (if rippling is on). So I would detect the ripple mode to have not to set the riple mode within the script.

Ok, due to your reply I would use parallel scripts, one for "ripple mode on" and another for "ripple mode off".

Greetings
Wolfgang
fould12 wrote on 3/15/2017, 11:36 AM
Vegas can't process those keys until after the script ends. Therefore, it will do you no good to wait as the keys would never be processed.

Maybe a script can't process keys until after the script ends, but what about an extension? Could an extension activate a SendKey and wait until the SendKey is done before doing something else?

jetdv wrote on 3/18/2017, 8:08 PM

I would still say no because they still would not be processed until the running function finished.