GroovyMan8750

Slider & Report "Help!"

10 posts in this topic

I am attempting to use sliders to create a Q&A report that outputs a log/txt  file on a PC/Server...at least I got that to work.

I have the sliders set, however I cannot get the number range to show on the GUI correctly. Could use some guidance here.

When I output the value of each slider into a log file, the values are really goofed. Could use some more guidance here too.

Any help would be greatly appreciated. I am a noob, take pity. I have self abused already!

test1.au3

Share this post


Link to post
Share on other sites



 

Maybe something like this. 

#include <GUIConstantsEx.au3>

test()

Func test()
    Local $slider, $button, $label, $currentNum, $holdNum

    GUICreate("slider", 220, 300, 100, 200)
    $slider = GUICtrlCreateSlider(10, 10, 200, 20)
    GUICtrlSetLimit(-1, 10, 0);|Sets the min / Max
    $label = GUICtrlCreateLabel("" & $currentNum, 75, 100, 100, 20) ;|Label displays current slider num
    GUISetState()
    GUICtrlSetData($slider, 0) ;|Begin at 0

    While 1
        $currentNum = GUICtrlRead($slider);
        If $currentNum <> $holdNum Then
            GUICtrlSetData($label, $currentNum)
            $holdNum = $currentNum
        EndIf
    WEnd
EndFunc   ;==>test

 

Share this post


Link to post
Share on other sites

I just want test your script but PowerPoint.au3 is missing, So can you please add the downloadlink for PowerPoint.au3 in your first post?

Share this post


Link to post
Share on other sites

Remove the power point.Au3 from the include. 

 

Share this post


Link to post
Share on other sites
Func _OKbutton()

    $aTics = GUICtrlRead($cSlider)
    $aTics2 = GUICtrlRead($cSlider2)
    $aTics3 = GUICtrlRead($cSlider3)
    $aTics4 = GUICtrlRead($cSlider4)
    $aTics5 = GUICtrlRead($cSlider5)
    $aTics6 = GUICtrlRead($cSlider6)
    $aTics7 = GUICtrlRead($cSlider7)
    $aTics8 = GUICtrlRead($cSlider8)
    $aTics9 = GUICtrlRead($cSlider9)
    $aTics10 = GUICtrlRead($cSlider10)

    If $aTics = 0 Or $aTics2 = 0 Or $aTics3 = 0 Or $aTics4 = 0 Or $aTics5 = 0 Or $aTics6 = 0 Or $aTics7 = 0 Or $aTics8 = 0 Or $aTics9 = 0 Or $aTics10 = 0 Then
        MsgBox($MB_SYSTEMMODAL, "Question Error", "There can not be a zero value.")
    ElseIf $aTics > 0 Then
        $hFile = FileOpen('Answer.txt',1) ;1 =append 2=overwrite <============= change if needed
        MsgBox($MB_SYSTEMMODAL, "Question Answer Value", " Your Answers Have Been Submited!")
        FileWrite($hFile, @CRLF & GUICtrlRead($cSlider) & @CRLF & _GUICtrlSlider_GetNumTics($cSlider2) & @CRLF & _GUICtrlSlider_GetNumTics($cSlider3) & @CRLF & _GUICtrlSlider_GetNumTics($cSlider4) & @CRLF & _GUICtrlSlider_GetNumTics($cSlider5) & @CRLF & _GUICtrlSlider_GetNumTics($cSlider6) & @CRLF & _GUICtrlSlider_GetNumTics($cSlider7) & @CRLF & _GUICtrlSlider_GetNumTics($cSlider8) & @CRLF & _GUICtrlSlider_GetNumTics($cSlider9) & @CRLF & _GUICtrlSlider_GetNumTics($cSlider10) & @CRLF & @CRLF & "****" & @HOUR & ":" & @MIN & " " & @MON & "/" & @MDAY & " " & "****" & @CRLF & "_______________________________________________________________________")
        FileWrite($hFile, @CRLF & GUICtrlRead($aTics) & @CRLF & _GUICtrlSlider_GetNumTics($aTics2) & @CRLF & _GUICtrlSlider_GetNumTics($aTics3) & @CRLF & _GUICtrlSlider_GetNumTics($aTics4) & @CRLF & _GUICtrlSlider_GetNumTics($aTics5) & @CRLF & _GUICtrlSlider_GetNumTics($aTics6) & @CRLF & _GUICtrlSlider_GetNumTics($aTics7) & @CRLF & _GUICtrlSlider_GetNumTics($aTics8) & @CRLF & _GUICtrlSlider_GetNumTics($aTics9) & @CRLF & _GUICtrlSlider_GetNumTics($aTics10) & @CRLF & @CRLF & "****" & @HOUR & ":" & @MIN & " " & @MON & "/" & @MDAY & " " & "****" & @CRLF & "_______________________________________________________________________")
        FileClose($hFile)
    EndIf

EndFunc   ;==>_OKbutton

i think this works as you wan't.

And i want to have the link for PowerPoint.au3.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

What do you mean by goofed? Using GUICtrlRead on the slider should give the value selected.

