forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


File listing won't work...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Thu Jun 12, 2003 11:02 pm    Post subject: File listing won't work... Reply with quote

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 Wink

_________________


Last edited by GeoTrail on Thu Jun 12, 2003 11:36 pm; edited 4 times in total
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Thu Jun 12, 2003 11:14 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Thu Jun 12, 2003 11:20 pm    Post subject: Reply with quote

Could it be a bug?
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Jun 12, 2003 11:59 pm    Post subject: Reply with quote

It should be like this..:
Code:

list create,1
list filelist,1,c:\*.txt
info @text(1)

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Fri Jun 13, 2003 12:12 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Fri Jun 13, 2003 12:16 am    Post subject: Reply with quote

Well use the way that works Wink
_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Fri Jun 13, 2003 12:17 am    Post subject: Reply with quote

Well, it works. Laughing

Maybe they put an extra comma in the helpfile just for kicks? Laughing *S*

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Fri Jun 13, 2003 2:32 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Fri Jun 13, 2003 3:01 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Fri Jun 13, 2003 2:43 pm    Post subject: Reply with quote

GeoTrail, you could try to make a repeat loop which will check the filesize of each file. But like SnarlingSheep said, the normal DOS dir command will do the trick too (and probably much faster).
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Fri Jun 13, 2003 3:23 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Fri Jun 13, 2003 8:34 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Fri Jun 13, 2003 10:58 pm    Post subject: Reply with quote

Yeah, I agree. Much simpler Smile
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group