Jump to content

Get file path from selected item in a combo box? *HELP NEEDED*


Recommended Posts

I am having some hickups with getting the full file path from a wim file, which has been populated into a combo box $select_os the following way:

global $wim_path = "z:\images\"
local $wim_list = _filelistToArray($wim_path, "*.wim")

_arraysort($wim_list, 0, 1)

for $wim_file = 1 to ubound($wim_list) -1

   $objwim.source = "z:\images\" & $wim_list[$wim_file]
   $objwim.imageindex = 1
   $objwim.getimageinfo
   guictrlsetdata($select_os, $objwim.imagename)

next

$objwim = 0

When you afterwards select the image file you want, how do i get the full path to the image file being selected from the combo box?

Kinda the same process as above but reversed

 

Thank you in advance!

Link to comment
Share on other sites

A return of 0 is failure. A wild guess is that you are deleting the control or the whole gui before using GuiCtrlRead as that would cause failure and return 0.

Very basic example of reading a path from a combo with GuiCtrlRead

GUICreate('test')
$select_os = GUICtrlCreateCombo(@ComSpec, 5, 5)
GUISetState()
$result = GUICtrlRead($select_os)
MsgBox(0, 'result', $result)

Outputs

---------------------------
result
---------------------------
C:\Windows\system32\cmd.exe
---------------------------
OK   
---------------------------

Seems fine. So check and make sure GuiCtrlRead reads the control while it exists.

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