da_jokker Posted April 13, 2006 Share Posted April 13, 2006 I have the following code in a Visual Basic Form....... '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim objAutoIt As AutoItX3Lib.AutoItX3 Set objAutoIt = New AutoItX3Lib.AutoItX3 With objAutoIt Call .Opt("WinTitleMatchMode", 4) Call .ControlClick("classname=ThunderRT6FormDC", "", "2", "left", 1) End With Set objAutoIt = Nothing End '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' I have almost the same code in a VB Script File '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim objAutoIt Set objAutoIt = WScript.CreateObject("AutoItX3.Control") With objAutoIt .AutoItSetOption "WinTitleMatchMode", 4 .ControlClick "classname=ThunderRT6FormDC", "", "2", "left", 1 End With set objAutoIt = nothing WScript.Quit() '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' This code works perfectly .... UNTIL I compile the program then it doesn't work at all. I tried converting the VBScript over to a .AU3 file so it could be compiled and it didn't work there either. I would rather not leave this as a VBScript but unless I can figure it out... I don't know what else to do. What's wrong? Thkx Link to comment Share on other sites More sharing options...
MHz Posted April 13, 2006 Share Posted April 13, 2006 Perhaps the window is not there when ControlClick happens? You should wait for a window before controlling it. This is the VBS script with addition. Dim objAutoIt Set objAutoIt = WScript.CreateObject("AutoItX3.Control") With objAutoIt .AutoItSetOption "WinTitleMatchMode", 4 .WinWait "classname=ThunderRT6FormDC" .ControlClick "classname=ThunderRT6FormDC", "", "2", "left", 1 End With set objAutoIt = nothing WScript.Quit() See if that helps. Link to comment Share on other sites More sharing options...
da_jokker Posted April 17, 2006 Author Share Posted April 17, 2006 Thanks...I can try that but the program I'm trying to click on is always running (it's in the systray) I never thought automating something to simple click on a systray icon would be so dang hard! Thanks again for at least trying. Link to comment Share on other sites More sharing options...
Zach Posted April 21, 2006 Share Posted April 21, 2006 Remove your reference to AutoIt Declare it as an object only Public AutoIt As Object Then in your Form_Load, or equiv - Set AutoIt = CreateObject("AutoIt.Control") Then stuff like gdoc = AutoIt.IniRead(ini, "SDEXT", "Doc", 0) should work no problem - having been using it like that for a long time Link to comment Share on other sites More sharing options...
Zach Posted April 21, 2006 Share Posted April 21, 2006 - Obviously, Public, Private, whatnot is your use. I declare it in a module, and set it in the main form - and then I can use it any of the 50 or so forms I have in the App with no problem, and not having to mess with it anymore. Link to comment Share on other sites More sharing options...
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