GetExeName: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Adding new author and category links.) |
Instructor (talk | contribs) No edit summary |
||
Line 2: | Line 2: | ||
== Links == | == Links == | ||
; Latest version of headers "nsh.zip": | ; Latest version of headers "nsh.zip": | ||
: http://forums.winamp.com/showthread.php?s=&threadid=203228&goto=lastpost | : http://forums.winamp.com/showthread.php?s=&threadid=203228&goto=lastpost | ||
If a function is used without | If a function is used without header, put the function code in your script before calling it. | ||
== The Function == | == The Function Description== | ||
<highlight-nsis> | |||
<highlight-nsis> | |||
____________________________________________________________________________ | ____________________________________________________________________________ | ||
Line 20: | Line 22: | ||
Syntax: | Syntax: | ||
${GetExeName} $var | ${GetExeName} $var | ||
</highlight-nsis> | |||
Example: | <b>Example:</b> | ||
Section | <highlight-nsis>Section | ||
${GetExeName} $R0 | ${GetExeName} $R0 | ||
; $R0="C:\ftp\program.exe" | ; $R0="C:\ftp\program.exe" | ||
SectionEnd | SectionEnd | ||
</highlight-nsis> | |||
== The Function Code== | |||
<highlight-nsis> | |||
Function GetExeName | Function GetExeName | ||
!define GetExeName `!insertmacro GetExeNameCall` | !define GetExeName `!insertmacro GetExeNameCall` |
Revision as of 14:42, 4 July 2005
Author: Instructor (talk, contrib) |
Links
- Latest version of headers "nsh.zip"
- http://forums.winamp.com/showthread.php?s=&threadid=203228&goto=lastpost
If a function is used without header, put the function code in your script before calling it.
The Function Description
____________________________________________________________________________ GetExeName ____________________________________________________________________________ Get installer filename (also valid case for Windows 9X). Syntax: ${GetExeName} $var
Example:
Section ${GetExeName} $R0 ; $R0="C:\ftp\program.exe" SectionEnd
The Function Code
Function GetExeName !define GetExeName `!insertmacro GetExeNameCall` !macro GetExeNameCall _RESULT Call GetExeName Pop ${_RESULT} !macroend Push $0 Push $1 StrCpy $1 $CMDLINE 1 StrCmp $1 '"' 0 kernel StrCpy $1 0 IntOp $1 $1 + 1 StrCpy $0 $CMDLINE 1 $1 StrCmp $0 '"' 0 -2 IntOp $1 $1 - 1 StrCpy $0 $CMDLINE $1 1 goto end kernel: System::Call 'kernel32::GetModuleFileNameA(i 0, t .r0, i 1024) i r1' end: Pop $1 Exch $0 FunctionEnd