I will 'buy in' if Macro Scheduler Can Do This

Anything Really. Just keep it clean!

Moderators: Dorian (MJT support), JRL

Post Reply
mullerpaulm
Newbie
Posts: 3
Joined: Tue Apr 16, 2013 2:16 am
Location: Thailand
Contact:

I will 'buy in' if Macro Scheduler Can Do This

Post by mullerpaulm » Tue Apr 16, 2013 3:04 am

If Macro Scheduler can do all of the following, I will buy in.
Thanks for evaluating my requirements.

For a single web page being received, part of which is a video feed and part in fixed format:

1. Create fixed-location boxes within the video feed area in which the brightness can be read by ‘calling macro subroutines’ individually pointing into these boxes, the numerical results (including reading the computer system clock) to be acted upon mathematically as part of the real-time running macro/script (including general computation of statistical variation). In other words, to read screen brightness in given (small---tens of pixels square) areas and use those numerical values in basic mathematical processing (either using the script language or by calling a subroutine in another language such as Visual Basic if more convenient for detailed mathematical processing).

The following seem 'givens' in the platform description:

2. Recover a number being displayed in a fixed box (either directly as text or by OCR if graphical).

3. Based on the mathematical results, effect a left mouse click at a given addressed location on the website’s screen as if the mouse had actually been used.

END of Inquiry (Thanks)
Paul M Muller PhD

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Tue Apr 16, 2013 3:43 am

2 & 3 can be done, thats not a problem. As for 1, im not the best person to ask on that one. Maybe Marcus can chip in on that one.
FIREFIGHTER

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Apr 16, 2013 9:15 am

I'm not sure I know the answer to 1 either. I guess it will depend on the software being used to display the video. Macro Scheduler is an automation tool designed for automating other software. So if the video software can be automated and information read from it then I guess Macro Scheduler can use that information to come up with the results you want.

However Macro Scheduler can also get the pixel colour of a specific screen coordinate. It can of course also capture a portion of the screen as a bitmap.

Conceptually then I guess since it can get the pixel color of a pixel it can compare that to a known value to determine brightness based on some rule given to it (get the RGB values and the nearer to white (255) each is the brighter it is?). To use that method I guess you may need to look at all the pixels in a screen area but that can be done in a loop. It might not be fast - it's a high level interpreted automation language after all - not C++.

Quicker might be to get a screen capture of a portion of the screen, save that to file and then use some third party image processing/scanning command line tool which might be able to tell you the brightness. You might perhaps do this periodically and compare the current capture with a previous capture to see which is brighter. I suspect there are command line tools out there which will let you compare bitmaps like this or analyse them in some way you might want.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mullerpaulm
Newbie
Posts: 3
Joined: Tue Apr 16, 2013 2:16 am
Location: Thailand
Contact:

Reply to Marcus with Appreciation

Post by mullerpaulm » Tue Apr 16, 2013 7:45 pm

I was honored to hear directly from the guru, thanks ever so much.

You have indeed answered the main question, because I can take up a small bitmapped (say 4x4 pixel area) and probably brute-force the computation of relative brightness in a loop as you suggest. It's worth trying.

Speed is an issue if one tries to keep this simple, and within Macro Scheduler. I will need to poll perhaps eight of these areas together in a loop at a rate of at least 100 per second while in 'detection mode'. When a 'blip' is detected the computation goes in a different loop, then back again etc.

As a first guess, does this timing seem in the realm of plausibility?

The possibility of grabbing an image and then calling a C++ processing subroutine (or client program clip) is an alternative if the above is too slow.

I'm inclined to give MS a try, and am pleased that the personal-use, single-user license is so reasonably priced. Good show.

Thanks again.
Paul M Muller PhD

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

Post by JRL » Tue Apr 16, 2013 8:42 pm

