Macro Scheduler Sketch Pad

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

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

Macro Scheduler Sketch Pad

Post by JRL » Thu Nov 01, 2007 4:04 am

A little fun for the holidays.

Hold your mouse click button down to draw.

Click on the eraser in the upper left hand corner and move it around to erase. Click again to park the eraser.

Press Print Screen key to save the screen image to the clipboard.

Press F5 key to erase the entire screen.

Press ESC to quit

This isn't going to replace any CAD software but demonstrates another amazing capability of Macro Scheduler

Code: Select all


OnEvent>KEY_DOWN,VK27,0,Quit
OnEvent>KEY_DOWN,VK1,0,Draw
OnEvent>KEY_DOWN,VK44,0,Save
Let>StartFlag=0
Let>NoDrawFlag=0

GetScreenRes>ScreenX,ScreenY
Let>scrX={-1*%ScreenX%}
Let>scrY={-1*%ScreenY%}
ScreenCapture>%ScrX%,%ScrY%,0,0,%TEMP_DIR%Whitespace.bmp

Dialog>Doodle1
   Caption=Doodle Pad
   Width=%ScreenX%
   Height=%ScreenY%
   Top=0
   Left=0
   Close=0
   Button=Erase  X  Erase,10,10,20,20,10
   Image=%TEMP_DIR%Whitespace.bmp,0,0,%ScreenX%,%ScreenY%,newimage
EndDialog>Doodle1

Show>Doodle1

Label>start
GetDialogAction>Doodle1,res1
if>Res1=2,EOF
if>Res1=10,Erase
If>StartFlag>0
  Add>startFlag,1
  If>StartFlag>5
    Let>StartFlag=0
  EndIf
EndIf
Wait>0.01
Goto>start

SRT>Quit
  Goto>EOF
END>Quit

Label>EOF

SRT>Erase
  RDA>Doodle1
  Label>KeepErasing
    Let>NoDrawFlag=1
    Wait>0.01
    GetCursorPos>CurX,CurY
    Sub>CurX,15
    Sub>CurY,35
    MoveWindow>Erase  X  Erase*,curX,CurY
    GetDialogAction>Doodle1,res1
    if>Res1=10,FinishedErasing
  Goto>KeepErasing
  Label>FinishedErasing
    RDA>Doodle1
    Wait>0.5
    Let>NoDrawFlag=0
END>Erase

SRT>Draw
  If>NoDrawFlag=1,NoDraw
  If>StartFlag=0
    GetCursorPos>CurX,CurY
    LibFunc>user32,GetDC,HDC,0
    Libfunc>gdi32,MoveToEx,mtres,HDC,CurX,CurY,0
    Libfunc>gdi32,LineTo,ltres,HDC,CurX,CurY
  EndIf
  Let>StartFlag=1
  Wait>0.01
  GetCursorPos>CurX,CurY
  Libfunc>gdi32,LineTo,ltres,HDC,CurX,CurY
  Label>NoDraw
END>Draw

SRT>Save
  MoveWindow>Erase  X  Erase*,-1000,-1000
  Press Print Screen
  MoveWindow>Erase  X  Erase*,10,10
END>Save

stev3n
Junior Coder
Posts: 22
Joined: Thu Nov 01, 2007 1:13 am

Post by stev3n » Thu Nov 01, 2007 5:08 am

Pretty nice.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Nov 01, 2007 3:18 pm

Wow :shock: That's just amazing :D

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Nov 02, 2007 3:12 am

Another dialog marvel... It does make me wonder though, could the drawing color be something other than black? Blue? Red maybe? Just wondering...

Very nice, thanks again JRL, amazing stuff.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

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

Post by JRL » Fri Nov 02, 2007 5:24 am

It does make me wonder though, could the drawing color be something other than black? Blue? Red maybe? Just wondering...
I'm glad you asked, I post things hoping to stir up interest.

Yes, I think the line color can be changed. I also think the line width can be changed. I think you can draw arcs and circles and rectangles. I have not tried to make it happen but if someone had time and interest I believe that they could pretty much recreate MsPaint.exe using Macro Scheduler and windows APIs. On the other hand why bother, Paint is already freely available.

Look up "MoveToEx" on the Microsoft website. It is a good starting point to find other API drawing functions.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Nov 02, 2007 6:07 am

Great work Dick.

I was going to try it this weekend, but could not wait. Not sure of a real use yet, but more tools to put in the toolbox. So where do you find the time to do these things ..... I am jealous.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Rory
Pro Scripter
Posts: 50
Joined: Thu Mar 23, 2006 2:50 pm
Location: Wisconsin

Post by Rory » Sat Nov 17, 2007 12:12 am

So where do you find the time to do these things ..... I am jealous.
Thats an understatement....
Very nice though.

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