Page 1 of 1

Using ExtractFile

PostPosted: Thu Feb 07, 2002 5:25 pm
by Jim Brammer
I'm trying to extract a file into c:\ WINDOWS\temp and when running the .exe, it gives me an error saying:

Cannot create file C:\WINDOWS\temp

What is that all about?



Not only that, but when the pub is compiled, it pulls in the file I want it to add to the pub, but when I byptush the "can't...." error, the pub is supposed to run the file that was "included" in the pub, well it says that the (included file) does not exist.



I found that using [TempDir] doesn't work on all computers. I have NO idea why. Several people wrote me saying the file was missing. I had to pull my printing programs because of this. I use [PubDir] instead when coding... now there are no problems.

Hope this helps Troy



Using a var in the sourcefile path...

ExtractFile "[PubDir]" "[TempDir]"

...might not even package the source file.

During compile, the ExtractFile sourcefile needs to be a hardcoded path and filename...

ExtractFile "C:\My Files\" "[TempDir]"

...otherwise the compiler won't know where to find the file in order to package it. Global vars (vars in general) are only recognized by NeoBook at runtime. The compiler does not understand vars.

When you extract you need to specify the full path and filename for the Source and Destination...

ExtractFile "C:\My Files\" "[TempDir]"

ExtractFile "C:\My Files\" "[TempDir]"
ExtractFile "[AnyVar]\" "C:\Windows\Temp"

Take note that some of the Global Vars include a trailing backslash while others do not.

It might be a good idea to verifiy that an end user actually has a Windows Temp folder before you try to extract there...

FileExists "[WindowsDir]\Temp" "[TempDir_Ex]"