The following script makes 8 4x4 bitmaps then loops 100 times making 8 new bitmaps of the previous locations and comparing each new bitmap with the base bitmap. Its using Macro Scheduler's CompareBitmaps> function so not an official "brightness" test. On my old Dell Dual core 2.4Ghz Laptop with 2 gig RAM running WinXP I'm averaging about 1.12 seconds to test 8 locations 100 times.

Edit: Compiled the script runs in under 1 second.



Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Caption = 'Bitmap Compare Results'
  ClientHeight = 259
  ClientWidth = 218
  object Label1: TLabel
    Left = 88
    Top = 24
    Width = 32
    Height = 13
    Caption = 'Label1'
  end
  object Label2: TLabel
    Left = 88
    Top = 48
    Width = 32
    Height = 13
    Caption = 'Label2'
  end
  object Label3: TLabel
    Left = 88
    Top = 72
    Width = 32
    Height = 13
    Caption = 'Label3'
  end
  object Label4: TLabel
    Left = 88
    Top = 96
    Width = 32
    Height = 13
    Caption = 'Label4'
  end
  object Label5: TLabel
    Left = 88
    Top = 120
    Width = 32
    Height = 13
    Caption = 'Label5'
  end
  object Label6: TLabel
    Left = 88
    Top = 144
    Width = 32
    Height = 13
    Caption = 'Label6'
  end
  object Label7: TLabel
    Left = 88
    Top = 168
    Width = 32
    Height = 13
    Caption = 'Label7'
  end
  object Label8: TLabel
    Left = 88
    Top = 192
    Width = 32
    Height = 13
    Caption = 'Label8'
  end
end
EndDialog>Dialog1

Show>Dialog1

GoSub>GetImage,Base

Let>count=0
Timer>StartTime
Label>Loop
Add>Count,1
If>Count>100
  Timer>EndTime
  Let>TotalTime={(%EndTime%-%StartTime%)/1000}
  mdl>TotalTime
  Exit>0
EndIf
GoSub>GetImage,Test
GoSub>CompareImages
Goto>Loop


SRT>GetImage
  Let>MBk=0
  Let>TLX=100
  Let>TLY=100
  Let>BRX=104
  Let>BRY=104
  Repeat>MBk
    Add>MBk,1
    ScreenCapture>TLX,TLY,BRX,BRY,%temp_dir%%GetImage_var_1%%MBk%.bmp
    Add>TLX,50
    Add>TLY,50
    Add>BRX,50
    Add>BRY,50
    //MouseMove>BRX,BRY
  Until>MBk=8
END>GetImage


SRT>CompareImages
  Let>CompK=0
  Repeat>CompK
    Add>CompK,1
    CompareBitmaps>%temp_dir%Base%CompK%.bmp,%temp_dir%Test%CompK%.bmp,CompRes
    SetDialogProperty>Dialog1,Label%CompK%,Caption,CompRes
  Until>CompK=8
END>CompareImages

mullerpaulm
Newbie
Posts: 3
Joined: Tue Apr 16, 2013 2:16 am
Location: Thailand
Contact:

Reply to JRL's Amazing Script

Post by mullerpaulm » Wed Apr 17, 2013 12:18 am

That's impressive true-expert 'back of the envelope' responsiveness.

In addtion to that, it amazes me that my rough specifications on timing and the number of observation 'posts' (eight) turned out to be close to reality, when it could (from my beginner's perspective) have been anything between a microsecond and a week!

Also, though I have been away from serious programming for 20 years, this is fairly readable: I might be able to recover sufficient skill to undertake or at least break the back of my application by moving in this direction.

Again, thanks.
Paul M Muller PhD

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Post by Phil Pendlebury » Fri Apr 19, 2013 12:55 pm

Hi Paul,

I think, as long as you are happy that MSched can do what you want, you should not worry about your own skills returning, (which I am sure they will).

But also bear in mind that there are so many skilled, helpful people here, you will never be left out in the cold (as you have already seen I think).

:D
Phil Pendlebury - Linktree

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