Jump to content

Creating a multi select list


boeinguy2
 Share

Recommended Posts

I assume that this is simple, I just can't find the right reference to a state variable taht allows for multiple selecting items in a list box.

I have a process built that will work with one file at a time, but I want to process multiple files based on the selection form a list box. The list box is currently populated with tall the files in a folder, but I can select only one item at a time.

Please point me in the right direction.

:)

Link to comment
Share on other sites

I assume that this is simple, I just can't find the right reference to a state variable taht allows for multiple selecting items in a list box.

I have a process built that will work with one file at a time, but I want to process multiple files based on the selection form a list box. The list box is currently populated with tall the files in a folder, but I can select only one item at a time.

Please point me in the right direction.

:)

You need to have the style $LBS_MULTIPLESEL included. Look in GuiListBox.au3.

If you try the example for _GUICtrlListBox_Create and change the line for the ListBox creation to this

$hListBox = _GUICtrlListBox_Create($hGUI, "String upon creation", 2, 2, 396, 296,BitOr($LBS_SORT, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER, $LBS_MULTIPLESEL))

you will be able to select more than one item. Then you need something like _GUICtrlListBox_GetSelItems to find the selected items.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

You need to have the style $LBS_MULTIPLESEL included. Look in GuiListBox.au3.

If you try the example for _GUICtrlListBox_Create and change the line for the ListBox creation to this

$hListBox = _GUICtrlListBox_Create($hGUI, "String upon creation", 2, 2, 396, 296,BitOr($LBS_SORT, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER, $LBS_MULTIPLESEL))

you will be able to select more than one item. Then you need something like _GUICtrlListBox_GetSelItems to find the selected items.

Thanks Martin!

Can you help me understand the difference between _GUICtrlListBox_Create ( tho one you pointed me to) and GUICtrlCreateList (the one that I used). I found the later in the online help found here: http://dundats.mvps.org/help/ under 'GUI Control Creation'. I just found the one you referred to under 'User Defined Functions\GUI ListBox management'.

Why are there two different ways to creat the GUI Controls?

Edited by boeinguy2
Link to comment
Share on other sites

So after setting this up, I have a small problem. I cannot figure out how respond to selections in the List Box. Unlike the single selection box, which I could read the results of the GuiGetMsg, I am getting no response to a selection whether one or more items in the List box set up by _GUICtrlListBox_Create with the $LB_ExtendedSel parameter set.

What am I doing wrong?

I would post the code, but I would need to clean it up since I have inserted Message Boxes all over the place to read variable contents at different actions.

I can try to post it later if necessary.

Link to comment
Share on other sites

So after setting this up, I have a small problem. I cannot figure out how respond to selections in the List Box. Unlike the single selection box, which I could read the results of the GuiGetMsg, I am getting no response to a selection whether one or more items in the List box set up by _GUICtrlListBox_Create with the $LB_ExtendedSel parameter set.

What am I doing wrong?

I would post the code, but I would need to clean it up since I have inserted Message Boxes all over the place to read variable contents at different actions.

I can try to post it later if necessary.

Have you tried the functoion _GUICtrlListBox_GetSelItems that I mentioned?

The difference is (I think) that the _GuiCtrlListBox_Create has more advanced features and capabilities.

BTW, a bit late but welcome to the AutoIt forums :)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Actually I tried that function and the _GUICtrlListBox_GetSelItemsText. Am I expecting the wrong thig?

When I first set the process up I looked at processing one file at a time. When the list was only single select, control was passed to the appropriate Case in the While loop. But with multiple selection, control is not passed in the same way. I am not sure if it should or if multiple select makes it work in a different way.

Link to comment
Share on other sites

So here is my code. I want to create a list of .flv files from a specified folder, then submit the list to a transcoding process. I cannot figure out how to read multiple selections. (The base file was one of the example files).

; AutoIt 3.0.103 example
; 17 Jan 2005 - CyberSlug
; This script shows manual positioning of all controls;
;   there are much better methods of positioning...

#AutoIt3Wrapper_run_debug_mode=Y

#include <GuiConstantsEx.au3>
#include <AVIConstants.au3>
#include <TreeViewConstants.au3>
#include <GUIListBox.au3>
#include <Constants.au3>
#include <ListBoxConstants.au3>
#include <WindowsConstants.au3>

