Function: FindAndCloseProcessByName
Last Revision: October 7, 2004 (001)
Information
This function can be used to find a process by it's filename and then close it by sending it a close message.
To use this function in your Setup Factory 7.0 projects, simply copy and paste it into your Global Functions. You can get there by selecting Resources > Global Functions from the main menu.
To call the function from your project, try copying and pasting the following script onto an action tab, such as the On Startup event. You can get there by choosing Project > Actions.Code:function FindAndCloseProcessByName(strName) local tblProcesses = Window.EnumerateProcesses(); local bProcessFound = false; local nProcessHandle = nil; if(tblProcesses)then local strProcessName; local nHandle; for nHandle, strProcessName in tblProcesses do if(String.Find(strProcessName,strName,1,false) ~= -1)then nProcessHandle = nHandle; bProcessFound = true; end end end if(bProcessFound and nProcessHandle)then Window.Close(nProcessHandle,CLOSEWND_SENDMESSAGE); end end
Function Name: FindAndCloseProcessByNameCode:-- Close Internet Explorer if running FindAndCloseProcessByName("iexplore.exe");
Type: Setup Factory 7.0 Function
Created By: Brett Kapilik
Comments? Please post them here.

Reply With Quote