TestMachine Posted February 12, 2012 Share Posted February 12, 2012 Hi again beautiful creatures!I have a small listener script that constantly checks for unwanted windows, and closes them down.The thing I'm trying to solve is how to run this script at the same time as my regular script is doing stuff.I'm very new to AutoIt so I wonder whats the best approach is here coming from the pro's Should I just run the script seperately by the startup of my original script? If True Then How do I do this ? The script is being located in the same folder as my other scripts under C:/MyScripts, which is not the AutoIt folder. Link to comment Share on other sites More sharing options...
johnmcloud Posted February 12, 2012 Share Posted February 12, 2012 ProcessExist? Link to comment Share on other sites More sharing options...
water Posted February 12, 2012 Share Posted February 12, 2012 (edited) Please have a look at my OutlookEX UDF (for download please see my signature). Function _OL_Open starts _OL_Warnings.exe and passes some parameters to this exe (process Id, timing information etc.). This exe runs as long as the starting process exists. Edited February 12, 2012 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
TestMachine Posted February 12, 2012 Author Share Posted February 12, 2012 ProcessExist?This only shows me if a certain process exists, could you elaborate? Link to comment Share on other sites More sharing options...
water Posted February 12, 2012 Share Posted February 12, 2012 (edited) Script A starts the compiled script B and passes the process-Id of A. B checks in a loop 1) for windows to close and 2) if the calling process A still exists (using processexist). If A doesn't exist any longer B exits itself. Edited February 12, 2012 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
TestMachine Posted February 12, 2012 Author Share Posted February 12, 2012 Script A starts the compiled script B and passes the process-Id of A. B checks in a loop 1) for windows to close and 2) if the calling process A still exists (using processexist). If A doesn't exist any longer B exits itself.So it has to be compiled? And lets say I just wanted to run 3-4 .au3 scripts at the same time to do different things, how would I make the first script execute the other ones? I understand this is not very optimal, but I just want to play around and learn .Thanks Link to comment Share on other sites More sharing options...
johnmcloud Posted February 12, 2012 Share Posted February 12, 2012 Do you want to start the second script if the first is working, right? If ProcessExist(first.exe) Then Run(@WorkingDir & "second.exe") EndIf Or a loop Func Test() Do Sleep(1000) Until ProcessExists(first.exe") Run(@WorkingDir & "second.exe") EndFunc Link to comment Share on other sites More sharing options...
water Posted February 12, 2012 Share Posted February 12, 2012 Best way to learn is to take a real life problem and write a script to solve it. Creating a problem and then trying to solve it is a bit of a waste of time. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
IanN1990 Posted February 12, 2012 Share Posted February 12, 2012 For what its worth, in my past i used to use Processexists to check things but rapidly found its a heavy CPU function. Running at 250 (sleep) my script was using 6-8 cpu, i replaced them with a Winexists "as in my cases the processes all had a active window somewhere i could check to see if it existed and this had the postive effect of lowering the cpu usage for my script to 0" Link to comment Share on other sites More sharing options...
TestMachine Posted February 12, 2012 Author Share Posted February 12, 2012 (edited) Best way to learn is to take a real life problem and write a script to solve it.Creating a problem and then trying to solve it is a bit of a waste of time.There is a real life problem to solve behind the scenes, I just tried to simplify my explanation of it. I appreciate your help very much and I get your point.I have one Au3 script that is running and doing a lot of things, but a lot of things are popping up in its way to slow its progress down, which is why I want to run a script on the side to eliminate the obstacles entirely, while doing stuff like counting seconds, minutes, looking for colors e t c. If I were to do everything in my first script, a simple Sleep() will paus everything else (from what I've learned so far). That is the best explanation that I can come up with, since I got so much to learn. Edited February 12, 2012 by TestMachine Link to comment Share on other sites More sharing options...
TestMachine Posted February 12, 2012 Author Share Posted February 12, 2012 For what its worth, in my past i used to use Processexists to check things but rapidly found its a heavy CPU function. Running at 250 (sleep) my script was using 6-8 cpu, i replaced them with a Winexists "as in my cases the processes all had a active window somewhere i could check to see if it existed and this had the postive effect of lowering the cpu usage for my script to 0"This too, I'm happy with running my second script only once every 10 seconds. Link to comment Share on other sites More sharing options...
water Posted February 12, 2012 Share Posted February 12, 2012 Then I would suggest my approach. Give it a try and if you run into any problems we will be glad to assist you. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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