How to make action like Image Capture Tool

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
schwander
Junior Coder
Posts: 29
Joined: Tue Jun 14, 2011 6:32 am

How to make action like Image Capture Tool

Post by schwander » Fri Jun 24, 2011 1:43 pm

Hi,

I need to make action like Image Capture Tool
1. Freeze screen
2. Select and capture screen area to the file. Or may be auto select some rectangle around mouse cursor position (when left/right click happens).

Freeze screen is mandatory.
I need to prevent action called by mouse click.

Best regards.

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

Post by JRL » Fri Jun 24, 2011 7:49 pm

http://www.mjtnet.com/forum/viewtopic.php?t=4156

Go all the way to the last sample posted. You may want to modify the script but how to do what you want is in there.

schwander
Junior Coder
Posts: 29
Joined: Tue Jun 14, 2011 6:32 am

Post by schwander » Sat Jun 25, 2011 11:06 am

Hi, JRL

First of all, I would like to thank you for your script.
Therefore, I have some comments and suggestions:

So, I was really surprised Macro Scheduler %TEMP_DIR% variable returns a folder name in 8.3 format.
And that is another way to workaround this issue.

Code: Select all

GetEnvVar>USERPROFILE,USERPROFILE
RegistryReadKey>HKEY_CURRENT_USER,Environment,Temp,TEMP_DIR
MDL>%TEMP_DIR%
I am going to create small code builder (macro creator) for my friends and my own purposes.
It will be looked as dialog with a few buttons with predefined code (like Code Snippets in MS Editor).
One of the actions will be "Select and Capture screen area". That is the reason of my post.

Futher, I don't like an idea to create temporary ~.bmp for Freezing Screen.
I think dialog's image will be drawing much faster if it (image) will be got from clipboard.

So, my suggestion is to add special FreezeScreen command. Something like this

Code: Select all

Let>FS_Delay=pause (in seconds) before freezing
FreezeScreen>Source_Image_FilePath(or SCREEN),Destination_File(selected screen area),Returned_TopLeft_&_BottomRight_coordinates_of_captured area
Best regards

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

Post by Marcus Tettmar » Mon Jun 27, 2011 7:41 am

I don't think you'll find the clipboard any faster than a temporary file.

Best to use the temporary directory for what it was designed for (temporary storage) rather than the clipboard for what it was not, and risking obliterating the user's last clipboard operation.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

schwander
Junior Coder
Posts: 29
Joined: Tue Jun 14, 2011 6:32 am

Post by schwander » Mon Jun 27, 2011 3:47 pm

So, the FindImagePos command can operate with the SCREEN variable as a haystack image file. I thought there is no temp file using...
... Actually, Dick's macro is good but there are some twitches on the screen when it runs. And I'd like it looks more... emm... ...luxury. Like Image Capture Tool does. :)
And easy to code of course. :)
P.S.
I really need Freeze Screen ability called from my selfmade script. I'm planning to use this function very often.

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