; Set Variants
Global $FPS, $file, $output, $hGUI, $sItems, $aItems, $testthis

; Create GUI
$hGUI=GuiCreate("FLV Processing", 350, 400)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)


; MENU
GuiCtrlCreateMenu("Menu&One")
GuiCtrlCreateMenu("Menu&Two")

; CONTEXT MENU
$contextMenu = GuiCtrlCreateContextMenu()
GuiCtrlCreateMenuItem("Context Menu", $contextMenu)
GuiCtrlCreateMenuItem("", $contextMenu);separator
GuiCtrlCreateMenuItem("&Properties", $contextMenu)

; PROGRESS
GuiCtrlCreateProgress(10, 275, 150, 20)
GuiCtrlSetData(-1, 10)
GuiCtrlCreateLabel("Progress:", 10, 250)

; Create LISTBOX
$hListBox = _GUICtrlListBox_Create($hGUI, "String upon creation", 10, 30, 300, 90,BitOr($LBS_SORT, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER, $LBS_ExtendedSEL, $LBS_HASSTRINGS))
;_GUICtrlListBox_Create($hWnd, $sText, $iX, $iY[, $iWidth = 100[, $iHeight = 200[, $iStyle = 0x00B00002[, $iExStyle = 0x00000200]]]])
;$hListBox=GuiCtrlCreateList("", 10, 30, 300, 90)
; Add files
    _GUICtrlListBox_BeginUpdate($hListBox)
    _GUICtrlListBox_ResetContent($hListBox)
    _GUICtrlListBox_InitStorage($hListBox, 100, 4096)
    _GUICtrlListBox_Dir($hListBox, "C:\h264\*.*")
    _GUICtrlListBox_EndUpdate($hListBox)
    MsgBox(0,"","HListBox COntains " & $hListBox & ".") 
    MsgBox(0,"","There are " & _GUICtrlListBox_GetCount($hListBox) & " items in this list.")
    $aItems = _GUICtrlListBox_GetSelItemsText($hListBox)
    MsgBox(0, "Information", "Items Selected: " & $aItems[0])
            ;For $iI = 1 To $aItems[0]
            ;   $sItems &= @LF & $aItems[$iI]
            ;MsgBox(1, "Information", "Items Selected: " & $sItems)
            ;Next

GuiCtrlCreateLabel("File List To Process", 10, 10)

; GROUP WITH RADIO BUTTONS
GuiCtrlCreateGroup("Frames Per Second for files to be processed", 10, 120, 225, 100)
    $hRadio1=GuiCtrlCreateRadio("23.976", 15, 140, 80)
        GuiCtrlSetState(-1, $GUI_CHECKED)
        $FPS = 23.976
    $hRadio2=GuiCtrlCreateRadio("29.97", 15, 165, 80)
    $hRadio3=GuiCtrlCreateRadio("30", 15, 190, 80)
GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

; BUTTON
$hButton=GuiCtrlCreateButton("GO!", 10, 330, 100, 30)

; GUI MESSAGE LOOP
GuiSetState()
While 1
    $guimsg=GuiGetMsg()
;MsgBox(4160, "Information", "Gui Selected: " & $guimsg)
    Select $guimsg
        Case $guimsg = $hButton
            _ProcessVideos($file, $FPS, $output)
            MsgBox(0,"","You Chose " & GUICtrlRead($hListBox) & ".")
        Case $guimsg = $hListBox
            $testthis=_GUICtrlListBox_GetSelCount($hListBox)
            MsgBox(0,"","You Chose " & $testthis & "items.")
            $aItems = GUICtrlRead($hListBox)
                MsgBox(0, "Information", "Items Selected: " & $aItems[0])
            ;For $iI = 1 To $aItems[0]
            ;   $sItems &= @LF & $aItems[$iI]
            ;MsgBox(4160, "Information", "Items Selected: " & $sItems)
            ;Next
            ;MsgBox(4160, "Information", "Items Selected: " & $sItems)
        ;$file = GUICtrlRead($hListBox)
        ;$NameLength = StringLen($file)-4
        ;$output = StringLeft($file, $NameLength)
        Case $guimsg = $hRadio1
            $FPS = 23.976
            MsgBox(0,"","You Chose " & $FPS & ".")
        Case $guimsg = $hRadio2
            $FPS = 29.97
            MsgBox(0,"","You Chose " & $FPS & ".")
        Case $guimsg = $hRadio3
            $FPS = 30.00
            MsgBox(0,"","You Chose " & $FPS & ".")
        Case $guimsg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Func _ProcessVideos($a, $b, $c)
