mr-es335 Posted Sunday at 03:32 AM Posted Sunday at 03:32 AM (edited) Good day, I have been employing HotKeySet scripts, and am wondering if it is all possible to have a script that creates a button|label|menu option that performs the following: 1) The button|label|menu option initially states "Enable HotKey" 2) A message is then displayed that states "HotKey enabled". 3) Upon selection of the button|label|menu option, the button|label|menu option then states "Disable HotKey". 3) Upon selection of the the button|label|menu option, the HotKey is then exited. Any assistance in this matter would be greatly appreciated! Edited Sunday at 03:32 AM by mr-es335 mr-es335 Sentinel Music Studios
Dan_555 Posted Sunday at 10:40 AM Posted Sunday at 10:40 AM expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 370, 128, 192, 114) $Button1 = GUICtrlCreateButton("Enable Hotkey", 121, 37, 113, 40) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $HotkeKeyState=0, $HotkeKeyStateNotification=0, $HotkeKeyTimer=-1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If $HotkeKeyState=0 Then $HotkeKeyStateNotification=1 $HotkeKeyTimer=TimerInit() $HotkeKeyState=1 GUICtrlSetData ($Button1,"Disable Hotkey") Else Exit EndIf EndSwitch If $HotkeKeyStateNotification=1 Then IF TimerDiff($HotkeKeyTimer)<=5000 Then $MP=MouseGetPos() ToolTip ("Hotkey is enabled",$MP[0]-30,$mp[1]-50) Else $HotkeKeyStateNotification=0 ToolTip("") EndIf EndIf WEnd mr-es335 1 Some of my script sourcecode
mr-es335 Posted 12 hours ago Author Posted 12 hours ago Dan_555 Thanks...however, is it possible to have the While statement and If statement in two separate functions? Any attempts that I have made have failed. mr-es335 Sentinel Music Studios
Dan_555 Posted 4 hours ago Posted 4 hours ago (edited) expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $HotkeKeyState = 0, $HotkeKeyStateNotification = 0, $HotkeKeyTimer = -1 Gui() Func Gui() $Form1 = GUICreate("Form1", 370, 128, 192, 114) $Button1 = GUICtrlCreateButton("Enable Hotkey", 121, 37, 113, 40) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete ($Form1) Exit Case $Button1 If $HotkeKeyState = 0 Then $HotkeKeyStateNotification = 1 $HotkeKeyTimer = TimerInit() $HotkeKeyState = 1 GUICtrlSetData($Button1, "Disable Hotkey") Else Exit EndIf EndSwitch Notify() WEnd EndFunc ;==>Gui Func Notify() If $HotkeKeyStateNotification = 1 Then If TimerDiff($HotkeKeyTimer) <= 5000 Then $MP = MouseGetPos() ToolTip("Hotkey is enabled", $MP[0] - 30, $MP[1] - 50) Else $HotkeKeyStateNotification = 0 ToolTip("") EndIf EndIf EndFunc ;==>Notify Edited 3 hours ago by Dan_555 Some of my script sourcecode
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now