Minikori Posted August 11, 2008 Share Posted August 11, 2008 (edited) Hey all, I'd like a label to automatically change depending on what a slider is at, so far I've got this, but the labels flashing. CODE#include <GUIConstantsEx.au3> $TimeSet = .5 $Main = GUICreate("Keep Awake", 200, 130) $Start = GUICtrlCreateButton("Start", 26, 90, 60, 30) $Cancel = GUICtrlCreateButton("Cancel", 113, 90, 60, 30) $Time = GUICtrlCreateSlider(26, 40, 150, 40) $TimeLab = GUICtrlCreateLabel($TimeSet & " minutes", 72, 10) GUICtrlSetLimit($Time, 10, .5) GUISetState() While 1 $msg = GUIGetMsg() $TimeSet = GUICtrlRead($Time) GUICtrlSetData($TimeLab, $TimeSet & " minutes") If $msg = $GUI_EVENT_CLOSE Or $msg = $Cancel Then ExitLoop EndIf WEnd Exit Edited August 12, 2008 by Minikori For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
davecollinsnz Posted August 12, 2008 Share Posted August 12, 2008 #include <GUIConstantsEx.au3> $TimeSet = .5 $Main = GUICreate("Keep Awake", 200, 130) $Start = GUICtrlCreateButton("Start", 26, 90, 60, 30) $Cancel = GUICtrlCreateButton("Cancel", 113, 90, 60, 30) $Time = GUICtrlCreateSlider(26, 40, 150, 40) $TimeLab = GUICtrlCreateLabel($TimeSet & " minutes", 72, 10) GUICtrlSetLimit($Time, 10, .5) GUISetState() $TimeSetMem="" While 1 $msg = GUIGetMsg() $TimeSet = GUICtrlRead($Time) if $TimeSet<>$TimeSetMem then;only update label if the value has changed GUICtrlSetData($TimeLab, $TimeSet & " minutes") $TimeSetMem=$TimeSet Endif If $msg = $GUI_EVENT_CLOSE Or $msg = $Cancel Then ExitLoop EndIf WEnd Exit That should do it. Trust me to make SkyNet with AutoIt... Link to comment Share on other sites More sharing options...
Minikori Posted August 12, 2008 Author Share Posted August 12, 2008 Thanks, now I have another question, here's my code, but how do I make the slider not grey? CODE#include <GUIConstantsEx.au3> $TimeSet = 0 GUISetFont(9, 300) $Main = GUICreate("Keep Awake", 200, 140) GUICtrlCreateTab(0, 0, 202, 142) $MainTab = GUICtrlCreateTabItem("Main") $Start = GUICtrlCreateButton("Start", 26, 100, 60, 30) $Cancel = GUICtrlCreateButton("Cancel", 113, 100, 60, 30) $Time = GUICtrlCreateSlider(26, 50, 150, 40) $TimeLab = GUICtrlCreateLabel($TimeSet & " minutes", 72, 30) GUICtrlSetLimit($Time, 10, 1) $CustomizeTab = GUICtrlCreateTabItem("Customize") GUISetState() $TimeSetMem = "" While 1 $msg = GUIGetMsg() $TimeSet = GUICtrlRead($Time) If $msg = $GUI_EVENT_CLOSE Or $msg = $Cancel Then ExitLoop EndIf If $msg = $Start Then Call("Go") EndIf If $TimeSet<>$TimeSetMem Then GUICtrlSetData($TimeLab, $TimeSet & " minutes") $TimeSetMem=$TimeSet EndIf WEnd Exit ;------------------Functions------------------; Func Go() $TimeSet = GUICtrlRead($Time) MsgBox(0, "Started", "The mouse will now move 1 pixel to the left every " & $TimeSet & " minutes. Press Ctrl+Shift+E to exit.") GUIDelete($Main) HotKeySet("^+e", "Quit") $SleepTime = $TimeSet * 60000 Sleep($SleepTime) $MousePos = MouseGetPos() MouseMove($MousePos[0] - 1, $MousePos[1]) EndFunc While 1 Sleep(100) WEnd Func Quit() Exit EndFunc For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com 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