mentosan Posted January 12, 2009 Share Posted January 12, 2009 Hi I want to setup a condition in my au3 script based on a running Windows process (which i see it in Task Manager). Any ideas ? Thx Link to comment Share on other sites More sharing options...
FireFox Posted January 12, 2009 Share Posted January 12, 2009 @mentosanHiI want to setup a condition in my au3 script based on a running Windows process (which i see it in Task Manager).Any ideas ?ThxI dont understand your question, can you post some examples ?Cheers, FireFox. Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 12, 2009 Share Posted January 12, 2009 HiI want to setup a condition in my au3 script based on a running Windows process (which i see it in Task Manager).Any ideas ?ThxProcessList()? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
mentosan Posted January 12, 2009 Author Share Posted January 12, 2009 (edited) I'm making a script which sends keys to a command prompt window. I want to insert a condition: the keys will be send only when cmd.exe is present in Task Manager. Edited January 12, 2009 by mentosan Link to comment Share on other sites More sharing options...
youknowwho4eva Posted January 12, 2009 Share Posted January 12, 2009 prcessexists()? Giggity Link to comment Share on other sites More sharing options...
Valuater Posted January 12, 2009 Share Posted January 12, 2009 (edited) Example... While 1 If ProcessExists("cmd.exe") Then ; do stuff MsgBox(4096, "Test", "The cmd.exe process is running ", 3) EndIf Sleep(20) WEnd 8) Edited January 12, 2009 by Valuater Link to comment Share on other sites More sharing options...
FireFox Posted January 12, 2009 Share Posted January 12, 2009 @mentosan Opt("WinTitleMatchMode", 2) While 1 If ProcessExists("cmd.exe") Then If WinActive("cmd.exe") Then ; do stuff Send("test / ") TrayTip("WinActive", "cmd.exe process is running !", 0, 1) Else TrayTip("WinUnactive", "cmd.exe process is running !", 0, 1) WinActivate("cmd.exe") EndIf Else TrayTip("test", "cmd.exe process isnt running !", 0, 1) EndIf Sleep(20) WEnd Cheers, FireFox. Link to comment Share on other sites More sharing options...
mentosan Posted January 12, 2009 Author Share Posted January 12, 2009 It's OK . Thanks a lot ! Link to comment Share on other sites More sharing options...
mentosan Posted January 13, 2009 Author Share Posted January 13, 2009 Hello! I'm back again with one more wish. Here is a part of my code: CODE If ProcessExists("cmd.exe") Then WinActivate("cmd") WinWaitActive("cmd") While 1 Send("{ESC}") ControlSend ("cmd","","",$callnumber[1] & "{Enter}") Sleep ($timer[1]) WEnd Else TrayTip("Command prompt inactive", "Please launch the application", 0, 1) EndIf Sleep(7000) The problem is ,because $timer (which will read from a txt file) is a very high value (like 30 minutes=1800000miliseconds) I must wait all this period until loop will start again. If in the meantime the process "cmd.exe" is started, the script will still wait for this counter. I want to keep the $timer counter and to modify somehow the code that if process "cmd.exe" is started (let's say manually) the script will start to loop from beginning. I hope I'm clear in my state above, sorry because I'm not native english. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted January 13, 2009 Share Posted January 13, 2009 If ProcessExists("cmd.exe") Then WinActivate("cmd") WinWaitActive("cmd") While 1 If ProcessExists("cmd.exe") Then Exitloop Send("{ESC}") ControlSend ("cmd","","",$callnumber[1] & "{Enter}") Sleep ($timer[1]) WEnd Else TrayTip("Command prompt inactive", "Please launch the application", 0, 1) EndIf Sleep(7000) Giggity Link to comment Share on other sites More sharing options...
mentosan Posted January 13, 2009 Author Share Posted January 13, 2009 (edited) If ProcessExists("cmd.exe") Then WinActivate("cmd") WinWaitActive("cmd") While 1 If ProcessExists("cmd.exe") Then Exitloop Send("{ESC}") ControlSend ("cmd","","",$callnumber[1] & "{Enter}") Sleep ($timer[1]) WEnd Else TrayTip("Command prompt inactive", "Please launch the application", 0, 1) EndIf Sleep(7000) Hi ! It's is not ok. It is OK if this command would exist : CODE If ProcessExists("cmd.exe") Then WinActivate("cmd") WinWaitActive("cmd") While 1 If ProcessExists("cmd.exe") Then Exitloop Send("{ESC}") ControlSend ("cmd","","",$callnumber[1] & "{Enter}") If ProcessNOTExists("cmd.exe") Then Exitloop Sleep ($timer[1]) WEnd Else TrayTip("Command prompt inactive", "Please launch the application", 0, 1) EndIf Sleep(7000) Edited January 13, 2009 by mentosan Link to comment Share on other sites More sharing options...
youknowwho4eva Posted January 13, 2009 Share Posted January 13, 2009 (edited) Ah it was a miss wording in your phrasing If ProcessExists("cmd.exe") Then WinActivate("cmd") WinWaitActive("cmd") While 1 Send("{ESC}") ControlSend ("cmd","","",$callnumber[1] & "{Enter}") If not ProcessExists("cmd.exe") Then Exitloop Sleep ($timer[1]) WEnd Else TrayTip("Command prompt inactive", "Please launch the application", 0, 1) EndIf Sleep(7000) and to give you a "why didn't I think of that?" moment If ProcessExists("cmd.exe") Then else Exitloop endif Edited January 13, 2009 by youknowwho4eva Giggity Link to comment Share on other sites More sharing options...
mentosan Posted January 13, 2009 Author Share Posted January 13, 2009 Oh, I'm so....... It looks now quite simple. Thank you very much for your hints ! and Link to comment Share on other sites More sharing options...
youknowwho4eva Posted January 13, 2009 Share Posted January 13, 2009 Oh, I'm so....... It looks now quite simple.Thank you very much for your hints ! and That's the "why didn't I think of that?" moment I was looking for lol. Giggity 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