Sign in to follow this  
Followers 0
Generator

Set Hotkey

3 posts in this topic

Hi everyone, i want a user can be able to customize hotkey in the application, so i added this func in.

This is a testing version, but any idea why Hex is always A5?

#include<misc.au3>
#include<GUIConstants.au3>
Opt("GUIOnEventMode",1)
Global $Reciving, $Hex
$gui=GUICreate("Test",100,67,-1,-1)
$button0=GUICtrlCreateButton("Set Hotkey",1,1,97,30)
$button1=GUICtrlCreateButton("Display",1,35,97,30)

GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
GUICtrlSetOnEvent($button0,"_SetHotkey")
GUICtrLSetOnEvent($button1,"_Display")
GUISetState()

While 1
    Sleep(100)
WEnd

Func _SetHotkey()
    $Reciving=True
    GUICtrLSetState($button0,$GUI_DISABLE)
    GUICtrLSetState($button1,$GUI_DISABLE)
    Do
    For $i=8 To 165
        $Hex=Hex($i)
        If _IsPressed($Hex) Then
            $Reciving=False
        EndIf
    Next
    Until $Reciving=False
    GUICtrLSetState($button0,$GUI_ENABLE)
    GUICtrLSetState($button1,$GUI_ENABLE)
EndFunc
Func _Display()
    Msgbox(0,"",$Hex)
EndFunc
Func _Exit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites



#include<misc.au3>
#include<GUIConstants.au3>
Opt("GUIOnEventMode",1)
Global $Reciving, $Hex
$gui=GUICreate("Test",100,67,-1,-1)
$button0=GUICtrlCreateButton("Set Hotkey",1,1,97,30)
$button1=GUICtrlCreateButton("Display",1,35,97,30)

GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
GUICtrlSetOnEvent($button0,"_SetHotkey")
GUICtrLSetOnEvent($button1,"_Display")
GUISetState()

While 1
    Sleep(100)
WEnd

Func _SetHotkey()
    $Reciving=True
    GUICtrLSetState($button0,$GUI_DISABLE)
    GUICtrLSetState($button1,$GUI_DISABLE)
    Do
    For $i=8 To 165
        If _IsPressed(Hex($i,2)) Then
             $Hex=Hex($i,2)
            $Reciving=False
        EndIf
    Next
    Until $Reciving=False
    GUICtrLSetState($button0,$GUI_ENABLE)
    GUICtrLSetState($button1,$GUI_ENABLE)
EndFunc
Func _Display()
    Msgbox(0,"",$Hex)
EndFunc
Func _Exit()
    Exit
EndFunc


www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites

#include<misc.au3>
#include<GUIConstants.au3>
Opt("GUIOnEventMode",1)
Global $Reciving, $Hex
$gui=GUICreate("Test",100,67,-1,-1)
$button0=GUICtrlCreateButton("Set Hotkey",1,1,97,30)
$button1=GUICtrlCreateButton("Display",1,35,97,30)

GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
GUICtrlSetOnEvent($button0,"_SetHotkey")
GUICtrLSetOnEvent($button1,"_Display")
GUISetState()

While 1
    Sleep(100)
WEnd

Func _SetHotkey()
    $Reciving=True
    GUICtrLSetState($button0,$GUI_DISABLE)
    GUICtrLSetState($button1,$GUI_DISABLE)
    Do
    For $i=8 To 165
        If _IsPressed(Hex($i,2)) Then
             $Hex=Hex($i,2)
            $Reciving=False
        EndIf
    Next
    Until $Reciving=False
    GUICtrLSetState($button0,$GUI_ENABLE)
    GUICtrLSetState($button1,$GUI_ENABLE)
EndFunc
Func _Display()
    Msgbox(0,"",$Hex)
EndFunc
Func _Exit()
    Exit
EndFunc
Omg you are amazing, thanks for the help Toady. :DDD

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