rockscena Posted August 9, 2012 Share Posted August 9, 2012 hey guyz, I am new in this community , As My query is i have created a window which will be having Combo Box which will be activated when a checkbox is checked , then i have already listed the files with extension from a folder view using _GUICtrlComboBox_BeginUpdate($VDID_1) _GUICtrlComboBox_AddDir($VDID_1, $dir1 & "\*.SCP") _GUICtrlComboBox_AddDir($VDID_1, $dir2 & "\*.SCP") _GUICtrlComboBox_AddDir($VDID_1, $dir3 & "\*.SCP") _GUICtrlComboBox_EndUpdate($VDID_1) after that , i want that when i select the file the file location should be copied in variable say some $xyz , let me clear this like this teher are 3 more checkboxes and Combo Box .... so i want all those 4 selected full file location to be copied. and can be read in next process of executing statement. Thanks & Regards, G6 randallwvosh 1 Link to comment Share on other sites More sharing options...
abberration Posted August 9, 2012 Share Posted August 9, 2012 Welcome to the forums! I think what you need is GuiCtrlRead for each of the the checkboxes and the combobox. Make sure your checkboxes and comboboxes are assigned a variable (in the case below, it is assigned $myComboBox). $xyz = GuiCtrlRead($myComboBox) Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
rockscena Posted August 9, 2012 Author Share Posted August 9, 2012 Sorry i didnt add 1 more thing i have added 3 directories to update in Combo box , if the file is chosen in combobox locates in $dir2 then how it will locate ? i need the file location to be done like this Open File Dialog Box, then it will send the Keystrokes "<location of the file>.scp" Besides this How to make the Settings Work after when i press button Run Script Thanks for Quick response ! Link to comment Share on other sites More sharing options...
rover Posted August 9, 2012 Share Posted August 9, 2012 (edited) Another one of the many IP.Board forum software post upgrade glitches was just fixed by Jon, now post editing works again. Thank You Jon Back to where I started... if the file is chosen in combobox locates in $dir2 then how it will locate ? @rockscena This example shows how to add files from different source folders and retrieve the source folder path for the selected ComboBox item. Stores or retrieves array element index values in the user data element of an item in the internal dropdown menu ComboLBox child control of a ComboBox. Adding files from different source folders to the ComboBox: Store the source folder path for the added ComboBox item file name in a source folder array. Store the index of the source folder array element for that item in the ComboBox item ListBox user data. Reading file names and source folders from the ComboBox: Read the selected ComboBox items filename and get the source folder array element index from the ComboBox items ListBox data. Concatenate the source folder array path name to the filename. modify to your needs expandcollapse popup;coded by rover 2k12 #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> #include <File.au3> #include <GuiListBox.au3> #include <Array.au3> _Main() Func _Main() Local $hCombo, $hCmbList, $cFilePath, $sFilePath, $aSrcFolder[1] = [0] ;source folder array intialized with a single element GUICreate("ComboBox Add Dir", 400, 296) $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) $cFilePath = GUICtrlCreateLabel("", 2, 50, 396, 80) GUISetState() Local $Wow64 = "" If @AutoItX64 Then $Wow64 = "Wow6432Node" Local $sPath = RegRead("HKEY_LOCAL_MACHINESOFTWARE" & $Wow64 & "AutoIt v3AutoIt", "InstallDir") ;_FileListToArray() is non-recursive and retrieves only single folder level depth ;or use one of the many recursive folder functions* on the forum (NOTE: _AddFolder() must be modified if file count is not stored in array element 0) ;*look for Melba23's recursive function in the examples forum or get the link in the sig of any of his posts. $FileList = _FileListToArray($sPath, "*.exe", 1) If @error = 1 Or @error = 4 Then Exit MsgBox(0, "", "Folders Not Found or No Files Found.") _AddFolder($hCombo, $hCmbList, $aSrcFolder, $FileList, $sPath) ;_ArrayDisplay($FileList, "$FileList") Local $FileList = _FileListToArray(@WindowsDir, "*.exe", 1) If @error = 1 Or @error = 4 Then Exit MsgBox(0, "", "Folders Not Found or No Files Found.") _AddFolder($hCombo, $hCmbList, $aSrcFolder, $FileList, @WindowsDir) ;_ArrayDisplay($FileList, "$FileList") $FileList = _FileListToArray(@SystemDir, "*.exe", 1) If @error = 1 Or @error = 4 Then Exit MsgBox(0, "", "Folders Not Found or No Files Found.") _AddFolder($hCombo, $hCmbList, $aSrcFolder, $FileList, @SystemDir) ;_ArrayDisplay($FileList, "$FileList") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $hCombo ;select a combo item and the full path is written to label and console $sFilePath = _GetFile($hCombo, $hCmbList, $aSrcFolder) If $sFilePath == "" Then ConsoleWrite("This ComboBox item does not have ListBox user data" & @CRLF) GUICtrlSetData($cFilePath, "This ComboBox item does not have ListBox user data") Else ConsoleWrite("File = " & $sFilePath & @CRLF) GUICtrlSetData($cFilePath, "File = " & $sFilePath) EndIf EndSwitch WEnd EndFunc ;==>_Main Func _AddFolder($cCombo, ByRef $hList, ByRef $aSrc, ByRef $aFiles, $sPath) ;coded by rover 2k12 Local $tInfo, $iIdx _GUICtrlComboBox_GetComboBoxInfo($cCombo, $tInfo) $hList = DllStructGetData($tInfo, "hList") If _WinAPI_GetClassName($hList) <> "ComboLBox" Then Return -1 ;verify returned handle is a valid handle and is the handle to the ComboBoxes internal ListBox control (the dropdown menu) ;Add source folder to array and store 1 based index in ListBox user data (default value in unused ListBox item data is 0, using a 1 based index allows unambiguous ListBox userdata validation) Local $iX = UBound($aSrc) If @error Or $iX < 1 Then Return -2 ; not array unless 1 or more ReDim $aSrc[$iX+1] ;resize array, add 1 element, now 2 or more $aSrc[$iX] = $sPath ;ignore first element, fill array element 1 or more with source folder name For $i = 1 To $aFiles[0] ;add file names and source folder array index to a new ComboBox item GUICtrlSendMsg($cCombo, $CB_INSERTSTRING, -1, $aFiles[$i]) ;insert a new item after the last one $iIdx = _GUICtrlComboBox_GetCount($cCombo) ;get current count of items = index of current item If @error Or $iIdx = -1 Then Return -3 _GUICtrlListBox_SetItemData($hList, $iIdx - 1, $iX) ;use a 1-based index - set to element of array with source folder for this file Next Return 1 EndFunc Func _GetFile($hWnd, $hList, ByRef $aSrc) ;coded by rover 2k12 Local $iIdx = _GUICtrlListBox_GetItemData($hList, _GUICtrlComboBox_GetCurSel($hWnd)) ;get index of selected ComboBox item and retrieve source folder array index value from ListBox If $iIdx >= 1 Then Return $aSrc[$iIdx] & "" & GUICtrlRead($hWnd) Else ;if $iIdx is 0 then item does not have a source folder array element index value Return "" EndIf EndFunc Edited August 9, 2012 by rover I see fascists... Link to comment Share on other sites More sharing options...
rover Posted August 9, 2012 Share Posted August 9, 2012 (edited) Forum IP. Board software is ******* up again [Fixed]The editor is useless and displays in raw HTML (FireFox 14.01)I'll fix the above post later when it's sorted out...Edit: O.K. I see Jon is on site, that explains it. Will wait it out... Edited August 9, 2012 by rover I see fascists... Link to comment Share on other sites More sharing options...
abberration Posted August 9, 2012 Share Posted August 9, 2012 I'm not sure of exactly what it is you are doing. Are you wanting to open the file dialog box? If so, then try this: $file_1 = FileOpenDialog("Select your file", @DesktopDir, "SCP Files (*.scp)") Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
rover Posted August 9, 2012 Share Posted August 9, 2012 I'm not sure of exactly what it is you are doing. Are you wanting to open the file dialog box? If so, then try this: $file_1 = FileOpenDialog("Select your file", @DesktopDir, "SCP Files (*.scp)") Looks like the OP wants to paste the selected combobox items file/path from his script into the file open dialog of another program I see fascists... Link to comment Share on other sites More sharing options...
rockscena Posted August 9, 2012 Author Share Posted August 9, 2012 eXACTLYLooks like the OP wants to paste the selected combobox items file/path from his script into the file open dialog of another programHey man thanks for the Reply, and Rover u gt my point.,My scenario1.Adding Multiple folders of files in Combo Box .2.Once file selected ,after that i started the "Run Script" Button and my script Automation Started.3.Open the program as per my Automation Script then there the program has to open the file which i chose in the program's FileOpen Box and there it sends the keystrokes of the File Path including filename with extension and then it will Hit Enter.Well i can open it very nicely from 1 directory, its not challenging but having multiple files and multiple directory was creating problem. Hope it works out and i will reply Thanks,Rover 1 more thing if i want to make a scenario like this :1. Make 1 GUI2. Checkbox is checked for an option.3. when checkbox chekd then there will be another UI shows showing list of files in a Folder with checkbox option4. i will manually select the files in checkbox style and Hit oK then i want to retrieve the file path of those selected files.5. rest is same as above 1st scenario is mentioned .Thank You Guyz for your Support Regards,G6 Link to comment Share on other sites More sharing options...
rover Posted August 9, 2012 Share Posted August 9, 2012 (edited) Rover 1 more thing if i want to make a scenario like this : 1. Make 1 GUI 2. Checkbox is checked for an option. 3. when checkbox chekd then there will be another UI shows showing list of files in a Folder with checkbox option 4. i will manually select the files in checkbox style and Hit oK then i want to retrieve the file path of those selected files. 5. rest is same as above 1st scenario is mentioned . 3. Have the checkbox run a function the same way as selecting a combo item creates a messageloop or eventmode event get the checkbox state with BitAnd(GUICtrlRead($Item),$GUI_CHECKED) as shown in help file for GUICtrlRead if checked, run function with your child gui and GUICtrlCreateListView() with LVS_EX_CHECKBOXES extended style. Melba23's Wiki on launching child gui's: http://www.autoitscript.com/wiki/Managing_Multiple_GUIs 4. The forum has examples of getting checked items into an array by looping through all listview indices with_GUICtrlListView_GetItemChecked. Get filename from column0 and source folder path from subitem column1. You can hide column1 so only the files in column0 are displayed. there are examples on the forum of locking column adjustment to keep the column hidden. To do the same thing as the combo with a listview (if you don't want to display full path in the listview as a subitem, hidden or not) you will need _GUICtrlListView_SetItemParam/_GUICtrlListView_GetItemParam (listview equivalents to _GUICtrlListBox_SetItemData/_GUICtrlListBox_GetItemData) Important Note if you go this route: Only use _GUICtrlListView_AddItem, _GUICtrlListView_AddSubItem and _GUICtrlListView_InsertItem to add items to the listview. Do not use GUICtrlCreateListViewItem (AutoIt internally uses the param element of each listview item when GUICtrlCreateListViewItem is used) To delete items added with the _GUICtrlListView_* functions you must use a handle to the listview: GuiCtrlGetHandle($Listview) from $Listview = GUICtrlCreateListView() Use GUICtrlCreateListView, you don't need to use the UDF listview, just don't use GUICtrlCreateListViewItem to add items. There are example of SetItemParam/GetItemParam on the forum. Most listview questions are already answered on the forum. I've made the combo functions in the previous post a little more user friendly and removed the need for a global listbox handle. expandcollapse popup;coded by rover 2k12 #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> #include <File.au3> #include <GuiListBox.au3> #include <Array.au3> _Main() Func _Main() Local $cCombo1, $cCombo2, $cFilePath1, $cFilePath2, $sFilePath1, $sFilePath2, $aSrcFolder[1] = [0] ;source folder array intialized with a single element GUICreate("ComboBox Add Dir", 400, 296) $cCombo1 = GUICtrlCreateCombo("", 2, 2, 396, 296) $cCombo2 = GUICtrlCreateCombo("", 2, 50, 396, 296) $cFilePath1 = GUICtrlCreateLabel("", 2, 80, 396, 80) $cFilePath2 = GUICtrlCreateLabel("", 2, 110, 396, 80) GUISetState() Local $Wow64 = "" If @AutoItX64 Then $Wow64 = "Wow6432Node" Local $sPath = RegRead("HKEY_LOCAL_MACHINESOFTWARE" & $Wow64 & "AutoIt v3AutoIt", "InstallDir") ;_FileListToArray() is non-recursive and retrieves only single folder level depth ;or use one of the many recursive folder functions* on the forum (NOTE: _AddFolder() must be modified if file count is not stored in array element 0) ;*look for Melba23's recursive function in the examples forum or get the link in the sig of any of his posts. ;Combo 1 $FileList = _FileListToArray($sPath, "*.exe", 1) If @error = 1 Or @error = 4 Then Exit MsgBox(0, "", "Folders Not Found or No Files Found.") _AddFolder($cCombo1, $aSrcFolder, $FileList, $sPath) ;_ArrayDisplay($FileList, "$FileList") Local $FileList = _FileListToArray(@WindowsDir, "*.exe", 1) If @error = 1 Or @error = 4 Then Exit MsgBox(0, "", "Folders Not Found or No Files Found.") _AddFolder($cCombo1, $aSrcFolder, $FileList, @WindowsDir) $FileList = _FileListToArray(@SystemDir, "*.exe", 1) If @error = 1 Or @error = 4 Then Exit MsgBox(0, "", "Folders Not Found or No Files Found.") _AddFolder($cCombo1, $aSrcFolder, $FileList, @SystemDir) ;Combo 2 $FileList = _FileListToArray(@WindowsDir & "Fonts", "*.ttf", 1) If @error = 1 Or @error = 4 Then Exit MsgBox(0, "", "Folders Not Found or No Files Found.") _AddFolder($cCombo2, $aSrcFolder, $FileList, @WindowsDir & "Fonts") ;optionally deleted unneeded array $FileList = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $cCombo1;select a combo item and the full path is written to variable, label and console $sFilePath1 = _GetFile($cCombo1, $aSrcFolder) If $sFilePath1 == "" Then ConsoleWrite("This ComboBox item does not have ListBox user data" & @CRLF) GUICtrlSetData($cFilePath1, "This ComboBox item does not have ListBox user data") Else ConsoleWrite("File = " & $sFilePath1 & @CRLF) GUICtrlSetData($cFilePath1, "File = " & $sFilePath1) EndIf Case $cCombo2 ;select a combo item and the full path is written to label and console $sFilePath2 = _GetFile($cCombo2, $aSrcFolder) If $sFilePath2 == "" Then ConsoleWrite("This ComboBox item does not have ListBox user data" & @CRLF) GUICtrlSetData($cFilePath2, "This ComboBox item does not have ListBox user data") Else ConsoleWrite("File = " & $sFilePath2 & @CRLF) GUICtrlSetData($cFilePath2, "File = " & $sFilePath2) EndIf EndSwitch WEnd EndFunc ;==>_Main Func _AddFolder($hWnd, ByRef $aSrc, ByRef $aFiles, $sPath) ;coded by rover 2k12 Local $tInfo, $iIdx _GUICtrlComboBox_GetComboBoxInfo($hWnd, $tInfo) $hList = DllStructGetData($tInfo, "hList") If _WinAPI_GetClassName($hList) <> "ComboLBox" Then Return -1 ;verify returned handle is a valid handle and is the handle to the ComboBoxes internal ListBox control (the dropdown menu) ;Add source folder to array and store 1 based index in ListBox user data (default value in unused ListBox item data is 0, using a 1 based index allows unambiguous ListBox userdata validation) Local $iX = UBound($aSrc) If @error Or $iX < 1 Then Return -2 ; not array unless 1 or more ReDim $aSrc[$iX+1] ;resize array, add 1 element, now 2 or more $aSrc[$iX] = $sPath ;ignore first element, fill array element 1 or more with source folder name For $i = 1 To $aFiles[0] ;add file names and source folder array index to a new ComboBox item _GUICtrlComboBox_InsertString($hWnd, $aFiles[$i]);insert a new item after the last one $iIdx = _GUICtrlComboBox_GetCount($hWnd) ;get current count of items = index of current item If @error Or $iIdx = -1 Then Return -3 _GUICtrlListBox_SetItemData($hList, $iIdx - 1, $iX) ;use a 1-based index - set to element of array with source folder for this file Next Return 1 EndFunc Func _GetFile($hWnd, ByRef $aSrc) ;coded by rover 2k12 Local $tInfo _GUICtrlComboBox_GetComboBoxInfo($hWnd, $tInfo) Local $hList = DllStructGetData($tInfo, "hList") If _WinAPI_GetClassName($hList) <> "ComboLBox" Then Return "" ;verify returned handle is a valid handle and is the handle to the ComboBoxes internal ListBox control (the dropdown menu) Local $iIdx = _GUICtrlListBox_GetItemData($hList, _GUICtrlComboBox_GetCurSel($hWnd)) ;get index of selected ComboBox item and retrieve source folder array index value from ListBox If $iIdx >= 1 Then Return $aSrc[$iIdx] & "" & GUICtrlRead($hWnd) Else ;if $iIdx is 0 then item does not have a source folder array element index value Return "" EndIf EndFunc Edited August 9, 2012 by rover I see fascists... Link to comment Share on other sites More sharing options...
rockscena Posted August 21, 2012 Author Share Posted August 21, 2012 Hey Rover what if i need the above listview pattern with Checkboxes ? how should i declare the expression ? 3. Have the checkbox run a function the same way as selecting a combo item creates a messageloop or eventmode event get the checkbox state with BitAnd(GUICtrlRead($Item),$GUI_CHECKED) as shown in help file for GUICtrlRead if checked, run function with your child gui and GUICtrlCreateListView() with LVS_EX_CHECKBOXES extended style. Melba23's Wiki on launching child gui's: http://www.autoitscript.com/wiki/Managing_Multiple_GUIs 4. The forum has examples of getting checked items into an array by looping through all listview indices with_GUICtrlListView_GetItemChecked. Get filename from column0 and source folder path from subitem column1. You can hide column1 so only the files in column0 are displayed. there are examples on the forum of locking column adjustment to keep the column hidden. To do the same thing as the combo with a listview (if you don't want to display full path in the listview as a subitem, hidden or not) you will need _GUICtrlListView_SetItemParam/_GUICtrlListView_GetItemParam (listview equivalents to _GUICtrlListBox_SetItemData/_GUICtrlListBox_GetItemData) Important Note if you go this route: Only use _GUICtrlListView_AddItem, _GUICtrlListView_AddSubItem and _GUICtrlListView_InsertItem to add items to the listview. Do not use GUICtrlCreateListViewItem (AutoIt internally uses the param element of each listview item when GUICtrlCreateListViewItem is used) To delete items added with the _GUICtrlListView_* functions you must use a handle to the listview: GuiCtrlGetHandle($Listview) from $Listview = GUICtrlCreateListView() Use GUICtrlCreateListView, you don't need to use the UDF listview, just don't use GUICtrlCreateListViewItem to add items. There are example of SetItemParam/GetItemParam on the forum. Most listview questions are already answered on the forum. I've made the combo functions in the previous post a little more user friendly and removed the need for a global listbox handle. expandcollapse popup;coded by rover 2k12 #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> #include <File.au3> #include <GuiListBox.au3> #include <Array.au3> _Main() Func _Main() Local $cCombo1, $cCombo2, $cFilePath1, $cFilePath2, $sFilePath1, $sFilePath2, $aSrcFolder[1] = [0] ;source folder array intialized with a single element GUICreate("ComboBox Add Dir", 400, 296) $cCombo1 = GUICtrlCreateCombo("", 2, 2, 396, 296) $cCombo2 = GUICtrlCreateCombo("", 2, 50, 396, 296) $cFilePath1 = GUICtrlCreateLabel("", 2, 80, 396, 80) $cFilePath2 = GUICtrlCreateLabel("", 2, 110, 396, 80) GUISetState() Local $Wow64 = "" If @AutoItX64 Then $Wow64 = "Wow6432Node" Local $sPath = RegRead("HKEY_LOCAL_MACHINESOFTWARE" & $Wow64 & "AutoIt v3AutoIt", "InstallDir") ;_FileListToArray() is non-recursive and retrieves only single folder level depth ;or use one of the many recursive folder functions* on the forum (NOTE: _AddFolder() must be modified if file count is not stored in array element 0) ;*look for Melba23's recursive function in the examples forum or get the link in the sig of any of his posts. ;Combo 1 $FileList = _FileListToArray($sPath, "*.exe", 1) If @error = 1 Or @error = 4 Then Exit MsgBox(0, "", "Folders Not Found or No Files Found.") _AddFolder($cCombo1, $aSrcFolder, $FileList, $sPath) ;_ArrayDisplay($FileList, "$FileList") Local $FileList = _FileListToArray(@WindowsDir, "*.exe", 1) If @error = 1 Or @error = 4 Then Exit MsgBox(0, "", "Folders Not Found or No Files Found.") _AddFolder($cCombo1, $aSrcFolder, $FileList, @WindowsDir) $FileList = _FileListToArray(@SystemDir, "*.exe", 1) If @error = 1 Or @error = 4 Then Exit MsgBox(0, "", "Folders Not Found or No Files Found.") _AddFolder($cCombo1, $aSrcFolder, $FileList, @SystemDir) ;Combo 2 $FileList = _FileListToArray(@WindowsDir & "Fonts", "*.ttf", 1) If @error = 1 Or @error = 4 Then Exit MsgBox(0, "", "Folders Not Found or No Files Found.") _AddFolder($cCombo2, $aSrcFolder, $FileList, @WindowsDir & "Fonts") ;optionally deleted unneeded array $FileList = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $cCombo1;select a combo item and the full path is written to variable, label and console $sFilePath1 = _GetFile($cCombo1, $aSrcFolder) If $sFilePath1 == "" Then ConsoleWrite("This ComboBox item does not have ListBox user data" & @CRLF) GUICtrlSetData($cFilePath1, "This ComboBox item does not have ListBox user data") Else ConsoleWrite("File = " & $sFilePath1 & @CRLF) GUICtrlSetData($cFilePath1, "File = " & $sFilePath1) EndIf Case $cCombo2 ;select a combo item and the full path is written to label and console $sFilePath2 = _GetFile($cCombo2, $aSrcFolder) If $sFilePath2 == "" Then ConsoleWrite("This ComboBox item does not have ListBox user data" & @CRLF) GUICtrlSetData($cFilePath2, "This ComboBox item does not have ListBox user data") Else ConsoleWrite("File = " & $sFilePath2 & @CRLF) GUICtrlSetData($cFilePath2, "File = " & $sFilePath2) EndIf EndSwitch WEnd EndFunc ;==>_Main Func _AddFolder($hWnd, ByRef $aSrc, ByRef $aFiles, $sPath) ;coded by rover 2k12 Local $tInfo, $iIdx _GUICtrlComboBox_GetComboBoxInfo($hWnd, $tInfo) $hList = DllStructGetData($tInfo, "hList") If _WinAPI_GetClassName($hList) <> "ComboLBox" Then Return -1 ;verify returned handle is a valid handle and is the handle to the ComboBoxes internal ListBox control (the dropdown menu) ;Add source folder to array and store 1 based index in ListBox user data (default value in unused ListBox item data is 0, using a 1 based index allows unambiguous ListBox userdata validation) Local $iX = UBound($aSrc) If @error Or $iX < 1 Then Return -2 ; not array unless 1 or more ReDim $aSrc[$iX+1] ;resize array, add 1 element, now 2 or more $aSrc[$iX] = $sPath ;ignore first element, fill array element 1 or more with source folder name For $i = 1 To $aFiles[0] ;add file names and source folder array index to a new ComboBox item _GUICtrlComboBox_InsertString($hWnd, $aFiles[$i]);insert a new item after the last one $iIdx = _GUICtrlComboBox_GetCount($hWnd) ;get current count of items = index of current item If @error Or $iIdx = -1 Then Return -3 _GUICtrlListBox_SetItemData($hList, $iIdx - 1, $iX) ;use a 1-based index - set to element of array with source folder for this file Next Return 1 EndFunc Func _GetFile($hWnd, ByRef $aSrc) ;coded by rover 2k12 Local $tInfo _GUICtrlComboBox_GetComboBoxInfo($hWnd, $tInfo) Local $hList = DllStructGetData($tInfo, "hList") If _WinAPI_GetClassName($hList) <> "ComboLBox" Then Return "" ;verify returned handle is a valid handle and is the handle to the ComboBoxes internal ListBox control (the dropdown menu) Local $iIdx = _GUICtrlListBox_GetItemData($hList, _GUICtrlComboBox_GetCurSel($hWnd)) ;get index of selected ComboBox item and retrieve source folder array index value from ListBox If $iIdx >= 1 Then Return $aSrc[$iIdx] & "" & GUICtrlRead($hWnd) Else ;if $iIdx is 0 then item does not have a source folder array element index value Return "" EndIf EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now