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 function" problem

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


Joined: 23 Sep 2002
Posts: 21

PostPosted: Thu Sep 26, 2002 8:18 am    Post subject: "@FILE function" problem Reply with quote

I wrote a program with VDS 4.50 on Windows NT 4.0 sp 6 that checks for a specific file. If the file does not exist, it is created. The code I use looks something like this;
Quote:
IF @FILE(C:\PQS\Extras\Illustrat\BckGrnd.JPG)
GOTO CheckUpdates
ELSE
FILE COPY,C:\PQS\Extras\Illustrat\BackGrs\BckGrnd.jpg,C:\PQS\Extras\Illustrat\BckGrnd.JPG
END

Unfortunately even if the file "C:\PQS\Extras\Illustrat\BckGrnd.JPG" allready exists, the program still runs the 'ELSE'-part of my 'IF'-construction.

What am I doing wrong? Sad
Back to top
View user's profile Send private message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Thu Sep 26, 2002 10:20 am    Post subject: Reply with quote

You are doing nothing wrong. I have had that problem as well.
I haven't found out why it does that. It only has happened on
Windows NT based systems (NT, 2K and XP). Sad

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jimjams
Newbie


Joined: 23 Sep 2002
Posts: 21

PostPosted: Thu Sep 26, 2002 10:27 am    Post subject: Reply with quote

Too bad.

I guess it's back to the drawing board then.
At least I know there's nothing I can do about it.

Thanks for replying. Confused
Back to top
View user's profile Send private message
Que
Valued Newbie


Joined: 25 Aug 2001
Posts: 38
Location: Newaygo, MICH

PostPosted: Thu Sep 26, 2002 12:36 pm    Post subject: Reply with quote

for some reason NT "lies" to you about the existence of a file and does not process your goto. Unless the @file function is completely useless in NT, perhaps you could use the T option to check the validity of the file date/time (I just used the time) instead of merely verifying it's existence.

Code:

if @equal(@datetime(hh:mm,@file(c:\win95\desktop\desk.bat,t)),15:17)
   goto checkwhatever
else
   rem copy the file
end


Good luck! Smile

_________________
Que
Back to top
View user's profile Send private message Send e-mail
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Thu Sep 26, 2002 12:38 pm    Post subject: Reply with quote

I'll have to give that a try. Thanks.
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jimjams
Newbie


Joined: 23 Sep 2002
Posts: 21

PostPosted: Thu Sep 26, 2002 1:23 pm    Post subject: Reply with quote

I've tried your T-attribute suggestion, Que, but the funny thing is that even if you point to a non-existing file, the @FILE-function still returns the current time.

I guess the @File-function simply doesn't work under NT which is a real problem for me.
I desperately need a work-around.


Thanks all the same Crying or Very sad
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Sep 26, 2002 1:50 pm    Post subject: Reply with quote

Try to go to a DOS prompt and use a DIR command to check on the file, like this:

DIR <filename> /B

if it's a long filename, I'd suggest you enclose the filename in quotes, for instance

DIR "C:\Program Files\somefile.txt" /B

If this command returns the filename, then you can use a DOS command from VDS to verify your file.

Greetz
Dr. Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Jimjams
Newbie


Joined: 23 Sep 2002
Posts: 21

PostPosted: Thu Sep 26, 2002 1:57 pm    Post subject: Reply with quote

Thanks Doc!

I'll get right on it!Exclamation
Back to top
View user's profile Send private message
Jimjams
Newbie


Joined: 23 Sep 2002
Posts: 21

PostPosted: Thu Sep 26, 2002 2:39 pm    Post subject: Reply with quote

Great Doc, this works! Worship

Next problem;
Quote:
If this command returns the filename, then you can use a DOS command from VDS to verify your file.

At the risk of sounding stupid; how do I use a DOS command from VDS?
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Sep 26, 2002 2:52 pm    Post subject: Reply with quote

You use RUN or SHELL. In this case DIR is an internal DOS command, so you can't use it directly (like RUN DIR ..)

Try something like this:

Code:
REM To be on the safe side here - use only full path to your file
%%file = "C:\autoexec.bat"
%%outfile = XXX#YYY.txt
runz command.com /C dir @CHR(34)%%file@CHR(34) /B > %%outfile,wait
list create,1
list loadfile,1,@path(%0)XXX#YYY.txt
%%getname = @item(1)
if @greater(@len(%%getname),0)
  info File *%%getname* is there
else
  info File not present
end
list close,1
file delete,%%outfile


Greetz
Dr. Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 766
Location: Eastman, GA

PostPosted: Thu Sep 26, 2002 10:31 pm    Post subject: Reply with quote

A simpler solution?

Code:

%%mydir = c:\windows\desktop\directory
%%file = myfile.txt

list create,1
directory change,%%mydir
list filelist,1,*.*
%%match = @match(1,%%file)

if %%match
info match
rem dothis
else
info nomatch
rem dothat
end


Happy coding!

NodNarb
Back to top
View user's profile Send private message AIM Address
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Sep 26, 2002 11:04 pm    Post subject: Reply with quote

Have ya tried checking for file size greater than zero?
__________________________________________________________________________________________________________________________
Code:

if @greater(@file(C:\PQS\Extras\Illustrat\BckGrnd.JPG, Z), 0)
   goto CheckUpdates
else
   FILE COPY,C:\PQS\Extras\Illustrat\BackGrs\BckGrnd.jpg,C:\PQS\Extras\Illustrat\BckGrnd.JPG
end


Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Jimjams
Newbie


Joined: 23 Sep 2002
Posts: 21

PostPosted: Fri Sep 27, 2002 9:59 am    Post subject: Reply with quote

Thanks everybody for replying! Very Happy

You've all given me enough alternatives to bypass the problem.


IOU all
Back to top
View user's profile Send private message
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