Jump to content

How Hotkey works?


 Share

Recommended Posts

Are you asking how to send the key you press to the window you are using if it is a hotkey? If your answer is yes below I have some code that may assist your endeavors.

HotKeySet("a", "somefunc")
While 1
   Sleep(100)
WEnd
Func somefunc()
   HotKeySet("a")
   Send("a")
   HotKeySet("a", "somefunc")
EndFunc

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • 3 weeks later...

try this 1

#include <misc.au3>
;... your gui
while 1
if _ispressed ("41") and _ispressed("11") and winactive("gui") then;strg + a
;do something
endif
wend

this works just like a hotkey and it only works in your gui

Edited by Nuffilein805
Link to comment
Share on other sites

YOu dont aswer my qeustion

Again , "41" is asc of a ... so if its false , how i know what key what number is ?

The "codes" that you use with this can be found here: MSDN Database

Though, this can be made much simpler by doing it like this(code taken from one of my gui scripts):

While 1
    If WinActive($wHandle) Then
        HotKeySet("B", "_sendB")
    Else
        HotKeySet("B")
    EndIf
    Sleep(100)
Wend

Func _sendB()
    HotKeySet("B")      ; <-- To prevent recursive stuff
    Send("B")
    HotKeySet("B", "_sendB")
EndFunc
Edited by FreeFry
Link to comment
Share on other sites

HotKeySet("{F1}", "HotKeyFunc")
HotKeySet("{F2}", "HotKeyFunc")

While True
    Sleep(60000)
WEnd

Func HotKeyFunc()
    If WinActive("WindowNameOrHandle") Then
        Switch @HotKeyPressed
        Case "{F1}"
        ; F1 action
        Case "{F2}"
        ; F2 action
        EndSwitch
    Else
        HotKeySet(@HotKeyPressed)
        Send(@HotKeyPressed)
        HotKeySet(@HotKeyPressed, "HotKeyFunc")
    EndIf
EndFunc

Link to comment
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
 Share

  • Recently Browsing   0 members

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