Intelligent Script Control

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
fthomas
Pro Scripter
Posts: 91
Joined: Fri Oct 03, 2008 6:40 pm

Intelligent Script Control

Post by fthomas » Wed Sep 17, 2014 4:56 pm

Good day,

I'd like to find ways to more intelligently control my scripts. Many times I cannot access a control easily with MS (more lack of knowledge then anything else, I'm sure), and I'd like to master MS better by learning how to better read the screen intelligently, especially when I cannot see a control from the app. A good example is I'm using screen shots to look for things that change, but in one case, I have a box that contains a % done and I'd like to be able to sample that box and read the info in it and see if things get hung. Right now, I've got a timer that considers things a fail if things take more then 60 minutes.

This may be further training by you Marcus, which I'm up for, but I'd like to really start digging much deeper with MS.

Thanks,

Frank

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Intelligent Script Control

Post by Dorian (MJT support) » Wed Sep 24, 2014 11:15 pm

Is the progress bar in an application, a web page, or something else? It's quite possible the one of the built in Macro Scheduler Wizards can help you extract that value. Which wizard, of course, depends on how the percentage is being displayed.

A few places that might be worth investigating :

The Find Object Wizard
The Find IE Element Wizard
The Text Capture Wizard

Also, does your progress counter have any kind of progress bar? If so, you could use GetPixelColor to monitor progress.
Yes, we have a Custom Scripting Service. Message me or go here

fthomas
Pro Scripter
Posts: 91
Joined: Fri Oct 03, 2008 6:40 pm

Re: Intelligent Script Control

Post by fthomas » Wed Sep 24, 2014 11:20 pm

In the particular program that I'm trying to monitor, I've tried just about everything (windows app - Easy Video Suite) and I cannot extract a numerical value from the percentage done indicator. It displays it but darned if I can find a way to extract it.

If I could find a way without snapping 10 to 100 images to monitor how long it stays on a particular value, it would be great. right now I'm using a timed loop that considers the job hung if it takes longer then 3 hours. Not the best way. Mainly because with deductive reasoning I can know that the process is stuck because it sits on the same percentage during conversion for way too long. :roll:

To date, I've tried the process tool, the text capture tool and really the only thing that is semi-reliable is image capture with the co-efficient set to 1.

Frank

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Intelligent Script Control

Post by JRL » Thu Sep 25, 2014 3:16 pm

Have you thought about using WaitPixelColor> or GetPixelColor> in a loop? I have many scripts where I use GetPixelColor> and scan a small area either waiting for the pixel to become a specific color or sometimes waiting for a pixel to not be a specific color.

For example if you are waiting for a progress bar that perhaps is fancy and changes colors. Usually the background behind where the progress bar is extending remains a specific color. So find the location of the last pixel to the far right (assuming its filling in to the right) of the background and test that location using GetPixelColor> in a loop. When the color is NOT the background color, you know the progress bar has completed.

fthomas
Pro Scripter
Posts: 91
Joined: Fri Oct 03, 2008 6:40 pm

Re: Intelligent Script Control

Post by fthomas » Thu Sep 25, 2014 5:53 pm

that's actually a great idea. I can now use math to compute the next pixel positions and watch for the color to change and if it doesn't in a smaller timeframe, then I know I've got issues.

Frank

fthomas
Pro Scripter
Posts: 91
Joined: Fri Oct 03, 2008 6:40 pm

Re: Intelligent Script Control

Post by fthomas » Thu Sep 25, 2014 10:29 pm

I wanted to thank you again. Your insides have given me a new way to solve an ugly problem. Sometimes I find that I get fixed on the wrong solution. I was able to easily write a new routine that checks the progress bar about every 5 minutes and reports back if it gets stuck!

Thanks

Frank

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts