Jump to content

hotkey


6105
 Share

Recommended Posts

How i can know what key is pressed?

I can know what key is pressed more easy? now i know just 1 metod:

HotKeySet("a", "a")
HotKeySet("b", "b")
HotKeySet("c", "c")
HotKeySet("d", "d")

Func a()
        MsgBox(0,'','is pressed a')
EndFunc   ;==>a
Func b()
        MsgBox(0,'','is pressed b')
EndFunc   ;==>b
Func c()
        MsgBox(0,'','is pressed c')
EndFunc   ;==>c
Func d()
        MsgBox(0,'','is pressed d')
EndFunc   ;==>d

Thanks.

[center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]

Link to comment
Share on other sites

You can use the same handler function for more than one key and the @HotKeyPressed macro will indicate which key it was:

HotKeySet("a", "_Button")
HotKeySet("b", "_Button")
HotKeySet("c", "_Button")
HotKeySet("{ESC}", "_Quit")

While 1
    Sleep(10)
WEnd

Func _Button()
        Local $sKey = @HotKeyPressed
        MsgBox(0,'','is pressed ' & $sKey, 2)
EndFunc   ;==>a

Func _Quit()
        Exit
EndFunc   ;==>d

:graduated:

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

Hello toader,

Maybe _IsPressed() is what you are looking for?

Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

Realm. for every presed symbol to write function with _isPressed will be long and hard for procesor..

If _IsPressed("23", $dll) Then
        MsgBox(0,"_IsPressed", "End Key Pressed")
        ExitLoop
    EndIf

now the best is with hotkeys with 4 lines of function and +1 line for every hotkey

Func _Button()
        Local $sKey = @HotKeyPressed
        MsgBox(0,'','is pressed ' & $sKey, 2)
EndFunc   ;==>a

Thank you PsaltyDS .

Edited by toader

[center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]

Link to comment
Share on other sites

Before i reported thread about 30 minutes ago (before editing or deliting) i so a almost functional keyloger, there isnt anything hard for cpu on _IsPressed if then one isnt makeing keyloger.

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

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