Jump to content

Interacting with controls without loosing focus of active window?


Recommended Posts

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 by flownzu
Link to comment
Share on other sites

Welcome to the Forum :)

try

ControlSend

ControlCommand

ControlSetText

ControlClick

ControlListView

ControlTreeView

or try your HELPFILE.

You would receive much help from it.

Regards

Edited 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

Welcome to the Forum :)tryControlSendControlCommandControlSetTextControlClickControlListViewControlTreeViewor try your HELPFILE.You would receive much help from it.Regards

I 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 by flownzu
Link to comment
Share on other sites

  • Moderators

flownzu,

edxSilkroadProxy.exe

this thread can be closed

As 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. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...