PS plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(More parameters)
m (Parameters for all)
Line 33: Line 33:


Tries to gracefully end a process by closing its windows.
Tries to gracefully end a process by closing its windows.
;Id
: Name or PId.


;(Return)
;(Return)
Line 43: Line 46:


Calls <code>End</code> followed by <code>Kill</code>.
Calls <code>End</code> followed by <code>Kill</code>.
;Id
: Name or PId.


;(Return)
;(Return)

Revision as of 14:31, 29 August 2021

Author: Anders (talk, contrib)



Plug-in information

  • Version: 0.1
  • Type: Runtime plug-in (Unicode)
  • Minimum OS: Win95+, WinNT4+
  • Minimum NSIS version: 2.45
  • License: Freeware
  • Download: PS.zip (12 KB)


Functions

Kill

<Id>

Kills all processes matching Id.

Id
Name or PId. To kill a process by its PId, the PId must be prefixed with a colon (eg ":1234").
(Return)
Stack #0: Number of killed processes.


End

<id>

Tries to gracefully end a process by closing its windows.

Id
Name or PId.
(Return)
Stack #0: Number of closed windows/processes.


EndAndKill

<id>

Calls End followed by Kill.

Id
Name or PId.
(Return)
Stack #0: Number of closed windows/processes.


SelfPId

Returns the PId of the current process on top of the stack.


SelfSession

Returns the terminal server session of the current process on top of the stack or a empty string if sessions are not supported.


Enum

FunctionAddress

Enumerates all the processes in the system (except the current process). The callback function receives the PId in $0, the file name in $1, the full path (if available) in $2 and the session in $3. Set $0 to a empty string to abort the enumeration.

FunctionAddress
NSIS callback function.


Example

Function PSEnum
DetailPrint "PId=$0 Name=$1 Session=$3 Path=$2"
${If} $2 == "$InstDir\MyApp"
  PS::End ":$0"
  Pop $4
${EndIf}
FunctionEnd
 
Section
 
GetFunctionAddress $0 PSEnum
PS::Enum $0
 
PS::End "Notepad.exe" ; Closes all instances of Notepad.exe
Pop $0
 
SectionEnd


History

0.1 - 20210829 - Anders

  • Initial release