SteveO Posted November 28, 2007 Share Posted November 28, 2007 Okay, all this program does is repetitively press 8 when the hotkey F1 is pressed, and it stops when F2 is pressed. Now what I want to do is change the message in the GUI from Idle... to Standing Up... and also change the color of the message when F1 or F2 is pressed. But for some reason, the GUICtrlSetData and GUICtrlSetColor do not want to work. expandcollapse popup#include <GUIConstants.au3> ;HotKey Settings HotKeySet("{F1}", "Revive") ;Starts Revival Function HotKeySet("{F2}", "EndRevive") ;Ends Revival Function ;Variable Sets $Rev = 0 $message = "IDLE..." $Form1 = GUICreate("STAND UP!", 248, 80, 211, 376) $Group1 = GUICtrlCreateGroup("Status", 8, 32, 145, 41) $Label1 = GUICtrlCreateLabel("IDLE...", 16, 48, 127, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label2 = GUICtrlCreateLabel("STAND UP v1.0", 8, 8, 96, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000080) $Label3 = GUICtrlCreateLabel("F1 : STAND UP!", 160, 40, 83, 17) GUICtrlSetColor(-1, 0x008000) $Label4 = GUICtrlCreateLabel("F2 : Stop", 160, 56, 47, 17) GUICtrlSetColor(-1, 0xFF0000) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;Revive Function - Starts Pressing 8 Func Revive($Rev) $Rev = 1 GUICtrlSetData($Label1, "STANDING UP...") GUICtrlSetColor($Label1, 0x008000) While $Rev == 1 Send(8) WEnd EndFunc ;EndRevival Function - Sets $Rev variable to 0 so 8 will stop being pressed Func EndRevive($Rev) $Rev = 0 GUICtrlSetData($Label1, "IDLE...") GUICtrlSetColor($Label1,0xFF0000) EndFunc Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 28, 2007 Share Posted November 28, 2007 (edited) Problems were You were calling the function with a variable but you shouldn't have been also You used While $Rev == 1 , this isn't C++ should be While $Rev = 1 expandcollapse popup#include <GUIConstants.au3> ;HotKey Settings HotKeySet("{F1}", "Revive") ;Starts Revival Function HotKeySet("{F2}", "EndRevive") ;Ends Revival Function ;Variable Sets Global $Rev = 0 $message = "IDLE..." $Form1 = GUICreate("STAND UP!", 248, 80, 211, 376) $Group1 = GUICtrlCreateGroup("Status", 8, 32, 145, 41) $Label1 = GUICtrlCreateLabel("IDLE...", 16, 48, 127, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label2 = GUICtrlCreateLabel("STAND UP v1.0", 8, 8, 96, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000080) $Label3 = GUICtrlCreateLabel("F1 : STAND UP!", 160, 40, 83, 17) GUICtrlSetColor(-1, 0x008000) $Label4 = GUICtrlCreateLabel("F2 : Stop", 160, 56, 47, 17) GUICtrlSetColor(-1, 0xFF0000) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;Revive Function - Starts Pressing 8 Func Revive() $Rev = 1 GUICtrlSetData($Label1, "STANDING UP...") GUICtrlSetColor($Label1, 0x008000) While $Rev = 1 Send(8) WEnd EndFunc ;EndRevival Function - Sets $Rev variable to 0 so 8 will stop being pressed Func EndRevive() $Rev = 0 GUICtrlSetData($Label1, "IDLE...") GUICtrlSetColor($Label1,0xFF0000) EndFunc Edited November 28, 2007 by Thatsgreat2345 Link to comment Share on other sites More sharing options...
SteveO Posted November 28, 2007 Author Share Posted November 28, 2007 Mmmm. Still doesn't work. It still wont change when I press F1 or F2. Link to comment Share on other sites More sharing options...
Generator Posted November 28, 2007 Share Posted November 28, 2007 Mmmm. Still doesn't work. It still wont change when I press F1 or F2.It works for me, what are you talking about. Link to comment Share on other sites More sharing options...
SteveO Posted November 28, 2007 Author Share Posted November 28, 2007 It works for me, what are you talking about. The Status on the GUI Changes from "IDLE..." to "STANDING UP..." when you press F1 and F2? Link to comment Share on other sites More sharing options...
SteveO Posted November 28, 2007 Author Share Posted November 28, 2007 (edited) Damnit my PC sucks. I just sent the script to my buddy and it works for him. But for some reason it doesn't work for me. Thanks for the help. Edited November 28, 2007 by SteveO Link to comment Share on other sites More sharing options...
Generator Posted November 28, 2007 Share Posted November 28, 2007 The Status on the GUI Changes from "IDLE..." to "STANDING UP..." when you press F1 and F2?Yes and the color changes as it should. If you want I can take a video and upload it..but it will take some time/work 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