Page 1 of 1

CopyFileA help please

Posted: Fri Jan 15, 2010 7:32 pm
by 5aclockshadow
Hello,

I'm new so take it easy on me...

Very simple, all I want to do is:
1.) install a file
2.) use runprogram to run an .exe that will modify the file
3.) then copy the modified file to other directories

I found out that cannot use the copy command since the copy action has to take place after the apply and apparently the copy command is no good after the apply.

Copy Local Files $TARGETDIR$\\abc\\somefile.txt to $TARGETDIR$\\123\\somefile.txt

How do I use CopyFileA to accomplish this?

This is what I've tried so far:

~InstallAware Clipboard Data~
~Call DLL Function~
~{B3D61ED3-3FE0-4A76-BE97-ED665707F1B7}~
~kernel32.dll,CopyFileA,bool,COPYISSUCCESS01,"pointer to string",$TARGETDIR$\\abc\\somefile.txt,"pointer to string",$TARGETDIR$\\123\\somefile.txt,bool,FALSE,$~
~mIDEFunc.dll\\mEXEFunc.dll~

Posted: Mon Jan 18, 2010 4:55 am
by MichaelNesmith
You can call Apply Install twice :)

Posted: Mon Jan 18, 2010 11:46 am
by 5aclockshadow
MichaelNesmith wrote:You can call Apply Install twice :)
Thanks, I tried that but my install is very long and it installs all the files all over again.

Is it very difficult to use CopyFileA?

I have also played around with a batch file but it is ugly and I feel this simple action should be able to be accomplished easily from the installer.

Please help!

Posted: Mon Jan 18, 2010 12:57 pm
by MichaelNesmith
Is COPYISSUCCESS01 defined before making this call?

Posted: Mon Jan 18, 2010 1:05 pm
by 5aclockshadow
MichaelNesmith wrote:Is COPYISSUCCESS01 defined before making this call?
Yes, I believe so...I'm not sure the best way to do it or where to define it so I did it here:

~InstallAware Clipboard Data~
~Set Variable~
~{A0FC0509-D9EC-481A-9154-01D5B1FFE005}~
~COPYISSUCCESS$MYAH$MYAH$FALSE~
~~
~Set Variable~
~{A212C872-9213-4630-9A0B-C423867F84E9}~
~COPYISSUCCESS01$MYAH$MYAH$FALSE~
~~
~Comment~
~{FF3F89EF-7E2C-4400-812F-0961434789AA}~
~Created CopyIsSuccess variable so that the config files are copied towards the end of the script (used Apply Changes command)...not sure if this was needed or not - RMN VW07.13 Setup v02.00.01 1/15/10~
~Label~
~{7CE5BE9A-8012-43FE-8C0A-42B5F7F66C37}~
~Setup Type~


label: Setup Type
Comment: Created CopyIsSuccess variable so that the config files are copied towards the end of the script (used Apply Changes command)...not sure if this was needed or not - RMN VW07.13 Setup v02.00.01 1/15/10
Set Variable COPYISSUCCESS01 to
Set Variable COPYISSUCCESS to



Also, fyi ... I originally copied from here:

http://www.installaware.com/forums/viewtopic.php?t=1372

Posted: Tue Jan 19, 2010 4:32 pm
by 5aclockshadow
Changed bool=FALSE to bool=0 and it worked...it will now copy the file even if it already exists.

Here's the code:

~InstallAware Clipboard Data~
~Call DLL Function~
~{B3D61ED3-3FE0-4A76-BE97-ED665707F1B7}~
~kernel32.dll,CopyFileA,bool,COPYISSUCCESS01,"pointer to string",$TARGETDIR$\\abc\\somefile.txt,"pointer to string",$TARGETDIR$\\123\\somefile.txt,bool,0,$~
~mIDEFunc.dll\\mEXEFunc.dll~


In text format:

Call DLL Function kernel32.dll->CopyFileA (get result into variable COPYISSUCCESS01)


Thanks for the help.