sandin Posted May 22, 2008 Share Posted May 22, 2008 I have this simple script: #include <GUIConstants.au3> HotKeySet("{NUMPAD1}", "_OK_label") HotKeySet("{NUMPAD0}", "_NOT_OK_label") $Form1 = GUICreate("Form1", 150, 100, 193, 125) $Label1 = GUICtrlCreateLabel("Press Num1", 24, 24, 100, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func _OK_label() GUICtrlSetData($Label1, "OK!") EndFunc func _NOT_OK_label() GUICtrlSetData($Label1, "not ok...") EndFunc when I compile it, and start the exe file twice, only one will work and the other won't. Even if I close the working one, the other still won't work, why's that? Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
Monamo Posted May 22, 2008 Share Posted May 22, 2008 I have this simple script:#include <GUIConstants.au3> HotKeySet("{NUMPAD1}", "_OK_label") HotKeySet("{NUMPAD0}", "_NOT_OK_label") $Form1 = GUICreate("Form1", 150, 100, 193, 125) $Label1 = GUICtrlCreateLabel("Press Num1", 24, 24, 100, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func _OK_label() GUICtrlSetData($Label1, "OK!") EndFunc func _NOT_OK_label() GUICtrlSetData($Label1, "not ok...") EndFuncwhen I compile it, and start the exe file twice, only one will work and the other won't. Even if I close the working one, the other still won't work, why's that?Give this a shot - It will set enable the hotkeys only for the "active" window:CODE#include <GUIConstants.au3>$Form1 = GUICreate("Form1", 150, 100, 193, 125)$Label1 = GUICtrlCreateLabel("Press Num1", 24, 24, 100, 17)Dim $iHotKeysActive = 0GUISetState(@SW_SHOW)While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch _SetHotKeys()WEndFunc _OK_label() GUICtrlSetData($Label1, "OK!")EndFuncFunc _NOT_OK_label() GUICtrlSetData($Label1, "not ok...")EndFuncFunc _SetHotKeys() If WinActive($Form1) Then If Not $iHotKeysActive Then HotKeySet("{NUMPAD1}", "_OK_label") HotKeySet("{NUMPAD0}", "_NOT_OK_label") $iHotKeysActive = 1 EndIf Else If $iHotKeysActive Then HotKeySet("{NUMPAD1}") HotKeySet("{NUMPAD0}") $iHotKeysActive = 0 EndIf EndIfEndFunc - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
sandin Posted May 22, 2008 Author Share Posted May 22, 2008 tnx it fixed the 2nd problem, but my first still remains, I want both scripts to act on Num1, not only 1 script ;/ It's possible with different hotkeys, but is it possible with the same hotkey in both scripts? Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
someone Posted May 22, 2008 Share Posted May 22, 2008 (edited) Just use _IsPressed() #include <GUIConstants.au3> #Include <Misc.au3> ;~ HotKeySet("{NUMPAD1}", "_OK_label") ;~ HotKeySet("{NUMPAD0}", "_NOT_OK_label") $Form1 = GUICreate("Form1", 150, 100, 193, 125) $Label1 = GUICtrlCreateLabel("Press Num1", 24, 24, 100, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If _IsPressed(61) Then _OK_label() If _IsPressed(60) Then _NOT_OK_label() WEnd func _OK_label() GUICtrlSetData($Label1, "OK!") EndFunc func _NOT_OK_label() GUICtrlSetData($Label1, "not ok...") EndFunc Whoops forgot the #Include <Misc.au3> Edited May 22, 2008 by someone While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
sandin Posted May 22, 2008 Author Share Posted May 22, 2008 tnx!!! it worked ^^ Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
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