manually capture image

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

manually capture image

Post by Aaron » Tue Apr 10, 2007 3:48 pm

Is there a way to manually capture the screen other than the print screen button. I want to know if MS has a command.

I dint see one in the commands list.

I would like to make a macro that captures an image of the screen with a hotkey then opens a dialog box asking for the name and location to store it.

It would also be nice to have an option to assign a directory and or a name with say a checkbox for times I would like to use this default name and path.

thanks
Aaron

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

Post by JRL » Tue Apr 10, 2007 4:25 pm

Look up ScreenCapture> in help.

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

Post by Aaron » Tue Apr 10, 2007 4:59 pm

I'm already using screen capture, The idea is to manually do this with hotkey.
much faster and if the image always the same an never changes, there is no need to capture it when I could just tell the program to get the image or wait for the image.

I want to save time while writing code and keep my code small and simple.
That is why I would like the dialog box to appear. After all isn't that what macros are for?

I have read the whole manual, If this is useless because there is a quicker way to achieve all these steps please point me in the right direction

Thanks for the reply.
Aaron

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 » Tue Apr 10, 2007 5:58 pm

Macro Scheduler is excellent at duplicating keystrokes, plus includes some other functions.

On many computers you can do SHIFT-Print Screen to capture the entire screen to the clipboard. And ALT-Print Screen captures the Active window vs. the whole screen.

I don't have access right now, but can you try
Press>SHIFT
Press>Print Screen
Release>SHIFT
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

Let me tell you a little more

Post by Aaron » Tue Apr 10, 2007 6:14 pm

Let me tell you a little more about what I need this for.
I work with photoshop a lot. I first need to capture the screen as you described. then I have to click on photoshop, wait for it to open, create a new photoshop document then paiste in the image from the screenshot. Next I need to save the file to a directory with the appropriate name.

Now maybe you can see the time it would save to just hit a hotkey and name it with the directory already set by using the ckBox I was talking about.

Also it would be helpful if theres a way to resize the image if needed.
Can I use FileSize to capture the size and then change it somehow

Any suggestions would be appreciated

Thanks Bob
Aaron

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

Post by JRL » Wed Apr 11, 2007 3:27 am

Place this into a script and set the hotkey to the selection of your choice.
Hope this is close to shat you're looking for. Should be close enough for you to adapt it.

Macro Scheduler can't resize your image for you but it can run a program that could. My choice would be IrFanView. It has command line options to resize, so it can perform the task invisibly.

Code: Select all

Dialog>Dialog1
   Caption=Dialog1
   Width=619
   Height=182
   Top=376
   Left=363
   Button=Ok,272,120,75,25,3
   Label=Enter a name for the 'Screen Capture' file or browse to an existing file to overwrite,112,16
   Button=Browse,24,40,75,25,0
   Edit=msEdit1,112,40,473,c:\_testScreenShot
   CheckBox=msCheckBox1,Check to add Date/Time to the file name,112,72,233,True
   FileBrowse=Browse,msEdit1,BMP Files|*.bmp,open
EndDialog>Dialog1

Show>Dialog1,r1
If>r1=2,EOF
GetScreenRes>sX,sY
If>%dialog1.mscheckbox1%=True
  Day>dd
  Month>mm
  Year>yyyy
  Hour>hh
  Min>mn
  Sec>ss
  ScreenCapture>0,0,%sX%,%sY%,%dialog1.msedit1%_%mm%-%dd%-%yyyy%_%hh%-%mn%-%ss%.bmp
Else
  ScreenCapture>0,0,%sX%,%sY%,%dialog1.msedit1%.bmp
EndIf
Label>EOF
Edit---Sorry, I typoed IrFanView... should be correct now and added a link.
Last edited by JRL on Wed Apr 11, 2007 1:33 pm, edited 1 time in total.

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

Thanks JRL

Post by Aaron » Wed Apr 11, 2007 5:20 am

This will help alot.
I will work on it a bit to try and get it the way I want it.
and thank for the irifView tip.
Aaron

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

question for JRL

Post by Aaron » Fri May 04, 2007 6:43 am

Show>Dialog1,r1
If>r1=2,EOF
What is r1
what is EOF
Aaron

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

Post by JRL » Fri May 04, 2007 3:10 pm

What is r1
From Help for Show>,

Code: Select all

Show>DialogName[,Result]
.....
Result is set to the modal result value of the button that was pressed.
In other words, r1 is an arbitrary name for a variable that captures the result that corresponds with a dialog button. At the end of each dialog button definition there is a number.

Button=Ok,272,120,75,25,3

That number is captured when the button is pressed and assigned to the variable assigned to the Show> function. If the user presses the Ok button, the value of variable r1 becomes 3 the rest of the program can then proceed according to the user selection.

The line:
If>r1=2,EOF

Therefore
If the "X" at the top of the dialog is pressed the value of r1 = 2 and the program proceeds to the label EOF
what is EOF
EOF is a label name. Again the choice is arbitrary but EOF is an acronym for End Of File and is thus fitting to be the name of a lable that resides at the end of the file.

Hope this helps,
Dick

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

Thanks for the examples

Post by Aaron » Fri May 04, 2007 7:17 pm

You made it real easy to understand

Thanks for the examples.
Aaron

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