Is Time-Based Image Recognition Possible?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Tue Jun 11, 2013 9:55 pm

Dear Samper,
The essence of my post above isn't about -1.2 negative reputation points you voted agaist me. Honestly I respect your vote and your wish.
Rather, it'll be much constructive and helpful if you can kindly explain your negative vote so that I can improve my future participation here.
Thanks for your kind understanding in advance.

rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

Post by rjw524 » Wed Jun 12, 2013 5:15 am

JRL wrote:An assumption on my part and also assuming that rjw524 can figure out how to determine an exact color match at a specific pixel location on the screen
yep
JRL wrote:and also assuming that the "red" "outside limit" message appears in the exact same location every time it pops up.
yep
JRL wrote:All reasonable assumptions I believe.
yep
I assume he will be running this on the same computer day after day
after day after day after day, lol...yep
JRL wrote:I don't think of scripts used in a single workplace as needing to be excruciatingly flexible. They do need to be excruciatingly reliable.
Absolutely.

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Post by PepsiHog » Wed Jun 12, 2013 1:05 pm

@ JRL,

*YOU ROCK!*

I know this isn't my post, but I have to hand it to you for putting in the time to help rjw524. I tried to help based on the assumption a macro had already been started. But (may be my bad) I backed out when I realized no attempt had been made. Sorry rjw524. I'm just not that awesome. I just tend to believe you should try before asking for help.

But that said, I also understand how overwhelming it can be just starting with new software. So maybe next time I'll reconsider. This likely makes me sound awful, but just being honest.

Way to help! JRL!

@ armsys,

That was crap! So I did what I did. :? [edit] - You can't improve on the kind hearted help you give to everyone.

PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Wed Jun 12, 2013 1:23 pm

PepsiHog wrote:@ armsys,
That was crap! So I did what I did. :? [edit] - You can't improve on the kind hearted help you give to everyone.
Appreciate your encouraging feedback. I have much to learn from PepsiHog as well as RAIN, JRL, CyberCitizen,....etc. Did I tell you I'm a macchiato guy?
Last edited by armsys on Wed Jun 12, 2013 1:57 pm, edited 1 time in total.

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Post by PepsiHog » Wed Jun 12, 2013 1:34 pm

@ armsys,

LOL. Good then there is a good chance you won't develop Alzheimers! Pepsi, coffee, what's the difference?

PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Thank You

Post by armsys » Wed Jun 12, 2013 1:56 pm

PepsiHog, Rain, and CyberCitizen,
I just discover my reputation miraculously raises to 67.6 point just like DJIA and Nasdaq this morning.
I don't deserve such awards in the absence of my honest diligence.
As a matter of abundance of cautions, the purpose of my 2 previous posts to Samper is to find out the exact cause of his negative vote whereby I can be improve my effort and/or etiquette in conversations here especially when considering myself being probably the only Chinese MS user here.
IMHO, there're only 3 most productive developers in the known Universe: Macro Scheduler, XYplorer, and AmiBroker. Correct me if I'm wrong.
Thanks you again for your generous support indeed.

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

Post by JRL » Wed Jun 12, 2013 3:02 pm

Logged in a bit ago, started reading and found my self quite perturbed. I see several forum members have given armsys some points and thinking that was a good idea, I did also, Thought I'd bump him back up to 100 so gave him 40 points but when I looked afterward somehow I gave him 70 points. Makes me wonder if the forum software is in some way altering votes. Perhaps Semper did not actually vote negative. If he voted and didn't go back and check or has not read the latest messages he may not even know. There's no way I know of to alter your vote once cast so even if he knows not much he could do except apologize.

This is an "excruciatingly" friendly forum. Its difficult for me to believe someone here would dis another member for no apparent reason.

@rjw524 and PepsiHog
Thanks for the positive feedback. Greatly appreciated.

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Wed Jun 12, 2013 3:30 pm

JRL wrote:Logged in a bit ago, started reading and found my self quite perturbed. I see several forum members have given armsys some points and thinking that was a good idea, I did also, Thought I'd bump him back up to 100 so gave him 40 points but when I looked afterward somehow I gave him 70 points.
Hi JRL,
You're one of my respectable MS gurus here.
Firmly I stand by my last post -- I don't deserve the unearned reputation points. I'll just return all 70 points back to you. After all, it's your hard-earned reputation points.
Meanwhile, I look forward to the much anticipated scripts of June 2013 from PepsiHog, JRL, RAIN, and CyberCitizen.

rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

@ PepsiHog, armsys & JRL

Post by rjw524 » Thu Jun 13, 2013 1:13 am

I very MUCH appreciated ALL of your help. I mean that 100% wholeheartedly, no BS from the bottom of my heart!

I'm not sure if you guys are programmers or not, but sometimes programmers by trade or formal training, can fall into the habit of thinking certain things are obvious or givens that non-programmers, such as myself have no clue about. Not all programmers of course, but some.

@PepsiHog, you helped tremendously by letting me know that the software, which for me is absolutely overwhelming, can do what I needed.

I always try a code before asking for help. It's the only way to get better. Also, if I can't figure it out, I search the forums extensively for similar code solutions.