;MsgBox(0,"",'C:\h264\ffmpeg.exe -i "' & $a & '" -vcodec copy -acodec copy "temp.mp4"')
    RunWait('C:\h264\ffmpeg.exe -i "' & $a & '" -vcodec copy -acodec copy "temp.mp4"', "C:\h264", @SW_HIDE)
    RunWait('C:\h264\mp4box.exe -raw 1 "temp.mp4"', "C:\h264", @SW_HIDE)
    RunWait('C:\h264\mp4box.exe -raw 2 "temp.mp4"', "C:\h264", @SW_HIDE)
    RunWait('C:\h264\mp4box.exe -add "temp_track1.h264:fps=' & $b & '" -add "temp_track2.aac" ' & $c & '.mp4', "C:\h264", @SW_HIDE)
    FileDelete('C:\h264\temp.mp4')
    FileDelete('C:\h264\temp_track1.h264')
    FileDelete('C:\h264\temp_track2.aac')
    MsgBox(0,"","You have completed processing Videos.")
    Return
EndFunc
Edited by boeinguy2
Link to comment
Share on other sites

Actually I tried that function and the _GUICtrlListBox_GetSelItemsText. Am I expecting the wrong thig?

When I first set the process up I looked at processing one file at a time. When the list was only single select, control was passed to the appropriate Case in the While loop. But with multiple selection, control is not passed in the same way. I am not sure if it should or if multiple select makes it work in a different way.

You are referring to a script that I can't see, but maybe this helps

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
 #include <GUIListBox.au3>
 #include <GuiConstantsEx.au3>
 #include <WindowsConstants.au3>
 #include <Constants.au3>
 
 Opt('MustDeclareVars', 1)
 
 $Debug_LB = False; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work
 
 Global $hListBox
 HotKeySet("{F10}", "ShowSel")
 _Main()
 
 Func _Main()
     Local $hGUI
 
   ; Create GUI
     $hGUI = GUICreate("(UDF Created) List Box Create", 400, 296)
     $hListBox = _GUICtrlListBox_Create($hGUI, "String upon creation", 2, 2, 396, 296, BitOR($LBS_SORT, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER, $LBS_MULTIPLESEL))
     GUISetState()
 
     MsgBox(4160, "Information", "Adding Items")
 
     GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
 
   ; Add files
     _GUICtrlListBox_BeginUpdate($hListBox)
     _GUICtrlListBox_ResetContent($hListBox)
     _GUICtrlListBox_InitStorage($hListBox, 100, 4096)
     _GUICtrlListBox_Dir($hListBox, @WindowsDir & "\win*.exe")
     _GUICtrlListBox_AddFile($hListBox, @WindowsDir & "\Notepad.exe")
     _GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES)
     _GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES, False)
     _GUICtrlListBox_EndUpdate($hListBox)
     MsgBox(262144, "To see the items selected", "Hit F10")
   ; Loop until user exits
     Do
     Until GUIGetMsg() = $GUI_EVENT_CLOSE
 EndFunc ;==>_Main
 
 Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
     #forceref $hWnd, $iMsg
     Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
     If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox)
     $hWndFrom = $ilParam
     $iIDFrom = BitAND($iwParam, 0xFFFF); Low Word
     $iCode = BitShift($iwParam, 16); Hi Word
 
     Switch $hWndFrom
         Case $hListBox, $hWndListBox
             Switch $iCode
                 Case $LBN_DBLCLK; Sent when the user double-clicks a string in a list box
                     _DebugPrint("$LBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                             "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                             "-->Code:" & @TAB & $iCode)
                   ; no return value
                 Case $LBN_ERRSPACE; Sent when a list box cannot allocate enough memory to meet a specific request
                     _DebugPrint("$LBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                             "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                             "-->Code:" & @TAB & $iCode)
                   ; no return value
                 Case $LBN_KILLFOCUS; Sent when a list box loses the keyboard focus
                     _DebugPrint("$LBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                             "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                             "-->Code:" & @TAB & $iCode)
                   ; no return value
                 Case $LBN_SELCANCEL; Sent when the user cancels the selection in a list box
                     _DebugPrint("$LBN_SELCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                             "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                             "-->Code:" & @TAB & $iCode)
                   ; no return value
                 Case $LBN_SELCHANGE; Sent when the selection in a list box has changed
                     _DebugPrint("$LBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                             "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                             "-->Code:" & @TAB & $iCode)
                   ; no return value
                 Case $LBN_SETFOCUS; Sent when a list box receives the keyboard focus
                     _DebugPrint("$LBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                             "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                             "-->Code:" & @TAB & $iCode)
                   ; no return value
             EndSwitch
     EndSwitch
   ; Proceed the default Autoit3 internal message commands.
   ; You also can complete let the line out.
   ; !!! But only 'Return' (without any value) will not proceed
   ; the default Autoit3-message in the future !!!
     Return $GUI_RUNDEFMSG
 EndFunc ;==>WM_COMMAND
 
 Func _DebugPrint($s_text)
     $s_text = StringReplace($s_text, @LF, @LF & "-->")
     ConsoleWrite("!===========================================================" & @LF & _
             "+===========================================================" & @LF & _
             "-->" & $s_text & @LF & _
             "+===========================================================" & @LF)
 EndFunc ;==>_DebugPrint
 
 
 Func ShowSel()
     Local $say, $sel = _GUICtrlListBox_GetSelItems($hListBox)
     If $sel[0] = 0 Then
         $say = "No items selected"
     Else
         For $n = 1 To $sel[0]
             $say &= $sel[$n] & ', '
         Next
         $say = StringLeft($say, StringLen($say) - 2)
     EndIf
     
     MsgBox(262144, "items selected = ", $say)
 
 
 EndFunc ;==>ShowSel

