GetExeName: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library)
 
m (Updated author and download links, and changed format of some pages.)
Line 54: Line 54:
</highlight-nsis>
</highlight-nsis>


Page author: Instructor
Page author: [[User:Instructor|Instructor]]

Revision as of 12:44, 23 April 2005

Links

Latest version of headers "nsh.zip"
http://forums.winamp.com/showthread.php?s=&threadid=203228&goto=lastpost

If function used without header then put function in script before call it

The Function

/*
____________________________________________________________________________
 
                            GetExeName
____________________________________________________________________________
 
2004 Shengalts Aleksander (Shengalts@mail.ru)
 
 
Get installer filename (also valid case for Windows 9X)
 
 
Syntax:
Call GetExeName         ; Call function
Pop $var                ; $var=installer filename
 
 
Example:
Section
	Call GetExeName
	Pop $R0   ; $R0="C:\ftp\Program.exe"
SectionEnd*/
 
 
;---------------------------------------------------------------------------
Function GetExeName
	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

Page author: Instructor