So, I saw that there was a timer in MS. And I assumed that it would be intrinsic for the program to pretty much time anything. But I didn't know if the timer could execute a command based on the duration of a event.

For instance, there's a major difference between:

A) "watch this application for 10 seconds, if Image A appears within the 10 seconds or if Image A is visible when the 10 seconds is up, then do X"

vs

B) "watch this application for 10 seconds. If Image A is on the screen for at least 2.0 seconds, then perform X."

from the example in the help section I couldn't tell if the timer could do B. I knew it could do A, if that makes sense.

And nothing I had tried or seen while searching the forums answered this.

So, your help was VITAL. I actually started working with the skeleton code you provided before seeing armsys' response.

@armsys, your help was great also. I was going to ask you a question about it, because when I tried it, I was able to get it to do provide a result if the image appeared within the time frame, but I couldn't get it to use the duration of the image. I am absolutely certain that it was something on my end and not your code.

@JRL, the code you provided was spot on. You've always been very responsive and more than willing to help when I've posted a question on here and I very much appreciate that!

So, I wanted to take a moment to say "group hug", LOL. Because, it is a LONELY feeling, when you post a question and get no response. So, I encourage you guys to continue posting and trying to help out, because it all gets us non-programmers, a little closer.

I will definitely be giving points to everyone who helped out in this!

rj
Last edited by rjw524 on Thu Jun 13, 2013 1:49 am, edited 1 time in total.

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Post by PepsiHog » Thu Jun 13, 2013 1:45 am

Just as a side note. I am using version 12.1.10. I was unaware of the command Timer> since version 12 does not have it.

I am making this side note because I want it undestood that I do not know what the capabilities of Timer are. Timer may be equal to the VB script I posted. And I suspect it is.

Glad I helped,
PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Thu Jun 13, 2013 1:54 am

Hi PepsiHog,
Timer> only emerged from v13.0 Nov 14, 2011.
Version 13.0 14/11/2011
For more info see: v13 Release Notes
Script Engine Improvements:
New functions to find and access UI objects and send keystrokes to them directly (without them requiring focus)
Updated Text Capture libraries for support for more applications and access to 64 bit processes (GetTextAtPoint, GetTextInRect, GetWndowTextEx, WaitScreenText)
OnEvent event handlers are now checked concurrently during script execution (therefore react faster)
New OnEvent types: PROCESS_EXISTS, PROCESS_NOTEXISTS, PIXEL_COLOR, DATE, TIME, CUSTOM
Ability to define custom event handlers
Internal Improvements to the following functions to prevent hang ups if target apps are in a hung state: FindWindowWithText, GetWindowText, GetControlText, SetControlText, GetWindowList, PushButton
Ability to include commas in function parameters (as long as the parms are delimited with {" ... " }
Error messages now output to log file
Ability to get cursor type from GetCursorPos (additional optional parameter).
Ability to define custom error handler (Let>ONERROR=subroutinename)
Ability to delete variables and arrays
Ability to specify CF_HTML format to GetClipboard to retrieve HTML from clipboard
Ability to specify a window title to FindImagePos to search only within that window
Calling Exit while a Wait operation is in progress will now terminate it immediately

New Script Commands:
ArrayDim
DelVariable
DelArray
Wow64DisableRedirection
Wow64EnableRedirection
DateAdd
DateDiff
DatePart
DateLocal
TimeAdd
TimeDiff
TimePart
TimeLocal
Timer
GetOldestFile
GetNewestFile
GetTextPos
FindObject
SetObjectText
ObjectSendKeys
ObjectSendText
GetWindowChildList
ColorToRGB
RegistryEnumKeys
RegistryEnumVals
GetWindowParent
XLSheetToArray
GetTextInit
HTMLDecode
HTMLEncode
ModTrayIcon
PopupMenu

New System Variables
OS_PLATFORM
RP_WIN64PROCESS
SYS_NATIVE
PROGRAM_FILES
PROGRAM_FILES_NATIVE

User Interface Improvements:
Added icons to code builder tree
New Image Recognition Code Wizard
New Keyboard Code Wizard
New Mouse Code Wizard
New Send Keys to Object Code Wizard
New Text Capture Code Wizard
Image Capture code builder now defaults path to %SCRIPT_DIR% if bmp saved to script folder
Added button to invoke connection string builder to DBConnect code builder
Added "Stats" tab to Macro Properties to display runtime statistics and savings calculator
Improved display of arrays in debugger watch list
Option to disable scheduler while editing/debugging
Hotkeys can now be group specific (so macros in different groups can share hotkeys)
Properties grid in custom dialog designer now allows columns to be resized

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Thu Jun 13, 2013 1:56 am

From the manual:
Timer>result
Returns the number of milliseconds that have elapsed since the script was started.
Example:
Timer>startTime
..
.. do something here
..
Timer>endTime
Let>elapsed_seconds={(%endTime%-%startTime%)/1000}
MessageModal>Seconds elapsed: %elapsed_seconds%

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Thu Jun 13, 2013 2:01 am

Marcus,
Given the fact that the PepsiHog is a passionate aficionado of Macro Scheduler helping other users here, would you please offer him a free license of MS 14? Your favorable consideration will be much appreciated by the Macro Scheduler community.

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