EDIT: Your code was posted while I was writing that so I'll look at it now.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I think you were very close. I just changed your select to switch because for some reason I couldn't see I had an error with the select.

Try the GO button to see the part I changed.

; AutoIt 3.0.103 example
; 17 Jan 2005 - CyberSlug
; This script shows manual positioning of all controls;
;   there are much better methods of positioning...

#AutoIt3Wrapper_Run_Debug_Mode=n

#include <GuiConstantsEx.au3>
#include <AVIConstants.au3>
#include <TreeViewConstants.au3>
#include <GUIListBox.au3>
#include <Constants.au3>
#include <ListBoxConstants.au3>
#include <WindowsConstants.au3>

; Set Variants
Global $FPS, $file, $output, $hGUI, $sItems, $aItems, $testthis

; Create GUI
$hGUI = GUICreate("FLV Processing", 350, 400)
GUISetIcon(@SystemDir & "\mspaint.exe", 0)


; MENU
GUICtrlCreateMenu("Menu&One")
GUICtrlCreateMenu("Menu&Two")

; CONTEXT MENU
$contextMenu = GUICtrlCreateContextMenu()
GUICtrlCreateMenuItem("Context Menu", $contextMenu)
GUICtrlCreateMenuItem("", $contextMenu);separator
GUICtrlCreateMenuItem("&Properties", $contextMenu)

; PROGRESS
GUICtrlCreateProgress(10, 275, 150, 20)
GUICtrlSetData(-1, 10)
GUICtrlCreateLabel("Progress:", 10, 250)

