methodman Posted September 2, 2014 Share Posted September 2, 2014 I've got a short script part of a larger program that should work as follows: Program A is activated and in focus. Program B is a background application. When I press a hotkey, a 'start' button from Program B should be clicked while still in Program A. The clicking of the start button code is below (minus the hotkey functionality). Opt("WinTitleMatchMode", 4) ; #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> #include <TrayConstants.au3> Opt("TrayMenuMode", 3); StartButtonClick() Func StartButtonClick() $t = ControlGetText("[Class:WindowsForms10.Window.8.app.0.378734a]","", "[Class:WindowsForms10.BUTTON.app.0.378734a;INSTANCE:6]"); ;WindowsForms10.BUTTON.app.0.378734a ConsoleWrite("Start button:" & $t); if ($t == "Start") Then ControlClick("[Class:WindowsForms10.Window.8.app.0.378734a]","", "[Class:WindowsForms10.BUTTON.app.0.378734a;Instance:6]"); Endif EndFunc This code works fine on my laptop, but I cannot seem to get it to work on my desktop pc - the code does nothing. The only way I can get it to work is if Program B is activated and in focus, which defeats the purpose of the larger program Both are running windows xp and Au3info gives the same info when looking at window and control info when run on the laptop and the desktop. I am pretty new to autoit - any thoughts? Link to comment Share on other sites More sharing options...
jdelaney Posted September 2, 2014 Share Posted September 2, 2014 (edited) Look at the remarks of ControlClick You might need to do something else, like make a file. If the file exists, do what your button press would do. Edited September 2, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Bert Posted September 2, 2014 Share Posted September 2, 2014 Are you remoting into the desktop? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
methodman Posted September 3, 2014 Author Share Posted September 3, 2014 (edited) Are you remoting into the desktop? No just booting up the desktop and logging in as normal. Look at the remarks of ControlClickYou might need to do something else, like make a file. If the file exists, do what your button press would do. Hmm ok. I'll have a more detailed look at the remarks for controlclick later on today - thanks for your help Edited September 3, 2014 by methodman 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