Edited by InunoTaishou

Share this post


Link to post
Share on other sites

Will post  pp.au 3 in am...... @ home reviewing this on my kindel.

Share this post


Link to post
Share on other sites

The label should show the range "1 2 3 4 5 6 7 8 9 10" and align accordingly to the output file.

The extra input will not go unused. I just have to workout a realtime refresh...or close to it.

Share this post


Link to post
Share on other sites

Here is the PowerPoint.au3

It is a bit dated, but works for what I needed of it.

Can still be found on the autoit site.

 

Powerpoint.au3

Share this post


Link to post
Share on other sites

The location of the Next prevented the numbers from appearing under the sliders.

I have made several modifications that cleaned up a few issues, however I'm still having a problem with getting the slider numbers to translate into the log file.

Any additional ideas?

 

1test.au3

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

  • Similar Content

    • Elzie
      By Elzie
      Hi I am trying to make a gui that uses a slide to change pictures and uses internet-read from  guinness function.
      Thanks for your help.
      Ok found the issue
      #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <WinAPIRes.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 229, 165, 2392, 436) $Slider = GUICtrlCreateSlider(32, 128, 150, 29) GUICtrlSetLimit($Slider, 2, 1) GUICtrlSetData($Slider, 1) GUICtrlSetBkColor($Slider, 0x0099FF) GUICtrlSetColor(-1, 0xA6CAF0) $hSlider_Handle = GUICtrlGetHandle(-1) $sFile1 = _GetURLImage("http://www.pendriveapps.com/wp-content/uploads/autoit.jpg ", @TempDir) $sFile2 = _GetURLImage("http://domoticx.com/wp-content/uploads/autoit-logo-200x154.jpg ", @TempDir) $Hpic1 = GUICtrlCreatePic($sFile1, 56, 8, 108, 108, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Slider $a = GUICtrlRead($Slider) If $a = 2 Then GUICtrlDeleteImage($Hpic1) $Hpic2 = GUICtrlCreatePic($sFile2, 56, 8, 108, 108, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) ElseIf $a = 1 Then GUICtrlDeleteImage($hpic2) $Hpic1 = GUICtrlCreatePic($sFile1, 56, 8, 108, 108, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) EndIf EndSwitch WEnd Func _GetURLImage($sURL, $sDirectory = @ScriptDir) ; Author ........: guinness Local $hDownload, $sFile $sFile = StringRegExpReplace($sURL, "^.*/", "") If @error Then Return SetError(1, 0, $sFile) EndIf If StringRight($sDirectory, 1) <> "\" Then $sDirectory = $sDirectory & "\" EndIf $sDirectory = $sDirectory & $sFile If FileExists($sDirectory) Then Return $sDirectory EndIf $hDownload = InetGet($sURL, $sDirectory, 17, 1) While InetGetInfo($hDownload, 2) = 0 If InetGetInfo($hDownload, 4) <> 0 Then InetClose($hDownload) Return SetError(1, 0, $sDirectory) EndIf Sleep(105) WEnd InetClose($hDownload) Return $sDirectory EndFunc ;==>_GetURLImage Func GUICtrlDeleteImage($iCtrlID) ; Author ........: guinness Local Const $STM_SETIMAGE = 0x0172 Local $aSetImage = 0, _ $bReturn = True, _ $iMsg = 0 Switch _WinAPI_GetClassName($iCtrlID) Case 'Button' ; button, checkbox, groupbox, radiobutton. Local $aButton = [$IMAGE_BITMAP, $IMAGE_ICON] $aSetImage = $aButton $aButton = 0 Case 'Static' ; icon, label, picture. Local $aStatic = [$IMAGE_BITMAP, $IMAGE_CURSOR, $IMAGE_ICON] $aSetImage = $aStatic $aStatic = 0 $iMsg = $STM_SETIMAGE Case Else $bReturn = False EndSwitch If $bReturn Then $bReturn = False Local $hImage = 0 For $i = 0 To UBound($aSetImage) - 1 $hImage = GUICtrlSendMsg($iCtrlID, $iMsg, $aSetImage[$i], 0) If $hImage <> 0 Then Switch $aSetImage[$i] Case $IMAGE_BITMAP $bReturn = _WinAPI_DeleteObject($hImage) Case $IMAGE_CURSOR $bReturn = _WinAPI_DeleteObject($hImage) If Not $bReturn Then $bReturn = _WinAPI_DestroyCursor($hImage) > 0 EndIf Case $IMAGE_ICON $bReturn = _WinAPI_DeleteObject($hImage) If Not $bReturn Then $bReturn = _WinAPI_DestroyIcon($hImage) > 0 EndIf EndSwitch ExitLoop EndIf Next If Not $bReturn Then $bReturn = GUICtrlSetImage($iCtrlID, 'shell32.dll', -50) > 0 EndIf EndIf Return $bReturn EndFunc ;==>GUICtrlDeleteImage  
    • Grosminet
      By Grosminet
      I would like to use a WM_NOTIFY function to manage a slider thumb position change, according this MSN trackbar link TRBN_THUMBPOSCHANGING .
      Does somebody know why the notification code "TRBN_THUMBPOSCHANGING" for the slider control seems ignored in "WindowsConstants.au3" include file ?
      Searching in AutoIt or MSN forum , or googling this code, I don't succeed to catch any code info !!! Is it obsolete ?
      Thanks
      Alain.
    • Kanashius
      By Kanashius
      This UDF can be used to create a slider with an imagebackground and an image to move.
      If you like it, please leave me a comment, also if you have any suggestions to make it better or if you found bugs.
      Edit: Its now possible to set the value of the Slider (__GDIPlusSlider_set($Slider,$value))
       
      GDIPlusSliderUDF.zip
    • careca
      By careca
      Hi, found a post about something like this, but didn't quite get it.

      The problem here is that i have a slider, and when i click somewhere in the slider,
      the thingy starts jumping in the direction of the mouse press, but doesn't quite stay where im clicking.

      Then it seemed like using "_GUICtrlSlider_Create" instead of "GUICtrlCreateSlider" would be a good option,
      but it messed up everything, as the "GUICtrlSetData" doesn't work with it.

      What are my options?
    • MrVietA2
      By MrVietA2
      Hello !
      I tried to create 2 slider to set the state of video in my script :

      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <SliderConstants.au3> #include <DSEngine.au3> Global $MovieGUI, $VideoPlay, $VideoStop, $VideoOpen, $VideoPos, $VideoVol, $ViewerVideo, $VideoPos2 Global $mVol, $mLength, $mVideoPlaying $MovieGUI = GUICreate("Movie Player", 740, 590, -1, -1, -1) $VideoPlay = GUICtrlCreateButton("PLAY", 20, 520, 100, 50) $VideoStop = GUICtrlCreateButton("STOP", 140, 520, 100, 50) $VideoOpen = GUICtrlCreateButton("OPEN", 260, 520, 100, 50) $VideoSlow = GUICtrlCreateButton("SLOW", 380, 520, 100, 50) $VideoSpeed = GUICtrlCreateButton("SPEED", 500, 520, 100, 50) $VideoPos = GUICtrlCreateSlider(20, 490, 660, 25, $TBS_ENABLESELRANGE) $ViewerVideo = GUICreate("", 660, 400, 20, 70, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_DISABLED, $WS_EX_MDICHILD), $MovieGUI) $VideoPos2 = GUICtrlCreateSlider(0, 380, 660, 25, $TBS_ENABLESELRANGE) GUICtrlSetBkColor(-1, 0x0) GUISetBkColor(0, $ViewerVideo) WinSetTrans($ViewerVideo, "", 220) GUISetState(@SW_SHOW, $ViewerVideo) GUISetState(@SW_SHOW, $MovieGUI) While 1 $MSG = GUIGetMsg() Switch $MSG Case $GUI_EVENT_CLOSE Exit Case $VideoOpen $PathVideo = FileOpenDialog("Open Video", "", "All Video(*.Avi;*.Wmp;*.Mkv;*.Flv;*.Mp4;*.Mpg;*.Ts)|All File(*.*)|Video(*.Avi; *.Wmp)", 1 + 4) PlayVideo($PathVideo) EndSwitch If $mVideoPlaying = True Then ;~ GUICtrlSetState($VideoPos2, $GUI_ONTOP) ; Switch $MSG Case $VideoStop Engine_StopPlayback() GUICtrlSetData($VideoPos, Engine_GetLength()) GUISetBkColor(0x00000, $ViewerVideo) WinSetTrans($ViewerVideo, "", 220) Case $VideoPlay Switch GUICtrlRead($VideoPlay) Case "PLAY" Engine_PausePlayback() GUICtrlSetData($VideoPlay, "PAUSE") Case "PAUSE" Engine_StartPlayback() GUICtrlSetData($VideoPlay, "PLAY") EndSwitch Case $VideoSpeed ; Case $VideoSlow ; EndSwitch ; $mGGCI = GUIGetCursorInfo($MovieGUI) If IsArray($mGGCI) And $mGGCI[4] = $VideoPos And $mGGCI[2] = 1 Then While $mGGCI[2] $mGGCI = GUIGetCursorInfo($MovieGUI) $mPos = GUICtrlRead($VideoPos) Sleep(1) WEnd Engine_SetPosition($mPos) EndIf GUICtrlSetData($VideoPos, Engine_GetPosition()) GUICtrlSetData($VideoPos2, Engine_GetPosition())EndIf WEnd Func PlayVideo($SavePath) If $SavePath <> "" Then Global $mVol = GUICtrlRead($VideoVol) Engine_LoadFile($SavePath, $ViewerVideo) Engine_StartPlayback() $mLength = Engine_GetLength() GUICtrlSetLimit($VideoPos, $mLength, 0) GUICtrlSetLimit($VideoPos2, $mLength, 0)$mVideoPlaying = True EndIf EndFunc ;==>PlayVideo The slider 2 ($VideoPos2) is hidden while the film is screened, but I want it to be shown. Could you tell me how to do this ?
      All answers are welcome.
      DSEngine.zip