Probleme about Hotkey

09/03/2013 08:57 Xavierbot#1
Hi,

It's my program :

Quote:
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.8.1
Author: myName

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Aegis = GUICreate("Aegis", 205, 165, 597, 270)
$InputShield = GUICtrlCreateInput("1 To 10", 104, 24, 81, 24)
$InputHP = GUICtrlCreateInput("1 To 10", 104, 56, 81, 24)
$InputLife = GUICtrlCreateInput("1 To 10", 104, 88, 81, 24)
$Save = GUICtrlCreateButton("Save", 72, 120, 75, 25)
$Shield = GUICtrlCreateLabel("Shield", 16, 24, 42, 20)
$HP = GUICtrlCreateLabel("HP ( beacon )", 16, 56, 86, 20)
$Life = GUICtrlCreateLabel("Life", 16, 96, 25, 20)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Save
$AegisShield = GUICtrlRead($InputShield)
$AegisHP = GUICtrlRead($InputHP)
$AegisLife = GUICtrlRead($InputLife)
GUIDelete("Aegis")

EndSwitch
WEnd

Global $Send
HotKeySet("s","Go")
HotKeySet("{ESC}","Exit2")
HotKeySet ("p", "Pause")

While 1
Sleep(100)
WEnd


Func Pause()
$Send = Not $Send
While $Send
Sleep(100)
WEnd
EndFunc


Func Go()
While 1
Send($AegisShield)
Send($AegisHP)
Send($AegisLife)
Sleep(30000)
WEnd
EndFunc

Func Exit2()
Exit 0
EndFunc
But, when i press any hotkeys....nothing :(
Why :confused: Please help me.

Thanks.
09/03/2013 10:25 Croco™#2
Try it with #RequireAdmin.
09/03/2013 12:29 lolkop#3
Quote:
Originally Posted by Xavierbot View Post
the only way out of that loop, to reach the hotkey declaration, would be the exit function, which immediately closes your script...

this means that the hotkeys never get set...
09/03/2013 12:33 c0w#4
yep you need to declare your hotkeys before you enter any loop. because the code will never reach the point of declaration
09/03/2013 16:19 alpines#5
Always put your HotKeySet declarations on the top of the script if needed and put { } around s and p.