Liberty BASIC Community Forum
« Auto mouse click... »

Welcome Guest. Please Login or Register.
Jan 23rd, 2018, 7:26pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Auto mouse click...  (Read 231 times)
JohnnyD
Guru
ImageImageImageImageImage


member is offline

Avatar

"If something should, then it doesn't, isn't, can't, hasn't or won't"


Homepage PM

Gender: Male
Posts: 766
xx Auto mouse click...
« Thread started on: Nov 18th, 2016, 05:36am »

Hi all,

Not sure if this will be useful but I wrote it to run a microcontroller emulator to step through the code.

The emulator will either run at full speed or execute single instructions so that the code can be followed, by clicking the "step through" button.

However, if there are a lot of steps to go through, e.g. performing a calculation with a lot of instructions, the finger gets very tired with all that clicking of the mouse button, and on top of that it is time consuming and boring, when other work can be done, hence this program.

Place the crosshairs over the button to operate, enter a number of operations of the button and sit back and relax. No more sore fingers.

Code:
    nomainwin
    WindowWidth=200
    WindowHeight=76
    WS.EX.LAYERED=524288
    style=WS.EX.LAYERED or _WS_EX_TOPMOST
    stylebits #1,0,0,style,0
    graphicbox #1.gb,0,0,50,50
    button #1.default,"Start",[start],UL,50,-1,50,50
    textbox #1.num,105,5,36,22
    statictext #1.ct,"0",145,8,30,14
    stylebits #1.ct,_SS_RIGHT,0,0,0
    open "MouseClickSim" for window_nf as #1
    hMain=hwnd(#1)
    COLORREF=1+(256)+(256*256)
    calldll #user32,"SetLayeredWindowAttributes",hMain As ulong,COLORREF As ulong,bAlpha As ulong,1 As ulong,ret As ulong
    if ret=0 then [quit]
    #1,"trapclose [quit]"
    #1.gb,"down;fill 1 1 1;size 1;home"
    #1.gb,"color black;line 24 12 24 35"
    #1.gb,"line 12 23 35 23"
    #1.gb,"flush"
    wait

[loop]
    scan
    if start=0 then wait
    h=hwnd(#1)
    struct point,x as ulong,y as ulong
    point.x.struct=24
    point.y.struct=23
    calldll #user32, "ClientToScreen",h As ulong,point as struct,r as ulong
    clientX = point.x.struct
    clientY = point.y.struct
    calldll #user32,"SetCursorPos",clientX as ulong,clientY as ulong,r as boolean
    dwFlagsDn=_MOUSEEVENTF_ABSOLUTE or _MOUSEEVENTF_LEFTDOWN
    dwFlagsUp=_MOUSEEVENTF_ABSOLUTE or _MOUSEEVENTF_LEFTUP
    calldll #user32,"mouse_event",dwFlagsDn as ulong,0 as ulong,0 as ulong,0 as ulong,0 as ulong, re as void
    calldll #kernel32,"Sleep",100 as ulong,r as void
    calldll #user32,"mouse_event",dwFlagsUp as ulong,0 as ulong,0 as ulong,0 as ulong,0 as ulong, re as void
    calldll #kernel32,"Sleep",800 as ulong,r as void
    count=count-1
    #1.ct,count
    if count=0 then [start]
    goto [loop]

[start]
    start=start xor 1
    #1.num,"!contents? count"
    if count=0 then start=start xor 1
    if start=1 then
        #1.default,"Stop"
        #1.ct,count
    else
        #1.default,"Start"
    end if
    goto[loop]

[quit]
    close #1
    end
 
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls