Jump to content
Sign in to follow this  
draygen

Update Slider From Entered Input Value

Recommended Posts

draygen

Hi everyone, this is my first post .. Nice to meet you all.

I am working on a script to automate certain tasks at work, since my company won't write a GUI I decided to try myself with Autoit.

What I'm trying to do, is get the Slider Bar to move to the set value of the Input box - Since I'm making a Slider with limits of 0 - 900 , I will have to sometimes enter in an exact value.

I cannot seem to get the GUI to update the position of the slider when a value is entered into the input box.

I'm still a newbie to this but am learning fast - sorry if this is a dumb question.

Here's what I have so far:

#include <GuiConstants.au3>

GuiCreate("Time Lapse Config", 376, 395,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$temp = 0
$Label_1 = GuiCtrlCreateLabel("Time Lapse Configuration", 110, 20, 150, 20)
$Slider_2 = GuiCtrlCreateSlider(90, 100, 200, 40)
$Label_3 = GuiCtrlCreateLabel("Seconds between frame capture", 110, 70, 160, 20)
$Checkbox_4 = GuiCtrlCreateCheckbox("Camera 1", 90, 150, 80, 20)
$Checkbox_5 = GuiCtrlCreateCheckbox("Camera 2", 90, 170, 70, 20)
$Checkbox_6 = GuiCtrlCreateCheckbox("Camera 3", 90, 190, 80, 20)
$Checkbox_7 = GuiCtrlCreateCheckbox("Camera 4", 90, 210, 70, 20)
$Checkbox_8 = GuiCtrlCreateCheckbox("Camera 9", 190, 150, 90, 20)
$Checkbox_9 = GuiCtrlCreateCheckbox("Camera 11", 190, 190, 90, 20)
$Checkbox_10 = GuiCtrlCreateCheckbox("Camera 10", 190, 170, 80, 20)
$Checkbox_11 = GuiCtrlCreateCheckbox("Camera 12", 190, 210, 70, 20)
$Checkbox_12 = GuiCtrlCreateCheckbox("Camera 13", 190, 230, 80, 20)
$Checkbox_13 = GuiCtrlCreateCheckbox("Camera 5", 90, 230, 80, 20)
$Checkbox_14 = GuiCtrlCreateCheckbox("Camera 8", 90, 290, 70, 20)
$Checkbox_15 = GuiCtrlCreateCheckbox("Camera 6", 90, 250, 80, 20)
$Checkbox_16 = GuiCtrlCreateCheckbox("Camera 7", 90, 270, 80, 20)
$Checkbox_17 = GuiCtrlCreateCheckbox("Camera 14", 190, 250, 70, 20)
$Checkbox_18 = GuiCtrlCreateCheckbox("Camera 15", 190, 270, 80, 20)
$Checkbox_19 = GuiCtrlCreateCheckbox("Camera 16", 190, 290, 90, 20)
$Label_20 = GuiCtrlCreateInput($temp, 300, 110, 30, 20)
$Apply = GuiCtrlCreateButton("Apply", 165, 345)
GUICtrlSetLimit(4,900,0)


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $Apply = Apply()
        
        Case Else
            If $temp <> GUICtrlRead($Slider_2) Then
                $temp = GUICtrlRead($Slider_2)
                GUICtrlSetData($Label_20, $temp)
            EndIf
            
                EndSelect
WEnd

Func Apply()
    GUICtrlRead($temp)
    IniWrite("C:\program files\NA\NA\test.ini", "Settings", "Info", $temp)
        EndFunc
Edited by draygen

Share this post


Link to post
Share on other sites
Valuater

maybe

#include <GuiConstants.au3>

GUICreate("Time Lapse Config", 376, 395, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$temp = 0
$Label_1 = GUICtrlCreateLabel("Time Lapse Configuration", 110, 20, 150, 20)
$Slider_2 = GUICtrlCreateSlider(90, 100, 200, 40)
$Label_3 = GUICtrlCreateLabel("Seconds between frame capture", 110, 70, 160, 20)
$Checkbox_4 = GUICtrlCreateCheckbox("Camera 1", 90, 150, 80, 20)
$Checkbox_5 = GUICtrlCreateCheckbox("Camera 2", 90, 170, 70, 20)
$Checkbox_6 = GUICtrlCreateCheckbox("Camera 3", 90, 190, 80, 20)
$Checkbox_7 = GUICtrlCreateCheckbox("Camera 4", 90, 210, 70, 20)
$Checkbox_8 = GUICtrlCreateCheckbox("Camera 9", 190, 150, 90, 20)
$Checkbox_9 = GUICtrlCreateCheckbox("Camera 11", 190, 190, 90, 20)
$Checkbox_10 = GUICtrlCreateCheckbox("Camera 10", 190, 170, 80, 20)
$Checkbox_11 = GUICtrlCreateCheckbox("Camera 12", 190, 210, 70, 20)
$Checkbox_12 = GUICtrlCreateCheckbox("Camera 13", 190, 230, 80, 20)
$Checkbox_13 = GUICtrlCreateCheckbox("Camera 5", 90, 230, 80, 20)
$Checkbox_14 = GUICtrlCreateCheckbox("Camera 8", 90, 290, 70, 20)
$Checkbox_15 = GUICtrlCreateCheckbox("Camera 6", 90, 250, 80, 20)
$Checkbox_16 = GUICtrlCreateCheckbox("Camera 7", 90, 270, 80, 20)
$Checkbox_17 = GUICtrlCreateCheckbox("Camera 14", 190, 250, 70, 20)
$Checkbox_18 = GUICtrlCreateCheckbox("Camera 15", 190, 270, 80, 20)
$Checkbox_19 = GUICtrlCreateCheckbox("Camera 16", 190, 290, 90, 20)
$Label_20 = GUICtrlCreateInput($temp, 300, 110, 30, 20)
$Apply = GUICtrlCreateButton("Apply", 165, 345)
GUICtrlSetLimit(4, 900, 0)


GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Apply 
            Apply()
            
        Case Else
            If $temp <> GUICtrlRead($Slider_2) Then
                $temp = GUICtrlRead($Slider_2)
                GUICtrlSetData($Label_20, $temp)
            EndIf
            
    EndSelect
WEnd

Func Apply()
    $set_temp = GUICtrlRead($Label_20)
    GUICtrlSetData($Slider_2, $set_temp)
;GUICtrlRead($temp)
;IniWrite("C:\program files\NA\NA\test.ini", "Settings", "Info", $temp)
EndFunc  ;==>Apply

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
draygen

Doh, that was a stupid mistake.. Thanks..

In the end I decided to toss the slider and just use an input box, since it was a pain to get the exact values with a slider.

I finished it though! :) Now I won't be telling customers how to edit 20 key values in an .INI file over the phone... yay... :(

Edited by draygen

Share this post


Link to post
Share on other sites
Valuater

1

Your welcome

2

not bad for a first post, not bad at all!

3

I also noted you took the exams on Welcome to Autopit 1-2-3

that shows effort... all of us whom "help" appreciate effort

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.