Jump to content

Before I begin... is this the right tool? Constantly monitor for a window (always)?


Recommended Posts

I have a piece of software that I use on infrequent days, but frequently in those days (if that makes sense).  Annoyingly, there's a form that pops up that I have to fill in every time.  So I thought AutoIt would be perfect for that.  However, my concern is that my PC takes a performance hit for the 90%+ time I'm not actively using the script.

Is the performance hit so negligiblele I shouldn't worry about it?  Or is there some trick so I don't have the hit at all?

I was thinking I'd have the script run at bootup and always be there, waiting for the window.  But maybe there's a better way to do it? 

Thanks.

ps.  I used to use AutoIt a lot back in V2.  Sparingly since it went to V3.  Not at all since probably 3 to 5 years so I'm really out of practice.

Link to comment
Share on other sites

  • Moderators

LondonNDIB,

I have a number of AutoIt scripts running constantly which does not seem to slow down my machine in any noticeable manner. These scripts usually have a Sleep(10) or GUIGetMsg call (which has an internal sleep of about that duration) in a loop - if you can afford to wait a bit longer than the 10 milliseconds which that provides you can reduce the CPU load (if it could even be called that) of the scripts even further.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Great, thank you.  Yes I could probably wait 500 ms or so.

This  may be asking too much... but is there an example script I could use as a template?  I'd like to jump start this.  Just something that demonstrates a structure for a program that runs continuously.

Link to comment
Share on other sites

  • Moderators

LondonNDIB,

You need an example for something so simple? If you insist.....

While 1
    
    If WinExists(.....) Then
        ; Do something
    EndIf
    
    Sleep(500)
    
WEnd

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

As I said:

Quote

ps.  I used to use AutoIt a lot back in V2.  Sparingly since it went to V3.  Not at all since probably 3 to 5 years so I'm really out of practice.

So yes, an example of something so simple is helpful.  No, I didn't "need" it and no, I didn't "insist".  I figured it would be a couple of seconds for you to save me an hour of reading, so I made a simple request.

Answer appreciated... attitude, less so.

Link to comment
Share on other sites

  • Moderators

LondonNDIB,

If you are going to start coding in a "new" language and yet are not prepared to put in the effort to find out for yourself how to create something as simple as an infinite loop to detect a window, I question whose attitude requires adjusting.

Anyway, and I hope more helpfully, might I suggest reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References - which will give you a good grounding in current AutoIt coding.  You should also look at this excellent tutorial - you will find other tutorials in the Wiki (the link is at the top of the page).

Good luck!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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