Sign in to follow this  
Followers 0
Valarn

Trouble with ControlSend

3 posts in this topic

Here's my script:

Global $paused
$paused = true
hotkeyset("^!p", "Pause")
global $basedelay = 8200
global $delay
while 1
    while $paused
        sleep(100)
    WEnd
    $delay = $basedelay + random(0, 500, 1)
    if ControlSend("Everquest", "", "gifeclass1", "2", 1) = 0 Then
        msgbox( 4096, "error", "window or control not found...")
    EndIf
;send("2")
    sleep(Random(100, 150, 1))
    ControlSend("Everquest", "", "gifeclass1", "8", 1)
;send("8")
    sleep($delay)
WEnd
func Pause()
    if $paused then
        $paused = false
    Else
        $paused = true
    endif
endfunc
exit

Here's the window info from Au3Info:

>>>> Window <<<<
Title:  EverQuest
Class:  gifeclass
Position:   0, 0
Size:   646, 505
Style:  0x14CA0000
ExStyle:    0x00040100

>>>> Control <<<<
Class:  
Instance:   
ID: 
Text:   
Position:   
Size:   
ControlClick Coords:    
Style:  
ExStyle:    

>>>> Mouse <<<<
Position:   541, 381
Cursor ID:  2
Color:  0xD9BD8A

>>>> StatusBar <<<<

>>>> Visible Text <<<<


>>>> Hidden Text <<<<

Microsoft Spy++ screenshot included.

ControlSend always returns 0. I've also tried the UDF ControlSendPlus, that also fails. Send() will send the keys properly, but I would prefer for the script to work in the background.

post-26165-1187130435_thumb.jpg

Share this post


Link to post
Share on other sites



Here's my script:

Global $paused
$paused = true
hotkeyset("^!p", "Pause")
global $basedelay = 8200
global $delay
while 1
    while $paused
        sleep(100)
    WEnd
    $delay = $basedelay + random(0, 500, 1)
    if ControlSend("Everquest", "", "gifeclass1", "2", 1) = 0 Then
        msgbox( 4096, "error", "window or control not found...")
    EndIf
;send("2")
    sleep(Random(100, 150, 1))
    ControlSend("Everquest", "", "gifeclass1", "8", 1)
;send("8")
    sleep($delay)
WEnd
func Pause()
    if $paused then
        $paused = false
    Else
        $paused = true
    endif
endfunc
exit

Here's the window info from Au3Info:

>>>> Window <<<<
Title:  EverQuest
Class:  gifeclass
Position:   0, 0
Size:   646, 505
Style:  0x14CA0000
ExStyle:    0x00040100

>>>> Control <<<<
Class:  
Instance:   
ID: 
Text:   
Position:   
Size:   
ControlClick Coords:    
Style:  
ExStyle:    

>>>> Mouse <<<<
Position:   541, 381
Cursor ID:  2
Color:  0xD9BD8A

>>>> StatusBar <<<<

>>>> Visible Text <<<<
>>>> Hidden Text <<<<

Microsoft Spy++ screenshot included.

ControlSend always returns 0. I've also tried the UDF ControlSendPlus, that also fails. Send() will send the keys properly, but I would prefer for the script to work in the background.

I don't know the answer but have you tried making the q upper case in EverQuest?

if ControlSend("Everquest", "", "gifeclass1", "2", 1) = 0 Then


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You're wrongly call ControlSend: ControlSend("Everquest", "", "gifeclass1", "8", 1)

ControlSend ( "title", "text", controlID, "string" [, flag] )

Parameters

title The title of the window to access.

text The text of the window to access.

controlID The control to interact with. See Controls.

string String of characters to send to the control.

flag [optional] Changes how "keys" is processed:

flag = 0 (default), Text contains special characters like + to indicate SHIFT and {LEFT} to indicate left arrow.

flag = 1, keys are sent raw.

You're trying to send something to "gifeclass1" control which is inexistent. If you look into your AutoitWindow Info you will see that you don't have any control identified and "gifeclass" is the window class.

The only option remeining is to send to an empty control: ControlSend("Everquest", "", "", "8", 1)

... but be aware of the fact that Everquest window needs to be active or the ControlSend will fail.

Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0