Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Screen capture and save to file


  • Please log in to reply
8 replies to this topic
Landvermesser
  • Members
  • 51 posts
  • Last active: Aug 12 2008 09:02 AM
  • Joined: 03 Nov 2004
This script use the Microsoft Paint to save the clipboards content.

#F12::
PrintAndSave:
	Send, {PrintSCREEN} ; or !{PrintSCREEN} to capture the active window only
	DetectHiddenWindows, On
	Run, %A_WinDir%\System32\mspaint.exe, , hide UseErrorLevel
	If ErrorLevel = ERROR
		{
			MsgBox, 0, Message, The File %A_WinDir%\System32\MSPAINT.EXE not found.`nThe "Save" feature is impossible.
			ErrorLevel =
			Return
		}

	WinWait, ahk_class MSPaintApp, , 5
	PostMessage, 0x111, 57637, 0, , ahk_class MSPaintApp
	MsgBox, 64, Message, The screen was captured.
	PostMessage, 0x111, 57604, 0, , ahk_class MSPaintApp
	WinWait, ahk_class #32770, FolderView, 2
	WinGetTitle, SaveWinTitle, ahk_class #32770, FolderView 
	SetTimer, WaitForClose, 500
	DetectHiddenWindows, Off
	Return

WaitForClose:
	IfWinNotExist, %SaveWinTitle%
		{
			Process, Close, MSPAINT.EXE
			SetTimer, WaitForClose, Off
		}
	Return


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
It's a nice use of a hidden window and PostMessage to make it work in the background!

Thanks for posting it.

Futurepower(R)
  • Members
  • 38 posts
  • Last active: Oct 11 2014 11:35 PM
  • Joined: 20 Jun 2005
Grab is an excellent program that can be used instead of MS Paint to convert an image on the clipboard to a file.

There are many options, including conversion to black-an-white, which makes the file size much smaller, for using the script with automatic emailing to an administrator.

http://pages.videotr...les/capture.htm

jimbomusic
  • Guests
  • Last active:
  • Joined: --
Very nice!

I'm wondering if there's a way to default a different folder location as well as perhaps JPEG instead of BMP?

Any ideas?

thanks.
jimbo

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
If you have irfanview installed or are willing to install it, You can also have a look at my EasyCopy script (for link, see my signature).
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Landvermesser
  • Members
  • 51 posts
  • Last active: Aug 12 2008 09:02 AM
  • Joined: 03 Nov 2004
Thanks, toralf, your script is much better as my and I use it. Can you make it with the default Windows DLLs? Not all peoples have the installed IfranView.

Futurepower(R)
  • Members
  • 38 posts
  • Last active: Oct 11 2014 11:35 PM
  • Joined: 20 Jun 2005
Any solution using IrfanView is highly recommended because IrfanView is very high quality software, is free, and has many options and features.

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005

Can you make it with the default Windows DLLs? Not all peoples have the installed IfranView.

Sorry, no I can't. Since I'm not familiar with DLLs. I only took some code from shimanov. He mentioned that all would be possible with DLL, but you have to ask him to help you.
Another reason is not to reinvent the wheel.

BTW: I do not have irfanview installed myself, I just copied the irfanview.exe and the one of its dll to the script dir, done.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Mt
  • Guests
  • Last active:
  • Joined: --
Nice Script Toralf :lol: