Jump to content

Change GUI Controls based on selection


norjms
 Share

Recommended Posts

I've looked on the forums and the help file for an answer on how to change the GUI controls based on a combo box selection, but can't seem to find out how to go about it. I can't post the code for an example as I can't access the code from this computer. I will just type a quick example for what I'm trying to do.

Global $Configure = (@ScriptDir & "\Configuration\Configure.ini")
$GenericCombo = GUICtrlCreateCombo("Select", 16, 80, 169, 25)
   GUICtrlSetData(-1, "Option A|Option B")

While 1
    $nMSg = GUIGetMsg()
       Select
         Case $nMsg = $GenericCombo
              $GenericComboSelect = GUICtrlRead($GenericCombo)
              iniwrite($Configure,"Trans Action Type","Key","Default")
              
              If $GenericComboSelect = "Option A" Then
                 $GuiBoxForA = GUICtrlCreateCombo("blahA", 24, 256, 82, 17)
                 $GuiBoxForA2 = GUICtrlCreateCombo("blahA", 152, 280, 105, 25) 
              ElseIf $GenericComboSelect = "Option B" Then
                 $GuiBoxForB = GUICtrlCreateCombo("blahB", 280, 280, 105, 25)
                 $GuiBoxForB2 = GUICtrlCreateCombo("blahB", 408, 280, 105, 25)
              EndIf
       EndSelect
WEnd

This was just an example of what I'm trying to do as I don't have the code in front of me. Please excuse any typos or syntax errors as my code actually compiles and runs just having issues as discribed below.

When I run the GUI nothing, but the "$GenericCombo = GUICtrlCreateCombo("Select", 16, 80, 169, 25)" shows up and that is what I want. When I select "Option A" it draws the GUI boxes for "Option A". Now When I change the option to "Option B" I want it to redraw the GUI and remove the boxes for "Option B". I don't know if I need to delete the GUI controls for the previously selected options. I hope this is not the case as I don't know how to handle finding out what boxes are currently displayed and only delete those vrs deleteing all possible boxes as it would get complicated when there is options a b c d e and so on. Pointing me in the right direction would be great.(help file command ect) or a code sample doing the same thing would be awesome. I am new at AutoIt and programing in general so speak slow :)

Link to comment
Share on other sites

  • Moderators

norjms,

Here is how I would do it:

#include <GUIConstantsEx.au3>
#include <GUIComboBox.au3>

; Cuurent GenericCombo text
$sCurrGenericData = ""

; Create GUI
$hGUI = GUICreate("Test", 500, 500)

; Create GenericCombo
$hGenericCombo = GUICtrlCreateCombo("", 10, 10, 100, 20)
GUICtrlSetData(-1, "Option A|Option B")
_GUICtrlComboBox_SetEditText($hGenericCombo, "Select")  ; Sets the text, but does not add to the list for selection

; Create subordinate combos and hide them
$hGuiBoxForA1 = GUICtrlCreateCombo("",  10, 100, 100, 20)
GUICtrlSetData(-1, "Blah A 1.1|Blah A 1.2")
GUICtrlSetState(-1, $GUI_HIDE)
$hGuiBoxForA2 = GUICtrlCreateCombo("", 260, 100, 100, 20)
GUICtrlSetData(-1, "Blah A 2.1|Blah A 2.2")
GUICtrlSetState(-1, $GUI_HIDE)

$hGuiBoxForB1 = GUICtrlCreateCombo("",  10, 100, 100, 20)
GUICtrlSetData(-1, "Blah B 1.1|Blah B 1.2")
GUICtrlSetState(-1, $GUI_HIDE)
$hGuiBoxForB2 = GUICtrlCreateCombo("", 260, 100, 100, 20)
GUICtrlSetData(-1, "Blah B 2.1|Blah B 2.2")
GUICtrlSetState(-1, $GUI_HIDE)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

    ; Read GenericCombo selection
    $sGenericData = GUICtrlRead($hGenericCombo)
    ; If it has changed AND the combo is closed - if we do not check for closure, the code actions while we scan the dropdown list
    If $sGenericData <> $sCurrGenericData And _GUICtrlComboBox_GetDroppedState($hGenericCombo) = False Then
        ; Reset the current text so prevent flicker from constant redrawing
        $sCurrGenericData = $sGenericData
        ; Hide/Show the combos depending on the selection
        Switch $sGenericData
            Case "Option A"
                GUICtrlSetState($hGuiBoxForB1, $GUI_HIDE)
                GUICtrlSetState($hGuiBoxForB2, $GUI_HIDE)
                GUICtrlSetState($hGuiBoxForA1, $GUI_SHOW)
                GUICtrlSetState($hGuiBoxForA2, $GUI_SHOW)
            Case "Option B"
                GUICtrlSetState($hGuiBoxForA1, $GUI_HIDE)
                GUICtrlSetState($hGuiBoxForA2, $GUI_HIDE)
                GUICtrlSetState($hGuiBoxForB1, $GUI_SHOW)
                GUICtrlSetState($hGuiBoxForB2, $GUI_SHOW)
        EndSwitch
    EndIf
WEnd

If you want a large number of options, then you may have to look at using arrays to hold the ControlIDs so you can Hide/Show using loops. But let us cross that bridge when we come to it!

Please ask if anything is unclear. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Quick question I noticed there is a variable undeclared what that something I was to declare somewhere else?

If $sGenericData <> $sCurrGenericData And _GUICtrlComboBox_GetDroppedState($hGenericCombo) = False Then

I don't see $sCurrGenericData declared anywhere. What was it for? Was it supposed to be from my ini file?

Just not sure where I pull the variable data from.

Link to comment
Share on other sites

  • Moderators

norjms,

Quick question I noticed there is a variable undeclared what that something I was to declare somewhere else?

It is declared in line 5 of the script:

; Current GenericCombo text
$sCurrGenericData = ""

It is there so that you can determine when the Combo data has changed. If you do not do something like this then the Hide/Show code is actioned on every pass through the loop and you get flickering - checking if the data has changed is a very common way of preventing this. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks I'm currently at 300 lines of code and merging stuff gets confusing. Sorry I missed the declaration. I kinda bit off a big project for my first ever programing attempt. I only don't know how to accomplish around 3 other tasks.

1. I see there is a function _FileListToArray

Still reading and searching the forum on how to use it to pull the list of folders or files not both at the same time and present that list into the gui.

2. How to let the user select from the list either single or multiple files / folders

3. Then runwait a command against the list that the user selected

4. And last and not least where is the proper place to post the script for a code review as I know I have made mistakes that experianced users will see causing problems I didn't forsee. Also once I'm done I would love to see how things could have been done easier/cleaner. I expect the project to take around 600 lines of code, but I can't tell as I get to certain tasks it gets more complicated than I previously expected.

Thank you for your help. As different things are explained to me it helps me workout other problems on my own. I enjoy the site as most everyone is newbie friendly.

Link to comment
Share on other sites

  • Moderators

norjms,

Do not hesitate to post about anything you get stuck on - that is why we are all here, after all. :)

As to your outstanding tasks:

1. _FileListToArray. Look at the $iFlag parameter - depending on how you set it, you get files, folders, or both. Note that the function is not recursive - it only looks in the single folder. There are plenty of recursive versions on the forums - but if you wait a day or two I am just finishing one you could have should you feel the need.

2. Multiple selections. Use a ListView and omit the $LVS_SINGLESEL style.

3. Use RunWait in a loop.

4. Code review post location. You are already here. B) But people are often loath to spend time tidying up others' code. If it is running then it is running - it is preferable to help those who are stuck. But post it anyway - if you send me a PM when you do it I will certainly give it a glance.

I am glad you enjoy the site and find us a friendly place. It is like anywhere else - treat others as you would like to be treated - hiding behind an avatar does not excuse you from the normal rules. It is just a pity that some new visitors do not realise that.... ;)

Good luck with the rest of your project.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Here is the script I've been working on Tab 1 and 2 are mostly funtional I just wanted to see what are causing some of the issues I'm having before extending the script futher.

I get flicker after changing drop down options.

Have to click on buttons more than once to take effect.

It defaults to the about tab when opeing instead of the first tab.

Please feel free to suggest changes on how to change the script to be simpler and more compact. Thanks for taking a look.

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GUIComboBox.au3>

