Jump to content

AutoIT - Automation Usage Advice / Help Needed


Sly01
 Share

Recommended Posts

Hi Everyone,

Introduction

I am currently working on a project that was developped a long time ago, so I'm taking old ideas and trying to work with them, but lately, I'm starting to think that maybe I should approach the situation differently then what it was previously automated.

First I would like to mention that I did, "re-write" the code in the latest AutoIT version, so I know the commands I'm using, I already did research about them, but because I was taking an old project, I kind of just reused the idea they had, instead of rebuilding from scratch (which I pretty much did to re-write everything but still keeping how they did things), I mainly kept their idea.

I hope this will be an okay post, I'll briefly describe what the script is for, and ask a few questions after.

Details

The script is quite simple and straight forward, but cannot share everything, for privacy reason obviously, but it's extremely simple script.

The script is running on a Windows 10 machine that we use to Render documents, ready to be archived. We use a Printer program that does that automatically, but it can be done from different softwares (Word, Excel, Acrobat etc...). Obviously when people send documents to be archived (converted into "images") they don't make the documents ready, we are trying to process as many kind as possible. Which may cause error messages popups etc.

So the idea to use AutoIT was to Find the error messages and click them away so our script / rendering document can keep processing files.

The way it was originally developped; the script runs in a constant loop, what the loop does: 

  • Brings every application window to front
  • So every applications we are running (again Word, Excel etc...), is turn by turn on top of the screen. 
  • I think the original idea was, that the window had to be in front for AutoIT to detect the error messages
  • For every applications, we have a list of possible errors that we are looking for and if they are found we just click them away (Either Enter, or few keys to interact with the window)
  • We also try to check that there is not multiple process of every applications, that could cause errors in the rendering process - Kill and restart the applications.

Once we find an error message that popped on the machine, we add it to the script so it can be detected and interacted with the proper way.

That's the big picture of the script we are using with AutoIT. This runs 24h a day non-stop.

So obviously running something like that is quite tedious, but right now is our only solution.

Questions

The first question I have:

     1 - Do I really need to WinActivate() every applications to scroll through them every few seconds to be able to detect error messages?

Isn't it the whole point of using something like:

Local %MyWindowHandle = WinGetHandle("Title"[, "Text"])

     2 - The first problem I'm facing with this script, is that after a while, it doesn't seem to be Interacting with the error messages anymore. It still detects the error messages, as I am logging all the error messages I found, but the send() doesn't seem to be able to interact with the window anymore. 
If I stop the script, and restart it, it finds the error again, and then interact with it, but again after a while it stops interacting with the windows.
Many times it's with WORD and Macro errors, we disabled the Macros completely, but still, if a doc has a Macro enabled or trying to run a Macro when it opens it gives a "Visual Basic" error either 102 or 108. Which I normally interact with to remove it, but after a while, it just detects it and does nothing with it.

     3 - The other thing that they were using, is to keep the applications open with the AutoIT script, so for certain errors, they'd kill the process and restart it with AutoIT.
I am finding this a problem, because I have some display problem with that, my Microsoft Word window starts to open with Black Screens (literally just a black square) or Excel become transparent. Is this something anyone has ever experienced?

Conclusion and my ideas

     1 - As I said earlier, I'm thinking to re-write the script without having so many WinActivate that runs through all our applications that are open.

     2 - Since it's after a while that the errors are not handle anymore, but that it starts working again after it's restarted, could it be a good idea to run a Task Scheduler to run the script every 1 or 2 hours and stop the old instance? 

     3 - I am currently running in 32 bit as we have a need of a 32 bit application to be handled, which means x64 would not handle it properly.

Thanks a LOT for your time if you really went through all of this!!!

Link to comment
Share on other sites

6 hours ago, Sly01 said:

 1 - Do I really need to WinActivate() every applications

probably not, but it seems the safer approach, because if an error message is detected, you'd probably have to activate it anyway.

6 hours ago, Sly01 said:

 2 - The first problem I'm facing with this script, is that after a while, it doesn't seem to be Interacting with the error messages anymore.

first, are you certain the desktop does not go to screensaver/lock/sleep/hibernate? any of those will cripple your automation.

second, instead of using Send() and MouseClick() use ControlSend() and ControlClick(), they are more robust.

6 hours ago, Sly01 said:

 3 - The other thing ...

sounds like "normal" Windows system instability 😐 ... i'd make sure the workstation runs as small as possible amount of processes and services that are necessary for the automation, and i'd make sure i have more than enough RAM available.

 

 

6 hours ago, Sly01 said:

 1 - As I said earlier, I'm thinking to re-write the script

go ahead, that's how it works - if you're not sure, you test and see if it makes a difference.

6 hours ago, Sly01 said:

 2 - Since it's after a while that the errors are not handle anymore, but that it starts working again after it's restarted, could it be a good idea to run a Task Scheduler ...

same as above. it may help, it may not, but you won't know until you test.

6 hours ago, Sly01 said:

   3 - I am currently running in 32 bit

absolutely no problem there. for me it's been a (perhaps long overdue...) habit to compile my code as 32-bit, because i'm never fully certain as to what environment my code may find itself running on, and 32-bit offers better backward compatibility.

 

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Thanks a lot @orbs great information there.

Quote

probably not, but it seems the safer approach, because if an error message is detected, you'd probably have to activate it anyway.

I do WinActivate for the error messages. My error clicking Function looks for the Error message WinActivate it and reacts to it

Quote

first, are you certain the desktop does not go to screensaver/lock/sleep/hibernate? any of those will cripple your automation.

Yes this is one of the first thing we got rid of.

Quote

second, instead of using Send() and MouseClick() use ControlSend() and ControlClick(), they are more robust.

Interesting, never hear about ContolSend - Will be looking into it. I don't use Clicks as you never really know where to click

Quote

sounds like "normal" Windows system instability 😐 ... i'd make sure the workstation runs as small as possible amount of processes and services that are necessary for the automation, and i'd make sure i have more than enough RAM available.

Yeah the machines pretty much runs nothing. The applications that renders documents (Word, Excel, Adobe) and the Java that runs our Rendering Script that is used as an Automation.

Alright then that helps me - Thanks a lot.

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