Sign in to follow this  
Followers 0
johngreen2000

can autoit access the clipboard?

9 posts in this topic

I am attempting to make a script so that when pressing a hotkey a screenshot will be taken and saved to a file automatically.

My plan was

set up a hot key to press print screen

open mspaint hidden

paste to mspaint

save as filexxx where xxx can either be a random number or ascending number.

I believe I can do everything except figure out how to paste what I have on my clipboard to the mspaint program.

Share this post


Link to post
Share on other sites



I am attempting to make a script so that when pressing a hotkey a screenshot will be taken and saved to a file automatically.

My plan was

set up a hot key to press print screen

open mspaint hidden

paste to mspaint

save as filexxx where xxx can either be a random number or ascending number.

I believe I can do everything except figure out how to paste what I have on my clipboard to the mspaint program.

Send('^v') doesn't work?

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Send('^v') doesn't work?

Well I want to have mspaint hidden using the @SW_HIDDEN command. I figured '^v' wouldnt be able to touch the process. Maybe im wrong Ill give that a shot.

Share this post


Link to post
Share on other sites

If you're open to a lateral solution ..

Download FastStone's Screen Capture utility (free) , which you can configure to automatically save a screenshot with a hotkey. Then all your script has to do is execute the hotkey :P

http://www.faststone.org/

HTH

Share this post


Link to post
Share on other sites

You can do what Trids say, or try and use ControlSend() so it will work even if it's hidden.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

You can do what Trids say, or try and use ControlSend() so it will work even if it's hidden.

Thanks I am experimenting with ControlSend() right now

One other problem. Ok just for ease I made a simple script to open mspaint, press printscreen and paste it. But I ran into saving the file. I found Filesavedialog() but I really am trying to avoid having to type the name in. I looked around some, and cant seem to find a way to give it a default name to save as and not make the dialog box come up.

Thanks for both of your helps, they are pushing me in the right direction.

Share this post


Link to post
Share on other sites

U could also use Lazycats dll capture screen which can be found here http://www.autoitscript.com/fileman/users/Lazycat/dlls.html or a direct download link http://www.autoitscript.com/fileman/users/Lazycat/files/captdll_v2.zip

And use this code

Local $dllopen=DllOpen("captdll.dll")
Global $place=@ScriptDir&"\"
HotKeySet("{F3}","take")
HotKeySet("{F2}","exiter")
While 1
    Sleep(10)
WEnd
FUnc exiter()
DllClose($dllopen)
Exit
EndFunc
Func take()
For $1=0 to 100000
if  FileExists($place&"image"&$1&".jpg") Then
; Dont do anything
Else
DllCall($dllopen, "int", "CaptureScreen", "str", "image"&$1&".jpg", "int", 85)
ExitLoop
EndIf
Next

EndFunc

My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

You could always make the file name unique by using the timestamp as part of the name.

eg: ScreenShotYYYYMMDDHHMMSS.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0