Possible to use WSH in scripts?

ponchoman1 wrote on 8/20/2004, 12:05 PM
Hi All, Is it possible to use Windows Script Host in a Vegas Script? Normally, I can include the following code in my vbscripts, but vegas doesn't like it....

Set AIT = WScript.CreateObject("AutoItX.Control")

I get an error saying Set anLet are no longer used.

So I tried this.....

dim AIT = WScript.CreateObject("AutoItX.Control")

and this...

dim AIT as new WScript.CreateObject("AutoItX.Control")

Nothing seems to work. Basically I want to be able to instantiate AutoIt so I can use keystrokes to automate the Text Media properties.

Thx for your help.


Comments

dust wrote on 8/20/2004, 11:59 PM
I never tried it in VB, but in JScript, it would look like this:


var WshShell = new ActiveXObject("WScript.Shell");
WshShell.SendKeys("{Right}"); // Sends Right Arrow to Vegas
WshShell.SendKeys("{Left}"); // Sends Left Arrow to Vegas


So, basically, you instantiate an ActiveXObject("WScript.Shell") and use its SendKeys method. Should be no big problem doing this in VB. One warning though: if you send more than one keystroke, it sometimes seems to happen that one or another is "forgotten". You could also have a look into AutiIt, but this is getting more complicated then. Casiomeier on teh German VegasVideo forum (I think his username here is WolfgangJ, but I'm not sure) wrote a wrapper script NETAutoId.dll that allows access to AutoIt. Unfortunately I don't know where it can be downloaded...

Hope that helps, Andy
ponchoman1 wrote on 8/23/2004, 12:35 PM
Thx Dust,

That is exactly what I was looking for. I've tried out the sample script you posted and it works. Much appreciated.

If you come across that script for the AutoIt wrapper, please let me know. I've tried to seach the w internet for it but had no luck. AutoIt is a great tool.

Thx!