LondonNDIB Posted September 23, 2009 Posted September 23, 2009 I'm probably asking too much here. I'm looking for a quick and simple solution and not something polished that's going to take me too long to learn and/or implement. I want to graphically represent values between X and Y so I can see them as I change. The kicker here is X might be a negative number. I wanted to use ProgressOn but of course that is limited to integers between 0 and 100. Ideally I'd love to be able to have a panel of "guages" or dials that I can directly send the values to through my script. I figured I'd ask here in case someone had a good (AND SIMPLE) idea! Thanks
PsaltyDS Posted September 24, 2009 Posted September 24, 2009 I'm probably asking too much here. I'm looking for a quick and simple solution and not something polished that's going to take me too long to learn and/or implement. I want to graphically represent values between X and Y so I can see them as I change. The kicker here is X might be a negative number. I wanted to use ProgressOn but of course that is limited to integers between 0 and 100. Ideally I'd love to be able to have a panel of "guages" or dials that I can directly send the values to through my script. I figured I'd ask here in case someone had a good (AND SIMPLE) idea! Thanks Just because the value IN the progress bar is an integer between 0 and 100, doesn't mean you have to LABEL it that way. Just do the math to label as required. Try this with some negative numbers: expandcollapse popup#include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> Global $hGUI, $Input1, $Input2, $Button1, $iMin, $iMax, $iIncrement Global $Progress1, $Prog1_First, $Prog1_X, $Prog1_Last Global $Progress2, $Prog2_First, $Prog2_Y, $Prog2_Last $hGUI = GUICreate("Test", 400, 450) GUICtrlCreateLabel("Min Value:", 10, 10, 75, 20) $Input1 = GUICtrlCreateInput(0, 95, 10, 50, 20) GUICtrlCreateLabel("Max Value:", 155, 10, 75, 20) $Input2 = GUICtrlCreateInput(100, 240, 10, 50, 20) $Progress1 = GUICtrlCreateProgress(75, 70, 250, 40, BitOr($GUI_SS_DEFAULT_PROGRESS, $PBS_SMOOTH)) $Prog1_First = GUICtrlCreateLabel(0, 75, 55, 50, 15) $Prog1_X = GUICtrlCreateLabel("X = 0", 150, 55, 100, 15, $SS_CENTER) $Prog1_Last = GUICtrlCreateLabel(100, 275, 55, 50, 15, $SS_RIGHT) $Progress2 = GUICtrlCreateProgress(180, 150, 40, 250, BitOr($GUI_SS_DEFAULT_PROGRESS, $PBS_SMOOTH, $PBS_VERTICAL)) $Prog2_First = GUICtrlCreateLabel(0, 125, 380, 50, 20, $SS_RIGHT) $Prog2_Y = GUICtrlCreateLabel("Y = 100", 75, 265, 100, 20, $SS_RIGHT) $Prog2_Last = GUICtrlCreateLabel(100, 125, 150, 50, 20, $SS_RIGHT) $Button1 = GUICtrlCreateButton("RUN", 150, 410, 100, 30) _InitProgress() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button1 _InitProgress() For $n = 0 To 100 Sleep(100) GUICtrlSetData($Prog1_X, "X = " & ($iMin + ($n * $iIncrement))) GUICtrlSetData($Progress1, $n) GUICtrlSetData($Prog2_Y, "Y = " & ($iMax - ($n * $iIncrement))) GUICtrlSetData($Progress2, 100 - $n) Next EndSwitch WEnd Func _InitProgress() ; Reset progress bars GUICtrlSetData($Progress1, 0) GUICtrlSetData($Progress2, 100) ; Get Min/Max values $iMin = Number(GUICtrlRead($Input1)) $iMax = Number(GUICtrlRead($Input2)) If $iMax <= $iMin Then Return $iIncrement = Round(($iMax - $iMin) / 100) ; Set labels GUICtrlSetData($Prog1_First, $iMin) GUICtrlSetData($Prog1_X, "X = " & $iMin) GUICtrlSetData($Prog1_Last, $iMax) GUICtrlSetData($Prog2_First, $iMin) GUICtrlSetData($Prog2_Y, "Y = " & $iMax) GUICtrlSetData($Prog2_Last, $iMax) EndFunc ;==>_InitProgress Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Malkey Posted September 24, 2009 Posted September 24, 2009 I'm probably asking too much here. I'm looking for a quick and simple solution and not something polished that's going to take me too long to learn and/or implement. I want to graphically represent values between X and Y so I can see them as I change. The kicker here is X might be a negative number. I wanted to use ProgressOn but of course that is limited to integers between 0 and 100. Ideally I'd love to be able to have a panel of "guages" or dials that I can directly send the values to through my script. I figured I'd ask here in case someone had a good (AND SIMPLE) idea! Thanks The comment about ProgressOn isn't entirely true. If X = -2, and Y = 2, this example shows two ways to calculate the displayed 0.2 incremental, increasing values between X and Y. ; ProgressOn("Progress Meter", "Increments every second", "-2") For $i = 0 To 4 Step 0.2 ; 20 steps Sleep(1000) ProgressSet($i * 100 / 4, Round($i - 2, 4)) Next For $i = 0 To 100 Step 5 ; 20 steps Sleep(1000) ProgressSet($i, ($i / 25) - 2) Next ProgressSet(100, "2 Done", "Complete") Sleep(2000) ProgressOff() ;
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