; Create LISTBOX
$hListBox = _GUICtrlListBox_Create($hGUI, "String upon creation", 10, 30, 300, 90, BitOR($LBS_SORT, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER, $LBS_HASSTRINGS, $LBS_MULTIPLESEL));BitOR($LBS_SORT, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER, $LBS_ExtendedSEL, $LBS_HASSTRINGS, $LBS_MULTIPLESEL))
;_GUICtrlListBox_Create($hWnd, $sText, $iX, $iY[, $iWidth = 100[, $iHeight = 200[, $iStyle = 0x00B00002[, $iExStyle = 0x00000200]]]])
;$hListBox=GuiCtrlCreateList("", 10, 30, 300, 90)
; Add files
_GUICtrlListBox_BeginUpdate($hListBox)
_GUICtrlListBox_ResetContent($hListBox)
_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
_GUICtrlListBox_Dir($hListBox, "C:\h264\*.*")
_GUICtrlListBox_EndUpdate($hListBox)
MsgBox(0, "", "HListBox COntains " & $hListBox & ".")
MsgBox(0, "", "There are " & _GUICtrlListBox_GetCount($hListBox) & " items in this list.")
$aItems = _GUICtrlListBox_GetSelItemsText($hListBox)
MsgBox(0, "Information", "Items Selected: " & $aItems[0])
;For $iI = 1 To $aItems[0]
;   $sItems &= @LF & $aItems[$iI]
;MsgBox(1, "Information", "Items Selected: " & $sItems)
;Next

GUICtrlCreateLabel("File List To Process", 10, 10)

; GROUP WITH RADIO BUTTONS
GUICtrlCreateGroup("Frames Per Second for files to be processed", 10, 120, 225, 100)
$hRadio1 = GUICtrlCreateRadio("23.976", 15, 140, 80)
GUICtrlSetState(-1, $GUI_CHECKED)
$FPS = 23.976
$hRadio2 = GUICtrlCreateRadio("29.97", 15, 165, 80)
$hRadio3 = GUICtrlCreateRadio("30", 15, 190, 80)
GUICtrlCreateGroup("", -99, -99, 1, 1);close group
_GUICtrlListBox_AddString($hListBox,"one")
_GUICtrlListBox_AddString($hListBox,"two")
_GUICtrlListBox_AddString($hListBox,"three")
; BUTTON
$hButton = GUICtrlCreateButton("GO!", 10, 330, 100, 30)

; GUI MESSAGE LOOP
GUISetState()
While 1
    $guimsg = GUIGetMsg()
   ;MsgBox(4160, "Information", "Gui Selected: " & $guimsg)
   switch $guimsg
        Case $hButton;$guimsg; = 
            _ProcessVideos($file, $FPS, $output)

            $testthis = _GUICtrlListBox_GetSelItems($hListBox)
            MsgBox(0, "", "You Chose " & $testthis[0] & " items.")
            $sItems = ''
            For $iI = 1 To $testthis[0]
                $sItems &= @CR & $testthis[$iI] & ', ' & _GUICtrlListBox_GetText($hListBox,$testthis[$iI])
            Next
            MsgBox(4160, "Information", "Item Numbers Selected: " & $sItems)
        Case $hRadio1
            $FPS = 23.976
            MsgBox(0, "", "You Chose " & $FPS & ".")
        Case $hRadio2
            $FPS = 29.97
            MsgBox(0, "", "You Chose " & $FPS & ".")
        Case $hRadio3
            $FPS = 30.00
            MsgBox(0, "", "You Chose " & $FPS & ".")
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _ProcessVideos($a, $b, $c)
   ;MsgBox(0,"",'C:\h264\ffmpeg.exe -i "' & $a & '" -vcodec copy -acodec copy "temp.mp4"')
    RunWait('C:\h264\ffmpeg.exe -i "' & $a & '" -vcodec copy -acodec copy "temp.mp4"', "C:\h264", @SW_HIDE)
    RunWait('C:\h264\mp4box.exe -raw 1 "temp.mp4"', "C:\h264", @SW_HIDE)
    RunWait('C:\h264\mp4box.exe -raw 2 "temp.mp4"', "C:\h264", @SW_HIDE)
    RunWait('C:\h264\mp4box.exe -add "temp_track1.h264:fps=' & $b & '" -add "temp_track2.aac" ' & $c & '.mp4', "C:\h264", @SW_HIDE)
    FileDelete('C:\h264\temp.mp4')
    FileDelete('C:\h264\temp_track1.h264')
    FileDelete('C:\h264\temp_track2.aac')
    MsgBox(0, "", "You have completed processing Videos.")
    Return
EndFunc  ;==>_ProcessVideos
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

So I tried the code with your additions, and it certainly is closer. But why did your changes make a difference?

_GUICtrlListBox_AddString($hListBox,"one") - what does this do? Isn't the list already populated?

