Jump to content
Sign in to follow this  
b0x

what does this function?

Recommended Posts

b0x

Hello guys,

i want to write a script that plays sounds if someone hits the F1-12 keys, something like a hotkey script. Now i found a keylogger in AutoIt where i want to look up the way how the script knows which key is pressed. I found this function. It looks like i need to know the hexkeys for the F1-12 buttons, dont I?

If it is like i thought, could somebodey tell me the hexkeys for the F-Buttons?

thank you,

b0x

Global $user32 = DllOpen("user32")

Func pressed($hexKey)
    Local $aR, $bRv
    $hexKey = '0x' & $hexKey
    $aR = DllCall($user32, "int", "GetAsyncKeyState", "int", $hexKey)
    If $aR[0] <> 0 Then
        $bRv = 1
    Else
        $bRv = 0
    EndIf
    Return $bRv
EndFunc
Edited by b0x

Share this post


Link to post
Share on other sites
BALA

A HotKey might be easier to use in this situation rather than _IsPressed.

HotKeySet("{F1}", "On")
 Func On()
    ;Put what you want to do here
EndFunc

EDIT: Sorry thought pressed was _IsPressed :">

Here's the HexKeys:

70----------F1 key

71----------F2 key

72----------F3 key

73----------F4 key

74----------F5 key

75----------F6 key

76----------F7 key

77----------F8 key

78----------F9 key

79----------F10 key

7A----------F11 key

7B----------F12 key

Edited by BALA

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

Share this post


Link to post
Share on other sites
b0x

BTW; why does it exit if i click the save button?

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
Global $settings = FileOpen( "settings.ini", 2)
Global $user32 = DllOpen("user32"), $log
GLobal $save

$Form1_1_1 = GUICreate("Tabbed Notebook Dialog", 419, 383, 315, 249)
GUISetIcon("D:05.ico")
$Sounds = GUICtrlCreateTab(8, 16, 396, 328)
$TabSheet1 = GUICtrlCreateTabItem("Paths")
$In4 = GUICtrlCreateInput("sounds\", 48, 120, 265, 21)
$In3 = GUICtrlCreateInput("sounds\", 48, 96, 265, 21)
$In2 = GUICtrlCreateInput("sounds\", 48, 72, 265, 21)
$In5 = GUICtrlCreateInput("sounds\", 48, 144, 265, 21)
$Path1 = GUICtrlCreateButton("woot?", 318, 50, 57, 20, 0)
$Path2 = GUICtrlCreateButton("woot?", 318, 74, 57, 20, 0)
$Path3 = GUICtrlCreateButton("woot?", 318, 98, 57, 21, 0)
$Path4 = GUICtrlCreateButton("woot?", 318, 122, 57, 20, 0)
$Path5 = GUICtrlCreateButton("woot?", 318, 146, 57, 20, 0)
$In1 = GUICtrlCreateInput("sounds\", 48, 50, 265, 21)
$F2 = GUICtrlCreateLabel("F2", 20, 76, 16, 17)
$F1 = GUICtrlCreateLabel("F1", 20, 52, 16, 17)
$F3 = GUICtrlCreateLabel("F3", 20, 99, 16, 17)
$F4 = GUICtrlCreateLabel("F4", 20, 123, 16, 17)
$F5 = GUICtrlCreateLabel("F5", 20, 147, 16, 17)
$F7 = GUICtrlCreateLabel("F7", 20, 195, 16, 17)
$F6 = GUICtrlCreateLabel("F6", 20, 172, 16, 17)
$F8 = GUICtrlCreateLabel("F8", 20, 219, 16, 17)
$In6 = GUICtrlCreateInput("sounds\", 48, 168, 265, 21)
$In7 = GUICtrlCreateInput("sounds\", 48, 192, 265, 21)
$In8 = GUICtrlCreateInput("sounds\", 48, 216, 265, 21)
$Path6 = GUICtrlCreateButton("woot?", 319, 170, 57, 20, 0)
$Path7 = GUICtrlCreateButton("woot?", 319, 194, 57, 20, 0)
$Path8 = GUICtrlCreateButton("woot?", 319, 218, 57, 20, 0)
$F9 = GUICtrlCreateLabel("F9", 20, 242, 16, 17)
$In9 = GUICtrlCreateInput("sounds\", 48, 240, 265, 21)
$Path9 = GUICtrlCreateButton("woot?", 320, 242, 57, 20, 0)
$In12 = GUICtrlCreateInput("sounds\", 48, 310, 265, 21)
$In11 = GUICtrlCreateInput("sounds\", 48, 286, 265, 21)
$In10 = GUICtrlCreateInput("sounds\", 48, 262, 265, 21)
$Path10 = GUICtrlCreateButton("woot?", 320, 264, 57, 20, 0)
$Path11 = GUICtrlCreateButton("woot?", 320, 288, 57, 21, 0)
$Path12 = GUICtrlCreateButton("woot?", 320, 312, 57, 20, 0)
$F11 = GUICtrlCreateLabel("F11", 20, 288, 22, 17)
$F10 = GUICtrlCreateLabel("F10", 20, 265, 22, 17)
$F12 = GUICtrlCreateLabel("F12", 20, 311, 22, 17)
GUICtrlCreateTabItem("")
$go = GUICtrlCreateButton("&save 'n go", 150, 352, 75, 25, 0)
GUICtrlSetOnEvent($go, "save")
$help = GUICtrlCreateButton("&Help", 328, 352, 75, 25, 0)
GUICtrlSetOnEvent($help, "help")
$cancel = GUICtrlCreateButton("&cancel", 238, 352, 75, 25, 0)
GUICtrlSetOnEvent($cancel, "terminate")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
WEnd



Func save()
    FileWriteLine($settings, GUICtrlRead($In1))
    FileWriteLine($settings, GUICtrlRead($In2))
    FileWriteLine($settings, GUICtrlRead($In3))
    FileWriteLine($settings, GUICtrlRead($In4))
    FileWriteLine($settings, GUICtrlRead($In5))
    FileWriteLine($settings, GUICtrlRead($In6))
    FileWriteLine($settings, GUICtrlRead($In7))
    FileWriteLine($settings, GUICtrlRead($In8))
    FileWriteLine($settings, GUICtrlRead($In9))
    FileWriteLine($settings, GUICtrlRead($In10))
    FileWriteLine($settings, GUICtrlRead($In11))
    FileWriteLine($settings, GUICtrlRead($In12))
    EndFunc

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  

×