| View previous topic :: View next topic |
| Author |
Message |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Thu Jun 12, 2003 11:02 pm Post subject: File listing won't work... |
|
|
I'm trying to get this code to work. It works if I use * where .txt is in the LIST FILELIST,FILES,@DLGTEXT(DIR),.txt line. But the .txt extension don't seem to work.
Do I have to enter the extension in another way?
| Code: | DIALOG CREATE,New Dialog,-1,0,615,278
REM *** Modified by Dialog Designer on 13.06.2003 - 01:22 ***
DIALOG ADD,LIST,FILES,8,8,600,232
DIALOG ADD,EDIT,DIR,248,8,176,21
DIALOG ADD,BUTTON,BROWSE,248,192,40,24,...
DIALOG ADD,BUTTON,LIST,248,240,64,24,LIST
DIALOG ADD,BUTTON,EXIT,248,544,64,24,EXIT
DIALOG ADD,EDIT,EXT,248,448,32,21,txt
DIALOG ADD,TEXT,TEXT1,256,368,,,List extensions:
DIALOG SHOW
%D = @REGREAD(CURUSER,Software\GeoTrail Corporation\Experiment,Last directory)
IF @NOT(@NULL(%D))
DIALOG SET,DIR,%D
%E = @REGREAD(CURUSER,Software\GeoTrail Corporation\Experiment,Last extension)
DIALOG SET,EXT,%E
LIST CLEAR,FILES
LIST FILELIST,FILES,@DLGTEXT(DIR),@DLGTEXT(EXT)
END
:EVLOOP
WAIT EVENT
GOTO @EVENT()
:BROWSEBUTTON
%D = @DIRDLG(Select directory to list:)
DIALOG SET,DIR,%D
GOTO EVLOOP
:LISTBUTTON
rem Added a check to see if the DIR edit box is empty.
IF @NULL(@DLGTEXT(EXT))
WARN No extension entered!
ELSE
IF @NULL(@DLGTEXT(DIR))
WARN No directory to list.
ELSE
LIST CLEAR,FILES
LIST FILELIST,FILES,@DLGTEXT(DIR),@DLGTEXT(EXT)
REGISTRY WRITE,CURUSER,Software\GeoTrail Corporation\Experiment,Last directory,@DLGTEXT(DIR)
REGISTRY WRITE,CURUSER,Software\GeoTrail Corporation\Experiment,Last extension,@DLGTEXT(EXT)
END
END
GOTO EVLOOP
:CLOSE
:EXITBUTTON
EXIT |
When I run the code above all I get in the FILELIST is a list of numbers. Looks like windows id's.
Updated code above. Try entering a different extension at runtime. If I enter exe and click LIST I don't only see executable files...
Updated it again. Added some registry features where it saves the last used directory and extension and automatically reloads those values on next run. Just for fun  _________________

Last edited by GeoTrail on Thu Jun 12, 2003 11:36 pm; edited 4 times in total |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Jun 12, 2003 11:14 pm Post subject: |
|
|
That is so weird -- it happens with this too:
| Code: | list create,1
list filelist,1,c:\,.txt
info @text(1) |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Thu Jun 12, 2003 11:20 pm Post subject: |
|
|
Could it be a bug? _________________
 |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jun 12, 2003 11:59 pm Post subject: |
|
|
It should be like this..:
| Code: |
list create,1
list filelist,1,c:\*.txt
info @text(1)
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Fri Jun 13, 2003 12:12 am Post subject: |
|
|
| Code: | LIST FILELIST,1,C:\Windows,*
Copyright © 1995 - 2002 S.A.D.E. s.a.r.l. / All rights are reserved. |
Well, that is what the help file says. C:\,*
First directory then comma and finally file or extension. _________________
 |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Fri Jun 13, 2003 12:16 am Post subject: |
|
|
Well use the way that works  _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Fri Jun 13, 2003 12:17 am Post subject: |
|
|
Well, it works.
Maybe they put an extra comma in the helpfile just for kicks? *S* _________________
 |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Fri Jun 13, 2003 2:32 am Post subject: |
|
|
When using LIST LISTFILES, is it possible to get the total bytes for all files in the selected directory?
I know how to get the filesize from one file like this | Code: | | parse "%S",@file(@DLGTEXT(FILES),Z) | but not for the whole directory. _________________
 |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Fri Jun 13, 2003 3:01 am Post subject: |
|
|
I think the only way right now is to pipe the results of the DOS command dir to a txt file and read the second to last line. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Fri Jun 13, 2003 3:23 pm Post subject: |
|
|
Yeah, your right guys.
But then a new problem come up, I'm not very good with parsing files. Specially not a file outputed with the DIR command.
Is there a way I can DIR out ONLY the total filesize ? _________________
 |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Jun 13, 2003 8:34 pm Post subject: |
|
|
Personally I would just make a loop to go through each file... it's hard to
parse DOS output. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Fri Jun 13, 2003 10:58 pm Post subject: |
|
|
Yeah, I agree. Much simpler  _________________
 |
|
| 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
|
|