Jump to content

Running a listener script


Recommended Posts

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

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 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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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 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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

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 by TestMachine
Link to comment
Share on other sites

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

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...