PDA

View Full Version : Copying a File



NewsArchive
09-11-2009, 01:22 AM
I finally figured out (using the /e debugger text) that %CURDIR% is the full
path I am installing from... I was trying to do a copy
%SRCDRV%\%CURDIR%\histcom.dat .... so, now that I have that solved, I want
to INSTALL the histcom.dat file IF there is not a histcom.dat in the folder
I am installing from.

like:
if error %CURDIR%\histcom.dat
install histcom.dat
else
copy %CURDIR%\histcom.dat
..

How can I check to see if the file is there.. and determine what to do.. my
current code is:

! *** Histcom.dat File ***
#ifcompvar [VMT_INSTALL_TYPE] Equals "REAL" Then
If Feature "Main Program" selected Then
Copy File(s) from "%CURDIR%\histcom.dat" to
"%_SB_INSTALLDIR%\histcom.dat"
Set File Attributes for "%_SB_INSTALLDIR%\histcom.dat"
End
#else
Install File "F:\ALLVDLUX\Windows\delinst\DemoCD\histcom.dat" to
"%_SB_INSTALLDIR%\histcom.dat" (Always Install)
#end

I know the install above is the result of a compiler variable.. I want
almost the same thing.. just trying to find the commands:

! *** Histcom.dat File ***
#ifcompvar [VMT_INSTALL_TYPE] Equals "REAL" Then
If Feature "Main Program" selected Then
! ***** if the file exists in curdir
Copy File(s) from "%CURDIR%\histcom.dat" to
"%_SB_INSTALLDIR%\histcom.dat"
Set File Attributes for "%_SB_INSTALLDIR%\histcom.dat"
! else
Install File "F:\ALLVDLUX\Windows\delinst\DemoCD\histcom.dat" to
"%_SB_INSTALLDIR%\histcom.dat"
! end

End
#else
Install File "F:\ALLVDLUX\Windows\delinst\DemoCD\histcom.dat" to
"%_SB_INSTALLDIR%\histcom.dat" (Always Install)
#end

Hope I'm explaining myself well.

Thanks,

Ray Rippey
VMT Software - http://www.vmtsoft.com

NewsArchive
09-11-2009, 01:23 AM
Ray,

First question- when you say "if there is not a histcom.dat in the folder"
do you mean in the folder on YOUR DEVELOPMENT MACHINE
or on the END-USER's machine?

I'm just confused because of your mixing of #ifcompvar and other compiler
directives (which are evaluated while you're compiling the installation
program) with other script functions such as If Feature that are evaluated
when your end-user runs your installer.
Which is not to say that there aren't reasons to do that... I'm just
checking.

And rereading your post, I see you do mention compiler variables so I guess
you understand that difference... although I'm confused as to what you're
using them for.

That said, if you want to find whether the file exists on the end-user's
machine at runtime, use the "If file/folder" script item and select the
"File or Folder exists" item from the dropdown.

BTW... rather than using the debugger, you can simply put a #msgbox compiler
directive or a Display Message Box script function to display the current
value of variables at various places in your script, both when you're
compiling and at runtime. (Runtime variables won't be evaluated during
compilation, of course.)

Again, not really knowing what you're trying to do, it seems to me you're
making this way too complicated.
Why not just use the Features visualizer to do all the file installation,
and then in your script just find where the histcom.dat file is being
installed and insert a few script functions right above it to see whether it
currently exists, if so copy it to a backup, etc.

Have you looked through the SetupBuilder example files? You need to
download them separately from
http://www.lindersoft.com/downloads_licensed.htm

Jane

NewsArchive
09-11-2009, 01:24 AM
Jane,

Thanks for the input.

The compiler directives are so I can have 3 different installs... the demo
and the Netdemo install actually installs the histcom.dat file. But the real
install is on a CD... the histcom.dat file is also on the CD therefore
copied. That way I can set different parameters for the program.. but only
create an install once. My associates can manipulate the histcom.dat... then
both the install program and the histcom.dat are burned to the CD.

However, if for some reason the histcom.dat is not there.. and it's a real
install, and the customer is installing the MAIN program, I want to actually
install a default histcom.dat... thereby overwriting the one on the
customers hard drive. And that is where I want to look at the folder (the CD
usually) I am running the install from and see if the histcom.dat file is
there.

Currently everything works fine.... I just want to start checking for NO
histcom.dat and act accordingly.. I will try the file folder exists if that
will check for the file on the install CD.

It is a bit confusing.. but I have 3 kinds of installs.. and each install
also allows the customers to install up to 6 different optional programs
(Features)... plus, if they forget to install one of the optional programs..
they can rerun the install and NOT have to install the entire program again,
just the options separately... works pretty good.

Thanks,

Ray
VMT

NewsArchive
09-12-2009, 02:20 AM
> I finally figured out (using the /e debugger text) that %CURDIR% is the
> full path I am installing from...

%CURDIR% represents the current directory at installer startup. Whatever
the current directory was at that time.

It's better to use the "Get System Info(Installer Path Name)" script
function to retrieve the "real" installer path.

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder is Windows installation -- "point. click. ship"

-- Official Comodo Code Signing and SSL Certificate Partner