;Path to configuration file
Global $Configure = (@ScriptDir & "\Bin\Configuration\Configure.ini")
;Path to GUI Media
Global $GuiMedia = (@ScriptDir & "\Bin\Media\")
;Begin Form Create
$Form1 = GUICreate("Media Auto Ripper", 631, 384, 189, 119)

;Setup Tabs
$Tab1 = GUICtrlCreateTab(8, 32, 617, 345)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

;Sheet 1
$TabSheet1 = GUICtrlCreateTabItem("Media Rip Control") ;Creates Sheet 1 and Sets it's name

;Begin Ripping Control Section
$Label2 = GUICtrlCreateLabel("DVD Ripping Control", 16, 72, 102, 17)
; Calls @ScriptDir\Bin\AutoRipActivate.exe
$Button1 = GUICtrlCreateButton("Auto Rip On", 24, 96, 75, 25, BitOR($BS_PUSHLIKE,$WS_GROUP))
    GUICtrlSetTip(-1, "Enables the Automated DVD Ripping Proccess")

; Calls @ScriptDir\Bin\AutoRipDisable.exe
$Button2 = GUICtrlCreateButton("Auto Rip Off", 24, 128, 75, 25, $WS_GROUP)
    GUICtrlSetTip(-1, "Disables Auto Ripping Feature")

;DVD Drive Select writes selection to @ScriptDir\configure.ini section1 key=
Local $DVDDriveSelect = IniRead($Configure,"DVD Drive","Key","Default")

If $DVDDriveSelect = "" Then
        $Select = GUICtrlCreateCombo("Select", 24, 184, 65, 25)
        GUICtrlSetData(-1, "D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:")
        GUICtrlSetTip(-1, "The source DVD drive.")
Else
    $Select = GUICtrlCreateCombo($DVDDriveSelect, 24, 184, 65, 25)
        GUICtrlSetData(-1, "D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:")
        GUICtrlSetTip(-1, "The source DVD drive.")
EndIf

$Label3 = GUICtrlCreateLabel("DVD Ripping Drive", 16, 160, 94, 17)

; need to create a browse filesystem for user to select folder and write result to @ScriptDir\configure.ini section2 key=
$Label4 = GUICtrlCreateLabel("DVD Target Directory", 16, 216, 106, 17)

;File System Broswer for Target Path
$BrowseFileSystem = GUICtrlCreateButton("Browse", 536, 232, 75, 25, $WS_GROUP)
Local $BrowseFileSystemSelect = IniRead($Configure,"DVD Rip Output Path","Key", "Default")
    If $BrowseFileSystemSelect = "" Then
        $RipTargetPath = GUICtrlCreateInput("Browse to Select", 16, 232, 505, 21,$ES_READONLY)
    Else
        $RipTargetPath = GUICtrlCreateInput($BrowseFileSystemSelect & "\", 16, 232, 505, 21,$ES_READONLY)
    EndIf

;GUI on/off LEDs
Global $ActiveLedStatus = iniread($Configure, "AutoRipActivate", "Key", "default")
;Off Case
If $ActiveLedStatus = "Off" Then $ActiveLed = GUICtrlCreatePic(@ScriptDir & "\Bin\Media\Off.jpg", 112, 96, 20, 20)
If $ActiveLedStatus = "Off" Then $DeactiveLed = GUICtrlCreatePic(@ScriptDir & "\Bin\Media\On.jpg", 112, 128, 20, 20)
;On Case
If $ActiveLedStatus = "On" Then $ActiveLed = GUICtrlCreatePic(@ScriptDir & "\Bin\Media\On.jpg", 112, 96, 20, 20)
If $ActiveLedStatus = "On" Then $DeactiveLed = GUICtrlCreatePic(@ScriptDir & "\Bin\Media\Off.jpg", 112, 128, 20, 20)
;Where the completed transcodes are to be stored
;browse button for input box
$CompletedTransButton = GUICtrlCreateButton("Browse", 536, 280, 75, 25, $WS_GROUP)
    Local $CompTransSel = IniRead($Configure,"Transcode Path","Key","Default")
        If $CompTransSel = "" Then
            $CompletedTranscode = GUICtrlCreateInput("Browse to Select", 16, 280, 505, 21,$ES_READONLY)
        Else
            $CompletedTranscode = GUICtrlCreateInput($CompTransSel & "\", 16, 280, 505, 21,$ES_READONLY)
        EndIf
;Completed Transcode Label
$Label5 = GUICtrlCreateLabel("Completed Transcode Directory", 16, 264, 153, 17)

;Sheet 2
$TabSheet2 = GUICtrlCreateTabItem("Transcode Options")
GUICtrlSetState(-1,$GUI_SHOW)
;Transcode select type
$TransCodeActionTypeLabel = GUICtrlCreateLabel("Select the Transcode Action", 16, 56, 139, 17)
$CurrTransCodeActionTypeComboSelect = "" ;Used to determine if combo box is changed
$TransCodeActionTypeCombo = GUICtrlCreateCombo("", 16, 80, 169, 25)
    GUICtrlSetData(-1, "Transcode VIDEO TS|Transcode Video File")
    _GUICtrlComboBox_SetEditText($TransCodeActionTypeCombo, "Select")
$TransCodeActionTypeHelp = GUICtrlCreateButton("?", 158, 56, 27, 17, $WS_GROUP)
;Encoding preset dropdown box and label
$EncodePresetLabel = GUICtrlCreateLabel("Encoding Preset", 24, 256, 82, 17)
    GUICtrlSetState(-1, $GUI_HIDE)
$EncodePresetCombo = GUICtrlCreateCombo("", 24, 280, 105, 25)
    GUICtrlSetData(-1, "Universal|iPod|iPhone & iPod Touch|AppleTV|Normal|High Profile")
    _GUICtrlComboBox_SetEditText($EncodePresetCombo, "Select")
    GUICtrlSetState(-1, $GUI_HIDE)
$EncodePresetHelp = GUICtrlCreateButton("?", 105, 254, 27, 17, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_HIDE)
;Video type dropdown box and label
$VideoTypeLabel = GUICtrlCreateLabel("Video", 152, 256, 31, 17)
    GUICtrlSetState(-1, $GUI_HIDE)
$VideoTypeCombo = GUICtrlCreateCombo("Combo2", 152, 280, 105, 25)
    GUICtrlSetState(-1, $GUI_HIDE)
$VideoTypeHelp = GUICtrlCreateButton("?", 185, 254, 27, 17, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_HIDE)
;Audio type dropdown box and label
$AudioTypeLabel = GUICtrlCreateLabel("Audio", 280, 256, 31, 17)
    GUICtrlSetState(-1, $GUI_HIDE)
$AudioTypeCombo = GUICtrlCreateCombo("Combo3", 280, 280, 105, 25)
    GUICtrlSetState(-1, $GUI_HIDE)
$AudioTypeHelp = GUICtrlCreateButton("?", 313, 254, 27, 17, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_HIDE)
;Container type dropdown box and label
$ContainerTypeLabel = GUICtrlCreateLabel("Container", 408, 256, 49, 17)
    GUICtrlSetState(-1, $GUI_HIDE)
$ContainerTypeCombo = GUICtrlCreateCombo("Combo4", 408, 280, 105, 25)
    GUICtrlSetState(-1, $GUI_HIDE)
$ContainerTypeHelp = GUICtrlCreateButton("?", 465, 254, 27, 17, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_HIDE)
;Passing custom switches to handbrake
$CustomEncodeLabel = GUICtrlCreateLabel("Custom Encoding Options", 24, 320, 126, 17)
    GUICtrlSetState(-1, $GUI_HIDE)
$CustomEncodeInput = GUICtrlCreateInput("CompleteCustom", 24, 344, 489, 21)
    GUICtrlSetState(-1, $GUI_HIDE)
$CustomEncodeHelp = GUICtrlCreateButton("?", 152, 320, 27, 17, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_HIDE)
;Movie Selection
$MovieSelectionGroup = GUICtrlCreateGroup("Movie Selection", 424, 64, 185, 185)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlSetState(-1, $GUI_HIDE)
;Encode only selected movies Video TS
$EncodeSelected = GUICtrlCreateButton("Encode Selected", 520, 280, 91, 25, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_HIDE)
;Encode only selected movies files
$EncodeSelectedFiles = GUICtrlCreateButton("Encode Selected", 520, 280, 91, 25, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_HIDE)
;Encode all movies Video TS
$EncodeAll = GUICtrlCreateButton("Encode All", 520, 312, 91, 25, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_HIDE)
;Encode all movies Files
$EncodeAllFiles = GUICtrlCreateButton("Encode All", 520, 312, 91, 25, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_HIDE)
;Delete all movies in rip folder
$DeleteRipDir = GUICtrlCreateButton("Empty Rip  Folder", 520, 344, 91, 25, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_HIDE)

GUISetState()


;Sheet 4
$TabSheet4 = GUICtrlCreateTabItem("Metadata Control")

;Sheet 3
$TabSheet3 = GUICtrlCreateTabItem("About")
GUICtrlCreateTabItem("")

;extra
$Label1 = GUICtrlCreateLabel("Media Auto Ripper", 8, 0, 171, 28)
GUICtrlSetFont(-1, 16, 800, 2, "Times New Roman")
GUISetState(@SW_SHOW)




While 1
    $nMsg = GUIGetMsg()
        Select
            ;Check  if user clicked close button
            Case $nMsg = $GUI_EVENT_CLOSE
            GUIDelete()
            Exit
            ;Activates Auto Rip
            ;GUICtrlSetState($DeleteRipDir, $GUI_SHOW)
            Case $nMsg = $Button1
                IniWrite($Configure,"AutoRipActivate","Key","On")
                ;MsgBox(64, "Debug", "Activate Was Pressed")
                GUICtrlSetImage($ActiveLed,@ScriptDir & "\Bin\Media\On.jpg")
                GUICtrlSetState($DeactiveLed, $GUI_HIDE)
                GUICtrlSetState($ActiveLed, $GUI_SHOW)
                GUICtrlSetImage($DeactiveLed,@ScriptDir & "\Bin\Media\On.jpg")

            ;Deactivates Auto Rip
            Case $nMsg = $Button2
                IniWrite($Configure,"AutoRipActivate","Key","Off")
                ;MsgBox(64, "Debug", "Deactivate Was Pressed")
                GUICtrlSetImage($ActiveLed,@ScriptDir & "\Bin\Media\On.jpg")
                GUICtrlSetImage($DeactiveLed,@ScriptDir & "\Bin\Media\Off.jpg")
                GUICtrlSetState($ActiveLed, $GUI_HIDE)
                GUICtrlSetState($DeactiveLed, $GUI_SHOW)
            Case $nMsg = $Select
                $DVDDriveSelect = GUICtrlRead($Select)
                IniWrite($Configure,"DVD Drive","Key",$DVDDriveSelect)
            Case $nMsg = $BrowseFileSystem
                ; Get the folder to use
                $BrowseSelect = FileSelectFolder("Select the folder where you want the DVD Rips stored.", "",1)
                ; Save it to the ini file
                IniWrite($Configure,"DVD Rip Output Path","Key",$BrowseSelect)
                ; Change the input box text
                GUICtrlSetData($RipTargetPath, $BrowseSelect) ; Note syntax
                ; Not sure if you need this line, it depends on whether you want this variable set to the new  folder
                Local $BrowseFileSystemSelect = $BrowseSelect
            ;Transcode Path Button
            Case $nMsg = $CompletedTransButton
                ;Get the folder to use
                $BrowseTransSelect = FileSelectFolder("Select the folder where you want the completed transcodes stored.", "",1)
                ;Save it to the ini File
                IniWrite($Configure,"Transcode Path","Key",$BrowseTransSelect)
                ;Change inputboxtext
                GUICtrlSetData($CompletedTranscode, $BrowseTransSelect)
            Case $nMsg = $EncodeAll
                ;Call encode all DVD
                RunWait(@ScriptDir & "\Bin\TransAllDVD.exe")

            Case $nMsg = $EncodeAllFiles
                ;Call Encode all files
                RunWait(@ScriptDir & "\Bin\TranscodeAllFiles.exe")
EndSelect

;$TransCodeActionTypeCombo
Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
        Exit
EndSwitch
$TransCodeActionTypeComboSelect = GUICtrlRead($TransCodeActionTypeCombo)
    If $TransCodeActionTypeComboSelect <> $CurrTransCodeActionTypeComboSelect And _GUICtrlComboBox_GetDroppedState($TransCodeActionTypeCombo) = False Then
        $CurrTransCodeActionTypeComboSelect = $TransCodeActionTypeComboSelect

        Switch $TransCodeActionTypeComboSelect
            Case "Transcode VIDEO TS"
                GUICtrlSetState($DeleteRipDir, $GUI_SHOW)
                GUICtrlSetState($EncodeAll, $GUI_SHOW)
                GUICtrlSetState($EncodeSelected, $GUI_SHOW)
                GUICtrlSetState($MovieSelectionGroup, $GUI_SHOW)
                GUICtrlSetState($EncodeAllFiles,$GUI_HIDE)
                GUICtrlSetState($EncodeSelectedFiles,$GUI_HIDE)
                GUICtrlSetState($EncodePresetHelp, $GUI_SHOW)
                GUICtrlSetState($EncodePresetCombo, $GUI_SHOW)
                GUICtrlSetState($EncodePresetLabel, $GUI_SHOW)
                ;Enable Preset Options

            Case "Transcode Video File"
                ;Select hide
                GUICtrlSetState($EncodeAll, $GUI_HIDE)
                GUICtrlSetState($EncodeSelected, $GUI_HIDE)
                GUICtrlSetState($DeleteRipDir, $GUI_SHOW)
                ;Select show
                GUICtrlSetState($EncodeAllFiles,$GUI_SHOW)
                GUICtrlSetState($EncodeSelectedFiles,$GUI_SHOW)
                GUICtrlSetState($MovieSelectionGroup, $GUI_SHOW)
                GUICtrlSetState($CustomEncodeHelp, $GUI_SHOW)
                GUICtrlSetState($CustomEncodeInput, $GUI_SHOW)
                GUICtrlSetState($CustomEncodeLabel, $GUI_SHOW)
                GUICtrlSetState($ContainerTypeHelp, $GUI_SHOW)
                GUICtrlSetState($ContainerTypeCombo, $GUI_SHOW)
                GUICtrlSetState($ContainerTypeLabel, $GUI_SHOW)
                GUICtrlSetState($AudioTypeHelp, $GUI_SHOW)
                GUICtrlSetState($AudioTypeCombo, $GUI_SHOW)
                GUICtrlSetState($AudioTypeLabel, $GUI_SHOW)
                GUICtrlSetState($VideoTypeHelp, $GUI_SHOW)
                GUICtrlSetState($VideoTypeCombo, $GUI_SHOW)
                GUICtrlSetState($VideoTypeLabel, $GUI_SHOW)
                GUICtrlSetState($EncodePresetHelp, $GUI_SHOW)
                GUICtrlSetState($EncodePresetCombo, $GUI_SHOW)
                GUICtrlSetState($EncodePresetLabel, $GUI_SHOW)



        EndSwitch
    EndIf
$CurrEncodePresetComboSelect = ""
$EncodePresetComboSelect = GUICtrlRead($EncodePresetCombo)
    If $EncodePresetComboSelect <> $CurrEncodePresetComboSelect And _GUICtrlComboBox_GetDroppedState($EncodePresetCombo) = False Then
        $CurrEncodePresetComboSelect = $EncodePresetComboSelect

        Switch $EncodePresetComboSelect
            Case "Universal"
                iniwrite($Configure,"Encode Preset","Key",$EncodePresetComboSelect)
                IniWrite($Configure,"Encode Ext","Key",".mp4")
                GUICtrlSetState($CustomEncodeHelp, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeInput, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeLabel, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeHelp, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeCombo, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeLabel, $GUI_HIDE)
                GUICtrlSetState($AudioTypeHelp, $GUI_HIDE)
                GUICtrlSetState($AudioTypeCombo, $GUI_HIDE)
                GUICtrlSetState($AudioTypeLabel, $GUI_HIDE)
                GUICtrlSetState($VideoTypeHelp, $GUI_HIDE)
                GUICtrlSetState($VideoTypeCombo, $GUI_HIDE)
                GUICtrlSetState($VideoTypeLabel, $GUI_HIDE)
            Case "iPod"
                iniwrite($Configure,"Encode Preset","Key",$EncodePresetComboSelect)
                IniWrite($Configure,"Encode Ext","Key",".mp4")
                GUICtrlSetState($CustomEncodeHelp, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeInput, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeLabel, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeHelp, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeCombo, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeLabel, $GUI_HIDE)
                GUICtrlSetState($AudioTypeHelp, $GUI_HIDE)
                GUICtrlSetState($AudioTypeCombo, $GUI_HIDE)
                GUICtrlSetState($AudioTypeLabel, $GUI_HIDE)
                GUICtrlSetState($VideoTypeHelp, $GUI_HIDE)
                GUICtrlSetState($VideoTypeCombo, $GUI_HIDE)
                GUICtrlSetState($VideoTypeLabel, $GUI_HIDE)
            Case "iPhone & iPod Touch"
                iniwrite($Configure,"Encode Preset","Key",$EncodePresetComboSelect)
                IniWrite($Configure,"Encode Ext","Key",".mp4")
                GUICtrlSetState($CustomEncodeHelp, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeInput, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeLabel, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeHelp, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeCombo, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeLabel, $GUI_HIDE)
                GUICtrlSetState($AudioTypeHelp, $GUI_HIDE)
                GUICtrlSetState($AudioTypeCombo, $GUI_HIDE)
                GUICtrlSetState($AudioTypeLabel, $GUI_HIDE)
                GUICtrlSetState($VideoTypeHelp, $GUI_HIDE)
                GUICtrlSetState($VideoTypeCombo, $GUI_HIDE)
                GUICtrlSetState($VideoTypeLabel, $GUI_HIDE)
            Case "AppleTV"
                iniwrite($Configure,"Encode Preset","Key",$EncodePresetComboSelect)
                IniWrite($Configure,"Encode Ext","Key",".mp4")
                GUICtrlSetState($CustomEncodeHelp, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeInput, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeLabel, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeHelp, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeCombo, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeLabel, $GUI_HIDE)
                GUICtrlSetState($AudioTypeHelp, $GUI_HIDE)
                GUICtrlSetState($AudioTypeCombo, $GUI_HIDE)
                GUICtrlSetState($AudioTypeLabel, $GUI_HIDE)
                GUICtrlSetState($VideoTypeHelp, $GUI_HIDE)
                GUICtrlSetState($VideoTypeCombo, $GUI_HIDE)
                GUICtrlSetState($VideoTypeLabel, $GUI_HIDE)
            Case "Normal"
                iniwrite($Configure,"Encode Preset","Key",$EncodePresetComboSelect)
                IniWrite($Configure,"Encode Ext","Key",".mp4")
                GUICtrlSetState($CustomEncodeHelp, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeInput, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeLabel, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeHelp, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeCombo, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeLabel, $GUI_HIDE)
                GUICtrlSetState($AudioTypeHelp, $GUI_HIDE)
                GUICtrlSetState($AudioTypeCombo, $GUI_HIDE)
                GUICtrlSetState($AudioTypeLabel, $GUI_HIDE)
                GUICtrlSetState($VideoTypeHelp, $GUI_HIDE)
                GUICtrlSetState($VideoTypeCombo, $GUI_HIDE)
                GUICtrlSetState($VideoTypeLabel, $GUI_HIDE)
            Case "High Profile"
                iniwrite($Configure,"Encode Preset","Key",$EncodePresetComboSelect)
                IniWrite($Configure,"Encode Ext","Key",".mp4")
                GUICtrlSetState($CustomEncodeHelp, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeInput, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeLabel, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeHelp, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeCombo, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeLabel, $GUI_HIDE)
                GUICtrlSetState($AudioTypeHelp, $GUI_HIDE)
                GUICtrlSetState($AudioTypeCombo, $GUI_HIDE)
                GUICtrlSetState($AudioTypeLabel, $GUI_HIDE)
                GUICtrlSetState($VideoTypeHelp, $GUI_HIDE)
                GUICtrlSetState($VideoTypeCombo, $GUI_HIDE)
                GUICtrlSetState($VideoTypeLabel, $GUI_HIDE)
            Case "Custom"
                iniwrite($Configure,"Encode Preset","Key",$EncodePresetComboSelect)
                GUICtrlSetState($CustomEncodeHelp, $GUI_SHOW)
                GUICtrlSetState($CustomEncodeInput, $GUI_SHOW)
                GUICtrlSetState($CustomEncodeLabel, $GUI_SHOW)
                GUICtrlSetState($ContainerTypeHelp, $GUI_SHOW)
                GUICtrlSetState($ContainerTypeCombo, $GUI_SHOW)
                GUICtrlSetState($ContainerTypeLabel, $GUI_SHOW)
                GUICtrlSetState($AudioTypeHelp, $GUI_SHOW)
                GUICtrlSetState($AudioTypeCombo, $GUI_SHOW)
                GUICtrlSetState($AudioTypeLabel, $GUI_SHOW)
                GUICtrlSetState($VideoTypeHelp, $GUI_SHOW)
                GUICtrlSetState($VideoTypeCombo, $GUI_SHOW)
                GUICtrlSetState($VideoTypeLabel, $GUI_SHOW)
        EndSwitch
    EndIf
WEnd
Link to comment
Share on other sites

  • Moderators

norjms,

Flicker. You need to set the initial $Curr*ComboSelect = "" declarations OUTSIDE the While...WEnd loop - you had one inside so it was reset on every pass and so the anti-flicker check (If $*ComboSelect <> $Curr*ComboSelect And _GUICtrlComboBox_GetDroppedState($TransCodeActionTypeCombo) = False Then) would always fire. :)

Button click. I have no problems. I did remove a useless While...WEnd loop from within your valid While...WEnd loop before I started testing, so that might have been the problem.

Default start tab. You had set 2 tabs to show first - so AutoIt ignored you and just set the last created! ;)

This is what I have done - look for the <<<<<<<<<<<<<< lines:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GUIComboBox.au3>

;Path to configuration file
Global $Configure = (@ScriptDir & "\Bin\Configuration\Configure.ini")
;Path to GUI Media
Global $GuiMedia = (@ScriptDir & "\Bin\Media\")

;Begin Form Create
$Form1 = GUICreate("Media Auto Ripper", 631, 384, 189, 119)

;Setup Tabs
$Tab1 = GUICtrlCreateTab(8, 32, 617, 345)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)

;Sheet 1
$TabSheet1 = GUICtrlCreateTabItem("Media Rip Control") ;Creates Sheet 1 and Sets it's name

;Begin Ripping Control Section
$Label2 = GUICtrlCreateLabel("DVD Ripping Control", 16, 72, 102, 17)
; Calls @ScriptDir\Bin\AutoRipActivate.exe
$Button1 = GUICtrlCreateButton("Auto Rip On", 24, 96, 75, 25, BitOR($BS_PUSHLIKE, $WS_GROUP))
GUICtrlSetTip(-1, "Enables the Automated DVD Ripping Proccess")

; Calls @ScriptDir\Bin\AutoRipDisable.exe
$Button2 = GUICtrlCreateButton("Auto Rip Off", 24, 128, 75, 25, $WS_GROUP)
GUICtrlSetTip(-1, "Disables Auto Ripping Feature")

;DVD Drive Select writes selection to @ScriptDir\configure.ini section1 key=
Local $DVDDriveSelect = IniRead($Configure, "DVD Drive", "Key", "Default")

If $DVDDriveSelect = "" Then
    $Select = GUICtrlCreateCombo("Select", 24, 184, 65, 25)
    GUICtrlSetData(-1, "D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:")
    GUICtrlSetTip(-1, "The source DVD drive.")
Else
    $Select = GUICtrlCreateCombo($DVDDriveSelect, 24, 184, 65, 25)
    GUICtrlSetData(-1, "D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:")
    GUICtrlSetTip(-1, "The source DVD drive.")
EndIf

$Label3 = GUICtrlCreateLabel("DVD Ripping Drive", 16, 160, 94, 17)

; need to create a browse filesystem for user to select folder and write result to @ScriptDir\configure.ini section2 key=
$Label4 = GUICtrlCreateLabel("DVD Target Directory", 16, 216, 106, 17)

;File System Broswer for Target Path
$BrowseFileSystem = GUICtrlCreateButton("Browse", 536, 232, 75, 25, $WS_GROUP)
Local $BrowseFileSystemSelect = IniRead($Configure, "DVD Rip Output Path", "Key", "Default")
If $BrowseFileSystemSelect = "" Then
    $RipTargetPath = GUICtrlCreateInput("Browse to Select", 16, 232, 505, 21, $ES_READONLY)
Else
    $RipTargetPath = GUICtrlCreateInput($BrowseFileSystemSelect & "\", 16, 232, 505, 21, $ES_READONLY)
EndIf

;GUI on/off LEDs
Global $ActiveLedStatus = IniRead($Configure, "AutoRipActivate", "Key", "default")
;Off Case
If $ActiveLedStatus = "Off" Then $ActiveLed = GUICtrlCreatePic(@ScriptDir & "\Bin\Media\Off.jpg", 112, 96, 20, 20)
If $ActiveLedStatus = "Off" Then $DeactiveLed = GUICtrlCreatePic(@ScriptDir & "\Bin\Media\On.jpg", 112, 128, 20, 20)
;On Case
If $ActiveLedStatus = "On" Then $ActiveLed = GUICtrlCreatePic(@ScriptDir & "\Bin\Media\On.jpg", 112, 96, 20, 20)
If $ActiveLedStatus = "On" Then $DeactiveLed = GUICtrlCreatePic(@ScriptDir & "\Bin\Media\Off.jpg", 112, 128, 20, 20)
;Where the completed transcodes are to be stored
;browse button for input box
$CompletedTransButton = GUICtrlCreateButton("Browse", 536, 280, 75, 25, $WS_GROUP)
Local $CompTransSel = IniRead($Configure, "Transcode Path", "Key", "Default")
If $CompTransSel = "" Then
    $CompletedTranscode = GUICtrlCreateInput("Browse to Select", 16, 280, 505, 21, $ES_READONLY)
Else
    $CompletedTranscode = GUICtrlCreateInput($CompTransSel & "\", 16, 280, 505, 21, $ES_READONLY)
EndIf
;Completed Transcode Label
$Label5 = GUICtrlCreateLabel("Completed Transcode Directory", 16, 264, 153, 17)

;Sheet 2
$TabSheet2 = GUICtrlCreateTabItem("Transcode Options")

;Transcode select type
$TransCodeActionTypeLabel = GUICtrlCreateLabel("Select the Transcode Action", 16, 56, 139, 17)
;$CurrTransCodeActionTypeComboSelect = "" ;Used to determine if combo box is changed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$TransCodeActionTypeCombo = GUICtrlCreateCombo("", 16, 80, 169, 25)
GUICtrlSetData(-1, "Transcode VIDEO TS|Transcode Video File")
_GUICtrlComboBox_SetEditText($TransCodeActionTypeCombo, "Select")
$TransCodeActionTypeHelp = GUICtrlCreateButton("?", 158, 56, 27, 17, $WS_GROUP)
;Encoding preset dropdown box and label
$EncodePresetLabel = GUICtrlCreateLabel("Encoding Preset", 24, 256, 82, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$EncodePresetCombo = GUICtrlCreateCombo("", 24, 280, 105, 25)
GUICtrlSetData(-1, "Universal|iPod|iPhone & iPod Touch|AppleTV|Normal|High Profile")
_GUICtrlComboBox_SetEditText($EncodePresetCombo, "Select")
GUICtrlSetState(-1, $GUI_HIDE)
$EncodePresetHelp = GUICtrlCreateButton("?", 105, 254, 27, 17, $WS_GROUP)
GUICtrlSetState(-1, $GUI_HIDE)
;Video type dropdown box and label
$VideoTypeLabel = GUICtrlCreateLabel("Video", 152, 256, 31, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$VideoTypeCombo = GUICtrlCreateCombo("Combo2", 152, 280, 105, 25)
GUICtrlSetState(-1, $GUI_HIDE)
$VideoTypeHelp = GUICtrlCreateButton("?", 185, 254, 27, 17, $WS_GROUP)
GUICtrlSetState(-1, $GUI_HIDE)
;Audio type dropdown box and label
$AudioTypeLabel = GUICtrlCreateLabel("Audio", 280, 256, 31, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$AudioTypeCombo = GUICtrlCreateCombo("Combo3", 280, 280, 105, 25)
GUICtrlSetState(-1, $GUI_HIDE)
$AudioTypeHelp = GUICtrlCreateButton("?", 313, 254, 27, 17, $WS_GROUP)
GUICtrlSetState(-1, $GUI_HIDE)
;Container type dropdown box and label
$ContainerTypeLabel = GUICtrlCreateLabel("Container", 408, 256, 49, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$ContainerTypeCombo = GUICtrlCreateCombo("Combo4", 408, 280, 105, 25)
GUICtrlSetState(-1, $GUI_HIDE)
$ContainerTypeHelp = GUICtrlCreateButton("?", 465, 254, 27, 17, $WS_GROUP)
GUICtrlSetState(-1, $GUI_HIDE)
;Passing custom switches to handbrake
$CustomEncodeLabel = GUICtrlCreateLabel("Custom Encoding Options", 24, 320, 126, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$CustomEncodeInput = GUICtrlCreateInput("CompleteCustom", 24, 344, 489, 21)
GUICtrlSetState(-1, $GUI_HIDE)
$CustomEncodeHelp = GUICtrlCreateButton("?", 152, 320, 27, 17, $WS_GROUP)
GUICtrlSetState(-1, $GUI_HIDE)
;Movie Selection
$MovieSelectionGroup = GUICtrlCreateGroup("Movie Selection", 424, 64, 185, 185)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetState(-1, $GUI_HIDE)
;Encode only selected movies Video TS
$EncodeSelected = GUICtrlCreateButton("Encode Selected", 520, 280, 91, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_HIDE)
;Encode only selected movies files
$EncodeSelectedFiles = GUICtrlCreateButton("Encode Selected", 520, 280, 91, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_HIDE)
;Encode all movies Video TS
$EncodeAll = GUICtrlCreateButton("Encode All", 520, 312, 91, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_HIDE)
;Encode all movies Files
$EncodeAllFiles = GUICtrlCreateButton("Encode All", 520, 312, 91, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_HIDE)
;Delete all movies in rip folder
$DeleteRipDir = GUICtrlCreateButton("Empty Rip  Folder", 520, 344, 91, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_HIDE)

GUISetState()

;Sheet 4
$TabSheet4 = GUICtrlCreateTabItem("Metadata Control")

;Sheet 3
$TabSheet3 = GUICtrlCreateTabItem("About")

GUICtrlCreateTabItem("")

; Set this tab to display first <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetState($TabSheet1, $GUI_SHOW)

;extra
$Label1 = GUICtrlCreateLabel("Media Auto Ripper", 8, 0, 171, 28)
GUICtrlSetFont(-1, 16, 800, 2, "Times New Roman")

GUISetState(@SW_SHOW)

; Set the anti-flicker variables OUTSIDE the loop - if they are inside they will not work <<<<<<<<<<<<<<<<<<<<<<<<<<<
$CurrTransCodeActionTypeComboSelect = ""
$CurrEncodePresetComboSelect = ""

While 1
    $nMsg = GUIGetMsg()
    Select
        ;Check  if user clicked close button
        Case $nMsg = $GUI_EVENT_CLOSE
            GUIDelete()
            Exit
            ;Activates Auto Rip
            ;GUICtrlSetState($DeleteRipDir, $GUI_SHOW)
        Case $nMsg = $Button1
            IniWrite($Configure, "AutoRipActivate", "Key", "On")
            ;MsgBox(64, "Debug", "Activate Was Pressed")
            GUICtrlSetImage($ActiveLed, @ScriptDir & "\Bin\Media\On.jpg")
            GUICtrlSetState($DeactiveLed, $GUI_HIDE)
            GUICtrlSetState($ActiveLed, $GUI_SHOW)
            GUICtrlSetImage($DeactiveLed, @ScriptDir & "\Bin\Media\On.jpg")

            ;Deactivates Auto Rip
        Case $nMsg = $Button2
            IniWrite($Configure, "AutoRipActivate", "Key", "Off")
            ;MsgBox(64, "Debug", "Deactivate Was Pressed")
            GUICtrlSetImage($ActiveLed, @ScriptDir & "\Bin\Media\On.jpg")
            GUICtrlSetImage($DeactiveLed, @ScriptDir & "\Bin\Media\Off.jpg")
            GUICtrlSetState($ActiveLed, $GUI_HIDE)
            GUICtrlSetState($DeactiveLed, $GUI_SHOW)
        Case $nMsg = $Select
            $DVDDriveSelect = GUICtrlRead($Select)
            IniWrite($Configure, "DVD Drive", "Key", $DVDDriveSelect)
        Case $nMsg = $BrowseFileSystem
            ; Get the folder to use
            $BrowseSelect = FileSelectFolder("Select the folder where you want the DVD Rips stored.", "", 1)
            ; Save it to the ini file
            IniWrite($Configure, "DVD Rip Output Path", "Key", $BrowseSelect)
            ; Change the input box text
            GUICtrlSetData($RipTargetPath, $BrowseSelect) ; Note syntax
            ; Not sure if you need this line, it depends on whether you want this variable set to the new  folder
            Local $BrowseFileSystemSelect = $BrowseSelect
            ;Transcode Path Button
        Case $nMsg = $CompletedTransButton
            ;Get the folder to use
            $BrowseTransSelect = FileSelectFolder("Select the folder where you want the completed transcodes stored.", "", 1)
            ;Save it to the ini File
            IniWrite($Configure, "Transcode Path", "Key", $BrowseTransSelect)
            ;Change inputboxtext
            GUICtrlSetData($CompletedTranscode, $BrowseTransSelect)
        Case $nMsg = $EncodeAll
            ;Call encode all DVD
            RunWait(@ScriptDir & "\Bin\TransAllDVD.exe")

        Case $nMsg = $EncodeAllFiles
            ;Call Encode all files
            RunWait(@ScriptDir & "\Bin\TranscodeAllFiles.exe")
    EndSelect

    ;$TransCodeActionTypeCombo

    $TransCodeActionTypeComboSelect = GUICtrlRead($TransCodeActionTypeCombo)
    If $TransCodeActionTypeComboSelect <> $CurrTransCodeActionTypeComboSelect And _GUICtrlComboBox_GetDroppedState($TransCodeActionTypeCombo) = False Then
        $CurrTransCodeActionTypeComboSelect = $TransCodeActionTypeComboSelect

        Switch $TransCodeActionTypeComboSelect
            Case "Transcode VIDEO TS"
                GUICtrlSetState($DeleteRipDir, $GUI_SHOW)
                GUICtrlSetState($EncodeAll, $GUI_SHOW)
                GUICtrlSetState($EncodeSelected, $GUI_SHOW)
                GUICtrlSetState($MovieSelectionGroup, $GUI_SHOW)
                GUICtrlSetState($EncodeAllFiles, $GUI_HIDE)
                GUICtrlSetState($EncodeSelectedFiles, $GUI_HIDE)
                GUICtrlSetState($EncodePresetHelp, $GUI_SHOW)
                GUICtrlSetState($EncodePresetCombo, $GUI_SHOW)
                GUICtrlSetState($EncodePresetLabel, $GUI_SHOW)
                ;Enable Preset Options

            Case "Transcode Video File"
                ;Select hide
                GUICtrlSetState($EncodeAll, $GUI_HIDE)
                GUICtrlSetState($EncodeSelected, $GUI_HIDE)
                GUICtrlSetState($DeleteRipDir, $GUI_SHOW)
                ;Select show
                GUICtrlSetState($EncodeAllFiles, $GUI_SHOW)
                GUICtrlSetState($EncodeSelectedFiles, $GUI_SHOW)
                GUICtrlSetState($MovieSelectionGroup, $GUI_SHOW)
                GUICtrlSetState($CustomEncodeHelp, $GUI_SHOW)
                GUICtrlSetState($CustomEncodeInput, $GUI_SHOW)
                GUICtrlSetState($CustomEncodeLabel, $GUI_SHOW)
                GUICtrlSetState($ContainerTypeHelp, $GUI_SHOW)
                GUICtrlSetState($ContainerTypeCombo, $GUI_SHOW)
                GUICtrlSetState($ContainerTypeLabel, $GUI_SHOW)
                GUICtrlSetState($AudioTypeHelp, $GUI_SHOW)
                GUICtrlSetState($AudioTypeCombo, $GUI_SHOW)
                GUICtrlSetState($AudioTypeLabel, $GUI_SHOW)
                GUICtrlSetState($VideoTypeHelp, $GUI_SHOW)
                GUICtrlSetState($VideoTypeCombo, $GUI_SHOW)
                GUICtrlSetState($VideoTypeLabel, $GUI_SHOW)
                GUICtrlSetState($EncodePresetHelp, $GUI_SHOW)
                GUICtrlSetState($EncodePresetCombo, $GUI_SHOW)
                GUICtrlSetState($EncodePresetLabel, $GUI_SHOW)

        EndSwitch
    EndIf
    ;$CurrEncodePresetComboSelect = "" ; Move this to outside the loop <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    $EncodePresetComboSelect = GUICtrlRead($EncodePresetCombo)
    If $EncodePresetComboSelect <> $CurrEncodePresetComboSelect And _GUICtrlComboBox_GetDroppedState($EncodePresetCombo) = False Then
        $CurrEncodePresetComboSelect = $EncodePresetComboSelect

        Switch $EncodePresetComboSelect
            Case "Universal"
                IniWrite($Configure, "Encode Preset", "Key", $EncodePresetComboSelect)
                IniWrite($Configure, "Encode Ext", "Key", ".mp4")
                Set_Encode_Tab_Controls($GUI_HIDE) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< easier on the typing fingers!
            Case "iPod"
                IniWrite($Configure, "Encode Preset", "Key", $EncodePresetComboSelect)
                IniWrite($Configure, "Encode Ext", "Key", ".mp4")
                GUICtrlSetState($CustomEncodeHelp, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeInput, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeLabel, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeHelp, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeCombo, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeLabel, $GUI_HIDE)
                GUICtrlSetState($AudioTypeHelp, $GUI_HIDE)
                GUICtrlSetState($AudioTypeCombo, $GUI_HIDE)
                GUICtrlSetState($AudioTypeLabel, $GUI_HIDE)
                GUICtrlSetState($VideoTypeHelp, $GUI_HIDE)
                GUICtrlSetState($VideoTypeCombo, $GUI_HIDE)
                GUICtrlSetState($VideoTypeLabel, $GUI_HIDE)
            Case "iPhone & iPod Touch"
                IniWrite($Configure, "Encode Preset", "Key", $EncodePresetComboSelect)
                IniWrite($Configure, "Encode Ext", "Key", ".mp4")
                GUICtrlSetState($CustomEncodeHelp, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeInput, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeLabel, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeHelp, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeCombo, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeLabel, $GUI_HIDE)
                GUICtrlSetState($AudioTypeHelp, $GUI_HIDE)
                GUICtrlSetState($AudioTypeCombo, $GUI_HIDE)
                GUICtrlSetState($AudioTypeLabel, $GUI_HIDE)
                GUICtrlSetState($VideoTypeHelp, $GUI_HIDE)
                GUICtrlSetState($VideoTypeCombo, $GUI_HIDE)
                GUICtrlSetState($VideoTypeLabel, $GUI_HIDE)
            Case "AppleTV"
                IniWrite($Configure, "Encode Preset", "Key", $EncodePresetComboSelect)
                IniWrite($Configure, "Encode Ext", "Key", ".mp4")
                GUICtrlSetState($CustomEncodeHelp, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeInput, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeLabel, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeHelp, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeCombo, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeLabel, $GUI_HIDE)
                GUICtrlSetState($AudioTypeHelp, $GUI_HIDE)
                GUICtrlSetState($AudioTypeCombo, $GUI_HIDE)
                GUICtrlSetState($AudioTypeLabel, $GUI_HIDE)
                GUICtrlSetState($VideoTypeHelp, $GUI_HIDE)
                GUICtrlSetState($VideoTypeCombo, $GUI_HIDE)
                GUICtrlSetState($VideoTypeLabel, $GUI_HIDE)
            Case "Normal"
                IniWrite($Configure, "Encode Preset", "Key", $EncodePresetComboSelect)
                IniWrite($Configure, "Encode Ext", "Key", ".mp4")
                GUICtrlSetState($CustomEncodeHelp, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeInput, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeLabel, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeHelp, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeCombo, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeLabel, $GUI_HIDE)
                GUICtrlSetState($AudioTypeHelp, $GUI_HIDE)
                GUICtrlSetState($AudioTypeCombo, $GUI_HIDE)
                GUICtrlSetState($AudioTypeLabel, $GUI_HIDE)
                GUICtrlSetState($VideoTypeHelp, $GUI_HIDE)
                GUICtrlSetState($VideoTypeCombo, $GUI_HIDE)
                GUICtrlSetState($VideoTypeLabel, $GUI_HIDE)
            Case "High Profile"
                IniWrite($Configure, "Encode Preset", "Key", $EncodePresetComboSelect)
                IniWrite($Configure, "Encode Ext", "Key", ".mp4")
                GUICtrlSetState($CustomEncodeHelp, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeInput, $GUI_HIDE)
                GUICtrlSetState($CustomEncodeLabel, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeHelp, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeCombo, $GUI_HIDE)
                GUICtrlSetState($ContainerTypeLabel, $GUI_HIDE)
                GUICtrlSetState($AudioTypeHelp, $GUI_HIDE)
                GUICtrlSetState($AudioTypeCombo, $GUI_HIDE)
                GUICtrlSetState($AudioTypeLabel, $GUI_HIDE)
                GUICtrlSetState($VideoTypeHelp, $GUI_HIDE)
                GUICtrlSetState($VideoTypeCombo, $GUI_HIDE)
                GUICtrlSetState($VideoTypeLabel, $GUI_HIDE)
            Case "Custom"
                IniWrite($Configure, "Encode Preset", "Key", $EncodePresetComboSelect)
                Set_Encode_Tab_Controls($GUI_SHOW)
        EndSwitch
    EndIf
WEnd

Func Set_Encode_Tab_Controls($iState)
    GUICtrlSetState($CustomEncodeHelp, $iState)
    GUICtrlSetState($CustomEncodeInput, $iState)
    GUICtrlSetState($CustomEncodeLabel, $iState)
    GUICtrlSetState($ContainerTypeHelp, $iState)
    GUICtrlSetState($ContainerTypeCombo, $iState)
    GUICtrlSetState($ContainerTypeLabel, $iState)
    GUICtrlSetState($AudioTypeHelp, $iState)
    GUICtrlSetState($AudioTypeCombo, $iState)
    GUICtrlSetState($AudioTypeLabel, $iState)
    GUICtrlSetState($VideoTypeHelp, $iState)
    GUICtrlSetState($VideoTypeCombo, $iState)
    GUICtrlSetState($VideoTypeLabel, $iState)
EndFunc

You will see I have added a short function at the end to set the state of the various controls on the Transcode tab and I have altered the Universal and Custom cases to show how to call it. It will save a bit of wear and tear on the typing fingers - I leave it to you to change the other cases. By the way, there is no "Custom" case in the combo - you might like to add it. B)

I hope this helps.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...