flownzu Posted March 14, 2013 Share Posted March 14, 2013 (edited) Hi, is there some way to interact with controls without loosing focus of the active window? I need to fill in InputBoxes of a program I start hidden but when it starts I loose focus of my active window and when I switch back the data that should be written to the controls of the hidden program are written into the active window instead? I dont want that "solution" btw: $ActiveWindow = WinGetTitle("[ACTIVE]") ;~ Input data into the controls WinActivate($ActiveWindow) Maybe there is some way to actually interact with these controls without even giving the program the focus? Please enlighten me Edited March 14, 2013 by flownzu Link to comment Share on other sites More sharing options...
PhoenixXL Posted March 14, 2013 Share Posted March 14, 2013 (edited) Welcome to the Forum tryControlSendControlCommandControlSetTextControlClickControlListViewControlTreeViewor try your HELPFILE.You would receive much help from it. Regards Edited March 14, 2013 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
flownzu Posted March 14, 2013 Author Share Posted March 14, 2013 (edited) Welcome to the Forum :)tryControlSendControlCommandControlSetTextControlClickControlListViewControlTreeViewor try your HELPFILE.You would receive much help from it.RegardsI appreciate your help, but I already interact with with the control through ControlSetText ControlSetText($edxHwnd, "", "[CLASS:Edit; INSTANCE:1]", $edxPort)ControlSetText($edxHwnd, "", "[CLASS:Edit; INSTANCE:2]", $edxPort + 1)ControlSetText($edxHwnd, "", "[CLASS:Edit; INSTANCE:3]", "212.24.57.34")ControlClick($edxHwnd, "", "[CLASS:Button; INSTANCE:2]")ControlClick($edxHwnd, "", "[CLASS:Button; INSTANCE:4]")I thought I clear up some things I already tried. Obviously the switch back to the window that was active before the focus was lost but this doesnt solve the issue that the data gets sent to completely different controls if I manually change windows while the ControlSetText is executed. I also tried _SendMessage to directly send the command to the control. Didn't work either, so I'm pretty desperate right now.Edit: Ok I made some horrible mistakes. I went with this code: $edxpid = Run(@ScriptDir & "\proxy\edxSilkroadProxy.exe", @ScriptDir & "\proxy", @SW_HIDE) $edxPort = Random(16000, 19000, 1) $list = WinList("[CLASS:#32770]") For $i = 1 To $list[0][0] If WinGetProcess($list[$i][1]) = $edxpid Then $edxHwnd = $list[$i][1] EndIf Next ControlSetText($edxHwnd, "", "[CLASS:Edit; INSTANCE:1]", $edxPort) ControlSetText($edxHwnd, "", "[CLASS:Edit; INSTANCE:2]", $edxPort + 1) ControlSetText($edxHwnd, "", "[CLASS:Edit; INSTANCE:3]", "212.24.57.34") ControlClick($edxHwnd, "", "[CLASS:Button; INSTANCE:2]") ControlClick($edxHwnd, "", "[CLASS:Button; INSTANCE:4]") Didnt realize that I go through the WinList Command so fast that the tool I run hasnt even started up so I dont even get the Window Handle. Thats why the sending data to the control was so messed up. So this thread can be closed Edited March 15, 2013 by flownzu Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 15, 2013 Moderators Share Posted March 15, 2013 flownzu,edxSilkroadProxy.exethis thread can be closedAs it indeed will be. Please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game interaction - before you post again. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts