| View previous topic :: View next topic |
| Author |
Message |
DW Contributor

Joined: 21 Mar 2003 Posts: 175 Location: UK
|
Posted: Tue Sep 09, 2003 11:31 am Post subject: List help with filenames. |
|
|
I have a list and i can fille the list with files from my dir, but i dont want to show the paths. How can i make it so only filenames show in my list?
I tried the @name with the filelist command, but i cant seem to get it to work. |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Tue Sep 09, 2003 12:23 pm Post subject: |
|
|
You are close.
You will have to create a new list then fill the list with the files using the @name() function. Here is an example:
| Code: |
list create,1
list create,2
list filelist,1,C:\MyFiles\*.*
%x = 0
repeat
list add,2,@name(@item(1,%x))"."@ext(@item(1,%x))
%x = @succ(%x)
until @equal(%x,@count(1))
info @text(2)
list close,1
list close,2
|
I haven't tested it, but, this should work _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
DW Contributor

Joined: 21 Mar 2003 Posts: 175 Location: UK
|
Posted: Tue Sep 09, 2003 1:47 pm Post subject: |
|
|
| Thank you, thats did it. |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Tue Sep 09, 2003 7:39 pm Post subject: |
|
|
Change directory to the directory where you want to list the files, then fill the list with the filelist
| Code: | list create,1
%%CurDir = @curdir()
Directory Change,C:\MyFiles
list filelist,1,*.*
Directory Change,%%CurDir
list close,1 |
_________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Tue Sep 09, 2003 10:08 pm Post subject: |
|
|
Use the winapi LB_DIR message:
%A = @sendmsg(@win(~LIST1),$018D,2,@windir()\*.*)
Here is an example
| Code: |
title TEST
DIALOG CREATE,TEST,-1,0,213,215
DIALOG ADD,BUTTON,BUTTON1,170,70,,,,,DEFAULT
DIALOG ADD,LIST,LIST1,10,12
DIALOG SHOW
:evloop
wait event
goto @event()
:BUTTON1BUTTON
%A = @sendmsg(@win(~LIST1),$018D,2,@windir()\*.*)
rem Shows all files from @windir()\ in list1, change @windir()\*.* to the
rem directory and the *.* filetypes you want to show
goto evloop
:CLOSE
exit
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|