Jump to content

Close Proccess


Recommended Posts

Hi.

I wrote a script that can create array list from all files in a directory and run exe files, now some exe file after install can run the program.I need a way that after install exe file if program is running, automatically close Proccess.

Thanks

Link to comment
Share on other sites

Hi.

I wrote a script that can create array list from all files in a directory and run exe files, now some exe file after install can run the program.I need a way that after install exe file if program is running, automatically close Proccess.

Thanks

 

maybe something like this?

Run("notepad.exe")
MsgBox(262144,"","After press Button if process exists then close notepad.exe"); this line its only informative
if ProcessExists("notepad.exe") Then; this process its your program running
    ProcessClose("notepad.exe")
EndIf
Edited by boniakowski
Link to comment
Share on other sites

  • Moderators

Do you not know the name of the process you want to close? Seems kind of arbitrary. I would think you would have to constantly monitor with ProcessList() and then parse through this to find the latest addition to the array and close it.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

It's pretty dangerous to (at least) data integrity. "Last launched process" is completely arbitrary in the general case.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

  • Moderators

I agree with jchd. You could even do it through WMI, like so. But the issue remains - you should know what process you're closing.

$WMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$aList = $WMI.ExecQuery("Select * from Win32_Process")

For $process In $aList
    $year = StringMid($process.CreationDate, 1, 4)
    $month = StringMid($process.CreationDate, 5, 2)
    $day = StringMid($process.CreationDate, 7, 2)
    $hour = StringMid($process.CreationDate, 9, 2)
    $min = StringMid($process.CreationDate, 11, 2)
    $sec = StringMid($process.CreationDate, 13, 2)
    MsgBox(0, $process.Name, $month & "/" & $day & "/" & $year & " " & $hour & ":" & $min & ":" & $sec)
Next

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

behdasoft,

Can you say just why you want to do that? It doesn't make sense at all.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I want create an installer to run multiple 3rd party installation packages back to back..Some apps open after installing and I want auto close them as soon as they open.

 

(I translated your quote a bit) Does the software have a link that lets you stop it from opening? This actually sounds like a pretty easy script to make if you have the software installation packages beforehand.

Run(Program1.exe)

Sleep(1000)

Send("{TAB}")

Sleep(300)

Send("{SPACE}")

Sleep(1000)

Send("{ENTER}")

etc etc click finish

Send("{ALTDOWN}" & "{F4"}");Closes the open application in Windows

Do you know the names of the packages you are trying to install? This doesn't make any sense.

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Link to comment
Share on other sites

  • Developers

(I translated your quote a bit) Does the software have a link that lets you stop it from opening? This actually sounds like a pretty easy script to make if you have the software installation packages beforehand.

Run(Program1.exe)

Sleep(1000)

Send("{TAB}")

Sleep(300)

Send("{SPACE}")

Sleep(1000)

Send("{ENTER}")

etc etc click finish

Send("{ALTDOWN}" & "{F4"}");Closes the open application in Windows

Do you know the names of the packages you are trying to install? This doesn't make any sense.

In general you do NOT want to do this when running installers as that is much to error prawn.

I want create installer for run some software automatically One after another. but some apps after install, run automatically and I want auto close themes.

When your installer shells the software, it should know the PID of the shelled process and could kill it when needed.

Now give is something factual to work with because we have been going around in circles for 4 days now.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...