WinBatch Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: wlodekd on July 25, 2013, 06:47:26 am

Title: FILELISTBOX multiply file extension mask
Post by: wlodekd on July 25, 2013, 06:47:26 am
Dear Forum,
FILELISTBOX
1. How can I define file mask to include for example all files with .txt and .pdf extension in specific directory.
2. How can I define mask to show files only and not [DIRECTORIES]

Thanks Walter
Title: Re: FILELISTBOX multiply file extension mask
Post by: Deana on July 25, 2013, 08:31:47 am
The FileListBox doesn't support multiple file extensions or the ability to show only files.

There are a few different ways this can be accomplished.

Using a Itembox along with FileItemize:

Code: Winbatch
DocsDir = ShortCutDir('Personal')
DirChange( DocsDir )
ibVariable1 = FileItemize("*.txt|*.pdf")

MyDialogFormat=`WWWDLGED,6.2`

MyDialogCaption=`Itembox Sample`
MyDialogX=002
MyDialogY=059
MyDialogWidth=478
MyDialogHeight=353
MyDialogNumControls=003
MyDialogProcedure=`DEFAULT`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`111,315,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`271,317,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`023,023,420,278,ITEMBOX,"ItemBox_1",ibVariable1,DEFAULT,DEFAULT,30,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog")

Using AskItemList:

Code: Winbatch
types="TXT Files|*.txt|PDF Files|*.pdf"
fn1=AskFilename("SelectFile", "C:\WinBatch", types, "Sol.wbt", 1)
Message("File selected was", fn1)