Jump to content

Recommended Posts

Posted (edited)

ControlSend($handle ,"" ,"" ,"+")

not right, you forgot about controlID. Use Autoit_Window_Info to get ctrl id

ControlSend ( "title", "text", controlID, "string")

Edited by Godless

_____________________________________________________________________________

Posted

Hmm so actually if i would like to send an key + to window of $handle how would it be ?

No, that should work... Your problem is that the script exits as soon as the message box closes, so you need a loop there as well.

Global $handle = WinGetHandle("Window of interest") ; Must be declared in global scope to be used in functions.
HotKeySet("{F5}" ,"Start")
HotkeySet("{ESC}", "End")

MsgBox(1,"","The win handle is " & $handle)

While 1 ; Loop here forever (until "esc" hotkey pressed)
    Sleep(100)
WEnd

Func Start()
    WinActivate($handle)
    WinWaitActive($handle)
    ControlSend($handle ,"" ,"" ,"+")
EndFunc

Func End()
    Exit
EndFunc
Posted (edited)

The control ID is not required, so you can send it just with the window handle and the string to send. I don't, however, see any loop to keep the script alive while waiting for "F5".

:D

Edit: Oops, too slow.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

The control ID is not required, so you can send it just with the window handle and the string to send. I don't, however, see any loop to keep the script alive while waiting for "F5".

:D

Edit: Oops, too slow.

Just as a test I tried this... It would seem it queues it nicely for you! It's something I never really thought about, but pressing it 5 times while the first MsgBox is showing triggers the function 5 times.

HotKeySet("{F5}", "_Go")

MsgBox(0, "Press Hotkey now!!", "Press the hotkey pls!")

Func _Go()
    MsgBox(0, "Hotkey Recieved", "This test actually worked")
EndFunc

This could have a few negative effects... But I think its pretty cool.

Posted (edited)

Thanks for support . Actualy i got only 1 problem :D It now uses the handle and focuss on the window of interest BUT it does not send the needet key :huggles: it does not want to send the + key idk why :

Edited by ForsakenGod
Posted (edited)

It would appear that "+" is not sent : Unless you use the raw mode option:

ControlSend($handle ,"" ,"" ,"+", 1)

This worked for me:

ControlSend("[CLASS:SciTEWindow]", "", "", "+", 1)

Hehe i was playing with it a bit and here is what i have :D

ControlSend($handle ,"" ,"" ,"{+}")

Nice & working

Thanks for your support :huggles:

Edited by ForsakenGod
Posted

@Mat: Good catch! I've had that issue before and should have seen it too! Without the raw flag, "+" is just "{SHIFT}", as in Send() code.

:-)

As ForsakenGod pointed out, you just need to escape it ("{+}"), I forgot all about shift!

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
  • Recently Browsing   0 members

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