You'll have to see what is different between what I did and what you did to see why it made a difference.

Nothing in the list when I ran your code so I added some items, but I should have just changed this line

_GUICtrlListBox_Dir($hListBox, "C:\h264\*.*")

to some folder that exists on my PC.

The code you posted doesn't run because you had this line

Select $guimsg

which should be just

Select

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

towards the other question:

Can you help me understand the difference between _GUICtrlListBox_Create ( tho one you pointed me to) and GUICtrlCreateList (the one that I used).

you can use both equally. you can use all _GUICtrlListBox_... functions as well with GUICtrlCreateList. all constants and messages are the same. there is no fundamental difference, as far as i can see.

j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

You'll have to see what is different between what I did and what you did to see why it made a difference.

Nothing in the list when I ran your code so I added some items, but I should have just changed this line

_GUICtrlListBox_Dir($hListBox, "C:\h264\*.*")

to some folder that exists on my PC.

The code you posted doesn't run because you had this line

Select $guimsg

which should be just

Select

Thanks. This was a helpful explanation.

Link to comment
Share on other sites

towards the other question:

you can use both equally. you can use all _GUICtrlListBox_... functions as well with GUICtrlCreateList. all constants and messages are the same. there is no fundamental difference, as far as i can see.

j.

Except that I did not see $LB_MultipleSel documented for GUICrtlCreateList.

Link to comment
Share on other sites

not documented, but working, too.

i would expect that some day they will extinguish all the "old" GuiCtrlCreate... things. so better get used to the newer functions. i don't think they will survive the end of this year.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

So the app will process multiple files. Now I am trying to extend the app to allow the ffmpeg/mp4box tools to be in a user defined location and the working directory to be user selected.

I have set two variables that contain the path for each. Now I am trying to add these variables to the calls for ffmpeg and mp4box. I am having trouble quoting the variables to get the right string:

Func _ProcessVideos($a, $b, $c, $d, $e)

Local $VAR_1

$VAR_1 = $e & '\ffmpeg.exe -i'

RunWait(''$VAR_1 & "" & $a & "" -vcodec copy -acodec copy "temp.mp4"', '"' & $d & '"', @SW_MAXIMIZE)

;RunWait('C:\h264\ffmpeg.exe -i "' & $a & '" -vcodec copy -acodec copy "temp.mp4"', "C:\h264", @SW_HIDE)

MsgBox(0, "", $VAR_1)

;MsgBox(0, "", 'C:\h264\ffmpeg.exe -i "' & $a & '" -vcodec copy -acodec copy "temp.mp4"' "C:\h264")

;RunWait('"' & $e & '\mp4box.exe -raw 1 "temp.mp4"', '"' & $d & '"', @SW_MAXIMIZE)

;RunWait('"' & $e & '\mp4box.exe -raw 2 "temp.mp4"', '"' & $d & '"', @SW_MAXIMIZE)

;RunWait('"' & $e & '\mp4box.exe -add "temp_track1.h264:fps=' & $b & '" -add "temp_track2.aac" "' & $c & '.mp4"', '"' & $d & '"', @SW_MAXIMIZE)

;FileDelete('"' & $d & '\temp.mp4')

;FileDelete('"' & $d & '\temp_track1.h264')

;FileDelete('"' & $d & '\temp_track2.aac')

MsgBox(0, "", "You have completed processing Videos.")

Return

EndFunc ;==>_ProcessVideos

Particularly, this line works:

RunWait('C:\h264\ffmpeg.exe -i "' & $a & '" -vcodec copy -acodec copy "temp.mp4"', "C:\h264", @SW_HIDE)

This is the line where I m trying to substitute variables into the previous line

Local $VAR_1

$VAR_1 = $e & '\ffmpeg.exe -i'

RunWait(''$VAR_1 & "" & $a & "" -vcodec copy -acodec copy "temp.mp4"', '"' & $d & '"', @SW_MAXIMIZE)

$e is the path to the ffmpeg tools and $d is the path to the working directory. In this case

$d = F:\video\processing

$e = C:\h264

The use of $VAR_1 was one effort to fix the problem. I cannot get the quoting correct to reproduce the previous line

Thanks for the help.

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...