cai_sebas
28th September 2003 10:21 UTC
Special Option
Could someone help me, :rolleyes:
because i want that at the end of the (my) setup/instalation. The instalation places a copy of the instalation file in a specific folder.
I hope you guys know what i mean, because my english is very bad. :cry:
cai_sebas
kichik
28th September 2003 11:26 UTC
You can process $CMDLINE to get the installer name and then use CopyFiles to copy it to $INSTDIR.
n0On3
29th September 2003 03:45 UTC
I just needed this on a installer I made, and here's the modification to the GetParameters function I found in the NSIS archive.
You have to call this function before copying the file, and the name of the installer is saved in the $2 variable.
GetParameters
Push $R0
Push $R1
Push $R2
StrCpy $R0 $CMDLINE 1
StrCpy $R1 '"'
StrCpy $R2 1
StrCmp $R0'"' loop
StrCpy $R1' ' ; were scanning for a space instead of a quote
loop:
StrCpy $R0 $CMDLINE 1 $R2
StrCmp $R0 $R1 loop2
StrCmp $R0"\" "" "nofile"
IntOp $2 $R2 + 1
nofile:
;MessageBox MB_OK "
r0: $R0"
StrCmp $R0 "" loop2
IntOp $R2 $R2 + 1
Goto loop
loop2:
IntOp $R0 $R2 - $2
IntOp $R0 $R0 - 4
;MessageBox MB_OK "$R2 - $2 = $R0"
StrCpy $2 $CMDLINE $R0 $2 ; we save the filename
;MessageBox MB_OK "$2"
loop2b:
IntOp $R2 $R2 + 1
StrCpy $R0 $CMDLINE 1 $R2
;MessageBox MB_OK "rr0: $R0"
StrCmp $R0 " " loop2b
StrCpy $R0 $CMDLINE "" $R2
Pop $R2
Pop $R1
Exch $R0
FunctionEnd
>
Joost Verburg
29th September 2003 07:31 UTC
I think that function can be made smaller.
Afrow UK
29th September 2003 19:15 UTC
This works.
Usage:
Call GetEXEName
Pop $R0 ;full installer exe file name
Function GetEXEName
Push $R0
Push $R1
Push $R2
StrCpy $R0 $CMDLINE -2
StrLen $R2 $R0
IntOp $R2 $R2 - 1
StrCpy $R0 $R0 "" -$R2
StrCpy $R2 0
Loop:
IntOp $R2 $R2 - 1
StrCpy $R1 $R0 1 $R2
StrCmp $R1 "" Exit
StrCmp $R1 "\" 0 Loop
IntOp $R2 $R2 + 1
StrCpy $R0 $R0 "" $R2
Exit:
Pop $R2
Pop $R1
Exch $R0
FunctionEnd
-Stu
cai_sebas
29th September 2003 19:23 UTC
Thanx
Thanx, it helped me a lot. ;)
And special thanx to Deliverator who wrote a tutorial for me!
Sebas
Afrow UK
29th September 2003 19:26 UTC
I'll add this onto the NSIS Archive.
-Stu
n0On3
29th September 2003 21:01 UTC
Originally posted by Joost Verburg
I think that function can be made smaller.
probably ;) but I needed the filename and parameters.