Scott Smith Posted November 14, 2005 Posted November 14, 2005 I have a simple section of VBScript in one web page that is attempting to use AutoIT to activate another web page and send a few characters to it. When I reload the page, I get an error message stating: Error: Variable is undefined: 'WScript' The code is: <script language=vbscript> Option Explicit Dim oAutoIt Set oAutoIt = WScript.CreateObject("AutoItX3.Control") 'this is the line that generates the error oAutoIt.WinActive "ePort - ACROFile Input - Microsoft Internet Explorer", "" oAutoIt.Send "Smith{ENTER}Scott" WScript.Quit </script> Any thoughts would be greatly appreciated.
beaker Posted November 15, 2005 Posted November 15, 2005 Scott it sounds like you need to register the dll. If you didn't install the AutoIt package (Which contains autoitx.dll, then type the following at a command prompt: regsvr32 c:\windows\system32\autoitx.dll or whatever path is appropriate.
doudou Posted November 18, 2005 Posted November 18, 2005 Scott, used within a Web page VBScript defines a global scope function CreateObject, WScript object is indeed undefined, so type: Set oAutoIt = CreateObject("AutoItX3.Control") instead of: Set oAutoIt = WScript.CreateObject("AutoItX3.Control") Note also, that IE would ususally prompt you several times to confirm object activation. UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ
Scott Smith Posted November 18, 2005 Author Posted November 18, 2005 Thanks. About five minutes after posting that message I said to myself, "Self, why not just try CreateObject without the WScript?" Surprise, surprise, it worked. The WScript of course was working fine in the WIndows Script Host but not VBScript. Now it all makes sense. Thank you much for the input.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now