| View previous topic :: View next topic |
| Author |
Message |
Jimjams Newbie

Joined: 23 Sep 2002 Posts: 21
|
Posted: Thu Sep 26, 2002 8:18 am Post subject: "@FILE function" problem |
|
|
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?  |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Thu Sep 26, 2002 10:20 am Post subject: |
|
|
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).  _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
Jimjams Newbie

Joined: 23 Sep 2002 Posts: 21
|
Posted: Thu Sep 26, 2002 10:27 am Post subject: |
|
|
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.  |
|
| Back to top |
|
 |
Que Valued Newbie

Joined: 25 Aug 2001 Posts: 38 Location: Newaygo, MICH
|
Posted: Thu Sep 26, 2002 12:36 pm Post subject: |
|
|
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!  _________________ Que |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Thu Sep 26, 2002 12:38 pm Post subject: |
|
|
I'll have to give that a try. Thanks. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
Jimjams Newbie

Joined: 23 Sep 2002 Posts: 21
|
Posted: Thu Sep 26, 2002 1:23 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Sep 26, 2002 1:50 pm Post subject: |
|
|
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 |
|
 |
Jimjams Newbie

Joined: 23 Sep 2002 Posts: 21
|
Posted: Thu Sep 26, 2002 1:57 pm Post subject: |
|
|
Thanks Doc!
I'll get right on it! |
|
| Back to top |
|
 |
Jimjams Newbie

Joined: 23 Sep 2002 Posts: 21
|
Posted: Thu Sep 26, 2002 2:39 pm Post subject: |
|
|
Great Doc, this works!
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 |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Sep 26, 2002 2:52 pm Post subject: |
|
|
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 |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 766 Location: Eastman, GA
|
Posted: Thu Sep 26, 2002 10:31 pm Post subject: |
|
|
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 |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Sep 26, 2002 11:04 pm Post subject: |
|
|
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  _________________ 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 |
|
 |
Jimjams Newbie

Joined: 23 Sep 2002 Posts: 21
|
Posted: Fri Sep 27, 2002 9:59 am Post subject: |
|
|
Thanks everybody for replying!
You've all given me enough alternatives to bypass the problem.
IOU all |
|
| Back to top |
|
 |
|