Sign in to follow this  
Followers 0
behdadsoft

Close Proccess

14 posts in this topic

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

Share this post


Link to post
Share on other sites



you mean ProcessClose()?

Share this post


Link to post
Share on other sites

I know ProcessClose() can close process but I need a way for automatically close Process.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

I want automatically get latest run Proccess name then close it.

Share this post


Link to post
Share on other sites

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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

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

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Thanks JLogan3o13.

I don't Know what is Latest Process Name. I need automatically get latest Process and close it.

Share this post


Link to post
Share on other sites

maybe >this link could also interest you


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

 

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

 

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

(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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0