Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 31st March 2008, 21:05   #1
parasoul
Member
 
Join Date: Aug 2007
Posts: 75
If process exists?

Can someone show me an example script of

If something.exe exists,
do something


I don't remember the plug-in or syntax for that

thank you
parasoul is offline   Reply With Quote
Old 1st April 2008, 04:16   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
That's not plugin, it's the included LogicLib header (LogicLib.nsh).
A forum search should help you a lot.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 1st April 2008, 06:49   #3
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Xi'an, China
Posts: 194
Re: If process exists?

1.The FindProcDLL & KillProcDLL Plugins

FindProcDLL::FindProc "something.exe"
Pop $R0
IntCmp $R0 1 0 Next
MessageBox MB_ICONSTOP|MB_YESNO|MB_DEFBUTTON2 'The process "something.exe" is exist,do you want to kill it or quit?' IDYES +2
Abort
Next:
KillProcDLL::KillProc "something.exe"

2.The ProcessWork Plugin

Push $R9
Loop:
Push "something.exe"
ProcessWork::ExistsProcess
Pop $R0
IntCmp $R0 0 Done
MessageBox MB_RETRYCANCEL|MB_ICONSTOP 'The process "something.exe" is exist.click [retry] to stop it or [cancel] to cancel setup.' IDCANCEL Exit
Push "something.exe"
ProcessWork::KillProcess
Sleep 1000
Goto Loop
Exit:
Abort
Done:
Pop $R0
jiake is offline   Reply With Quote
Old 1st April 2008, 07:03   #4
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Xi'an, China
Posts: 194
If you want to do different things while a file is exist or not,you can use the command "IfFileExist":

IfFileExist "$WINDIR\Notepad.exe" Exist Not
Exist:
;Something want to do if file exist
Not:

You can find it in NSIS Users Manual.

An NSIS fan from China, my name is Jia Ke (pinyin).
Email: jiake@vip.qq.com
Messenger: jiake@live.in
QQ (Chinese IM): 550771955
jiake is offline   Reply With Quote
Old 1st April 2008, 21:31   #5
AaronLS
Senior Member
 
Join Date: Mar 2008
Posts: 129
And the example using LogicLib. I prefer this cause it is little more structured.
code:

${If} ${FileExists} "$WINDIR\Notepad.exe"
;something
${Else}
;semething else
${EndIf}

AaronLS is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump