behdadsoft Posted July 23, 2014 Share Posted July 23, 2014 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 More sharing options...
Geir1983 Posted July 23, 2014 Share Posted July 23, 2014 you mean ProcessClose()? Link to comment Share on other sites More sharing options...
behdadsoft Posted July 23, 2014 Author Share Posted July 23, 2014 I know ProcessClose() can close process but I need a way for automatically close Process. Link to comment Share on other sites More sharing options...
boniakowski Posted July 23, 2014 Share Posted July 23, 2014 (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 July 23, 2014 by boniakowski Link to comment Share on other sites More sharing options...
behdadsoft Posted July 23, 2014 Author Share Posted July 23, 2014 I want automatically get latest run Proccess name then close it. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 23, 2014 Moderators Share Posted July 23, 2014 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 More sharing options...
jchd Posted July 23, 2014 Share Posted July 23, 2014 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
Moderators JLogan3o13 Posted July 23, 2014 Moderators Share Posted July 23, 2014 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 More sharing options...
behdadsoft Posted July 26, 2014 Author Share Posted July 26, 2014 Thanks JLogan3o13. I don't Know what is Latest Process Name. I need automatically get latest Process and close it. Link to comment Share on other sites More sharing options...
Gianni Posted July 26, 2014 Share Posted July 26, 2014 maybe >this link could also interest you Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
jchd Posted July 26, 2014 Share Posted July 26, 2014 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
behdadsoft Posted July 27, 2014 Author Share Posted July 27, 2014 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. Link to comment Share on other sites More sharing options...
computergroove Posted July 27, 2014 Share Posted July 27, 2014 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 More sharing options...
Developers Jos Posted July 27, 2014 Developers Share Posted July 27, 2014 (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 July 27, 2014 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now