Capture with mouse

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
math22
Newbie
Posts: 12
Joined: Sun Dec 03, 2017 1:00 am

Capture with mouse

Post by math22 » Thu Feb 01, 2018 2:24 pm

How to capture a select area and display the mouse pointer?

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

Re: Capture with mouse

Post by JRL » Thu Feb 01, 2018 2:41 pm

Forum member Grovkillen posted a method HERE.

math22
Newbie
Posts: 12
Joined: Sun Dec 03, 2017 1:00 am

Re: Capture with mouse

Post by math22 » Sat Feb 03, 2018 2:56 pm

Thanks for the reply, but i need something faster and my mouse pointer is different.

Actually im using irfanview and command line, my script:

Code: Select all

    //      cursor      //
    CODEBLOCK
    Label>cursor

    GetCursorPos>X,Y

    Let>A=X+10
    Let>B=Y+13

    Let>RP_WAIT=1
    Run>C:\Program Files (x86)\IrfanView\i_view32.exe  /capture=1 /crop=(%A%,%B%,1,1) /convert=C:\Users\MATHEUS\Documents\Macro Scheduler 14\Up - Logout\mousea.bmp
    Wait>.2

    CompareBitmaps>C:\Users\MATHEUS\Documents\Macro Scheduler 14\Up - Logout\mousea.bmp,C:\Users\MATHEUS\Documents\Macro Scheduler 14\Up - Logout\mouseb.bmp,match
    If>match=0

    Press RCTRL
    Wait>.1
    Release RCTRL
    Wait>.1

    Goto>cursor

    Endif


    MouseMove>%POS1%,%POS2%
    Wait>.5

    GetCursorPos>X,Y
    If>X=%POS1%
    If>Y=%POS2%

    Goto>cursor_pos

    Endif
    Endif


    Goto>cursor
My script is to check if the mouse pointer is on or off in the screen, when it off it bring it on with RCTRL.

It capture the whole screen using irfanview, then get the mouse pos and crop the captured image in 1pixel, compare that pixel with one mouse pixel saved, if match then mouse is on else brings mouse on.

The problem is irfanview cant capture just the crop area, he capture the whole screen and that take time, i need a fast solution bc i run that script very often.

I wonder if someone know any other program that can capture just a selected area and i could use with macro scheduler.
For example:

Code: Select all


GetCursorPos>X,Y

Let>X1=X
Let>Y1=Y
Let>X2=X+1
Let>Y2=Y+1

Run>C:\Program Files (x86)\??????.exe  /capture=(%X1%,%Y1%,%X2%,%Y2%) C:\Users\MATHEUS\Documents\Macro Scheduler 14\Up - Logout\mousea.bmp


CompareBitmaps>C:\Users\MATHEUS\Documents\Macro Scheduler 14\Up - Logout\mousea.bmp,C:\Users\MATHEUS\Documents\Macro Scheduler 14\Up - Logout\mouseb.bmp,match
    If>match=0

    Press RCTRL
    Wait>.1
    Release RCTRL
    Wait>.1

    Goto>cursor

    Endif
That way it would be a lot faster.

Post Reply