Self copy install ?
Is there a way to make the install file copy itself after installation into the install dir ?
Archive: Self copy install ?
Self copy install ?
Is there a way to make the install file copy itself after installation into the install dir ?
Function .onInstSuccess
CopyFiles /SILENT "$EXEDIR\Setup.exe" "$INSTDIR\Setup.exe"
FunctionEnd
but what if the user renamed the file ?
System plugin can help you to detect filename
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
wow!
thanks :D but I'm new to this scripting system so I'm not sure how to combine those two scripts to make it work :P
I think this may be like this:
Function .onInstSuccess
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
StrLen $0 $R0
Push $R0
Call GetParent
Pop $1
StrLen $1 $1
IntOp $0 $0 - $1
IntOp $0 $0 - 1
StrCpy $R1 $R0 "" "-$0"
CopyFiles /SILENT "$R0" "$INSTDIR\$R1"
FunctionEnd
You R AMAZING!!! :D I O U a HUGE beer :up: Once again THANK YOU :)
Rather than use GetParent to get the file name (for some reason) just use GetFileName:
http://nsis.sourceforge.net/archive/...ances=0,11,211
Function .onInstSuccess
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
Push $R0
Call GetFileName
Pop $R1
CopyFiles "$R0" "$INSTDIR\$R1"
FunctionEnd
hmmm... OK :] I'll try it then...
Why use GetParent or GetFileName? CopyFiles works with full paths, it's even required:
Fully-qualified path names should always be used with this instruction. Using relative paths will have unpredictable results.
He needed the installer file to be copied to $INSTDIR.
GetFileName was used to get the installer file name from $R0.
-Stu
Right... Sorry, my bad.
the script works great ! nothing more to add :] thank you all for your help !!!