Jump to content

ControlSend vs. Send


noober
 Share

Recommended Posts

I've been working on sending keys to windows by "controlsend" instead of send. I am coming upon an odd error that I was hoping someone might be able to help me with. If I use "send" to send a keystroke to the active application it works just fine. If I use "controlsend", however, something unique happens. In the application that I wish to send to I can see that it is sending the keystrokes but not where I want them to go. I assume that the window handle and the handle that I need to send to are different. I've tried sending to all the handles I could find in the app (used winspector spy to find the handles) and that fails entirely. Send works like a charm. I'm curious what the difference between the way controlsend and send are. If I can send keystrokes with the same style as send but with the functionaility of controlsend, I'd be set. I am assuming my limited knowledge of controls is at fault here. Feel free to enlighten me.

Link to comment
Share on other sites

ControlSend($handle,$text,$controlid,$key) variables provided are passed by "WinList". It is sending the keystrokes to the application, but it isn't working the same way as the "Send" function would. In short, "Send" functions how I want the keystroke to function in the application, while "ControlSend" will only fill a bit of text into one of the elements of the application. I've been investigating this for a bit, reading through every forum I can find to no avail. I think some knowledge about the differences between "Send" and ControlSend" would be very helpful here. I've been trying to discern that myself currently.

Edited by noober
Link to comment
Share on other sites

I think you should show us an example of what you are attempting, so we can give you pointers. Include a printout of the auto info tool's output on the control you are attempting to controlsend to.

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

  • Moderators

noober,

I have lifted your "5 post" restriction so you can continue to post should you find the need. :)

The app to which you "Send/ControlSend" can indeed make a difference to the correct functioning of the commands. We cannot really offer you an example as it is very specific to the app in question. ;)

So please tell us the app you are trying to automate and, if possible, the output of the Window Info Tool (C:Program FilesAutoIt3Au3Info.exe if you have a standard install) when used on the control in question. Without that information we are pretty much unable to help you further. :(

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

Here is the output of Au3info.exe;

>>>> Window <<<<

Title: Shaiya

Class: GAME

Position: 436, 75

Size: 816, 638

Style: 0x94CB0000

ExStyle: 0x00000100

Handle: 0x00150268

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

Name:

Advanced (Class):

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle:

>>>> Mouse <<<<

Position: 257, 178

Cursor ID: 0

Color: 0x866430

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

-crosses fingers-

Link to comment
Share on other sites

Here is the code;

Opt("SendKeyDownDelay", 55)

Global $Paused

HotKeySet("{PAUSE}", "TogglePause")

HotKeySet("{DEL}", "Terminate")

$timeS = 999

$timeL = 1555

$key = "1"

$controlid = ""

$text = ""

$winList = WinList("Shaiya")

While 1

For $i = 1 to $winList[0][0]

$title = $winList[$i][0]

$handle = $winList[$i][1]

$slpL = Random($timeS, $timeL)

Sleep($slpL)

ControlSend($handle,$text,$controlid,$key)

Next

WEnd

Func TogglePause()

$Paused = Not $Paused

While $Paused

Sleep(100)

ToolTip('Standing by..', 0, 0)

WEnd

ToolTip("")

EndFunc

Func Terminate()

Exit 0

EndFunc

Link to comment
Share on other sites

  • Moderators

noober,

Title: Shaiya

Class: GAME

And this type of app is very likely to mess around with Send/ControlSend - which is why we asked. ;)

Unfortunately you appear to have missed the Forum rules when you joined. Please read them now (there is also a link at bottom right of each page) - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. :naughty:

See you soon with a legitimate question I hope. :)

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...