How to copy from [INSTALLDIR] ?
Posted 14 February 2006 - 09:10
I have made a script (courtesy and thanks to sebica79). It checks a particular registry entry and copies a file. I have placed this script in the Install Exec sequence at "After InstallFiles". What I want is to copy a file (named "bugs desc.txt") from [INSTALLDIR] to my desired folder in the system. I am not sure how to copy the file from [INSTALLDIR]. I have tried the following options but none of them worked:
1.) XCopyFile ( "[INSTALLDIR] ^ bug desc.txt", "E:\\Program Files\\My App\\Test", COMP_NORMAL );
2.) XCopyFile ( "[INSTALLDIR]\\bug desc.txt", "E:\\Program Files\\My App\\Test", COMP_NORMAL );
This:
XCopyFile ( [INSTALLDIR] ^ "bug desc.txt", "E:\\Program Files\\My App\\Test", COMP_NORMAL );
gives me error saying '[' missing.
So can anyone tell me how can I copy a file from [INSTALLDIR] using xCopy Command (or some other command).
Thanks in Advance.
Posted 14 February 2006 - 10:38
Posted 14 February 2006 - 10:49
Can we do this using the MoveFiles table?
Posted 14 February 2006 - 12:19
you can delete the File with a entry in the Remove File Table and the Name from the Componet in the componet colum. If the installer remove the Component the File will be delete too.
Edited by ali, 14 February 2006 - 12:20.
Posted 14 February 2006 - 12:54
Here is my script:
function MyFunction(hMSI)
// To Do: Declare local variables.
NUMBER nResult, nVersion, nType, nvSize;
STRING szName, szValue;
begin
// To Do: Write script that will be executed when MyFunction is called.
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
if ( RegDBKeyExist( "SOFTWARE\\Microsoft\\MediaPlayer\\9.0\\Registration" ) < 0 ) then
MsiSetProperty( hMSI,"COPYSUCCESS", "0" );
else
// theproduct was found
MsiSetProperty( hMSI,"COPYSUCCESS", "1" );
XCopyFile(INSTALLDIR^"bug desc.txt", "E:\\Program Files\\MyApp\\Test", COMP_NORMAL );
endif;
end;
Why is it not copying the file from INSTALLDIR to my desired location?
Please suggest me what should I do in my script.
Posted 14 February 2006 - 13:25
XCopyFile(szInstDir^"bug desc.txt", ProgramFilesFolder, COMP_NORMAL );
By the Way:
for this you can use the System Search Funktion from IS:
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
if ( RegDBKeyExist( "SOFTWARE\\Microsoft\\MediaPlayer\\9.0\\Registration" ) < 0 ) then
MsiSetProperty( hMSI,"COPYSUCCESS", "0" );
else
// theproduct was found
MsiSetProperty( hMSI,"COPYSUCCESS", "1" );
Edited by ali, 14 February 2006 - 13:26.
Posted 14 February 2006 - 16:34
INSTALLDIR is a special property. You don't have to get it with MsiGetProperty.
You can just use it (unwraped with []):
myFile = INSTALLDIR^"mtFile.txt";
and even set it:
INSTALLDIR = "C::\\myPath\\";
SUPPORTDIR acts the same.
Posted 14 February 2006 - 16:51
Edited by ali, 14 February 2006 - 17:00.
Posted 16 February 2006 - 15:35
I just mentioned it as an easier way to get (and set) the specific property: "INSTALLDIR".
You don't have to use msigetproperty, U can just use it as a string variable.
Posted 20 February 2006 - 11:29
Please help.
Posted 20 February 2006 - 11:54
Edited by ali, 20 February 2006 - 11:55.
Posted 20 February 2006 - 20:34
Installation Phases and In-Script Execution Options for Custom Actions in Windows Installer
http://www.installsi...00108/index.htm
Or is your custom action scheduled for deferred execution? Deferred actions don't have access to INSTALLDIR and other properties. For a workaround search msi help for CustomActionData.
The easiest solution might be to move your custom action after InstallFinalize. I assume you don't want those copied files to be removed during uninstall?
Stefan Krüger
InstallSite.org twitter facebook