How to use a Combox box to list all folders in a Directory??

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
clickfast
Pro Scripter
Posts: 58
Joined: Wed May 23, 2007 12:04 am

How to use a Combox box to list all folders in a Directory??

Post by clickfast » Sun Jun 03, 2007 8:04 am

Hi, I want to pass a variable to a combobox in a dialogue such that when the user clicks it reveals a drop-down menu listing all the folders in the directory.

I used GetFileList to read a directory of folders and store them into a variable.

How do I get the combobox on my dialogue box to display the list of directories stored in the carsdir variable to allow a user to select one?

Code: Select all

//BUILD LIST OF CAR DIRECTORIES
Let>GFL_TYPE=1
Change Directory>D:\LabelLauncher\Activeperlscripts\CARS\
GetFileList>*.*,carsdir

User avatar
xurf4xs
Newbie
Posts: 19
Joined: Wed Jul 04, 2007 9:03 pm
Location: The Netherlands
Contact:

Post by xurf4xs » Mon Aug 06, 2007 10:59 am

I think the solution is not so hard as you think.

First you build the list of directories with cars. The result is saved in the variabele 'carsdir'. For example, 'carsdir' has a value '\Audi;\VW;\Opel;\Ferrari'

The only thing you have to do is to replace the ';' character for '%CRLF%'. Then you can use the value of te varible in the dialog.

Here an example:

//BUILD LIST OF CAR DIRECTORIES
Let>GFL_TYPE=1
Change Directory>D:\LabelLauncher\Activeperlscripts\CARS\
GetFileList>*.*,carsdir

MessageModal>carsdir

StringReplace>carsdir,;,%CRLF%,newcarsdir

MessageModal>newcarsdir


Dialog>Dialog1
Caption=Dialog1
Width=445
Height=250
Top=309
Left=270
Button=OK,216,168,75,25,0
ComboBox=msComboBox1,160,56,145,%nieuwcardir%
EndDialog>Dialog1

Show>Dialog1,result

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts