Jump to content

Save Screen Print To Graphic File


Joon
 Share

Recommended Posts

How can I create jpeg or gif from screen print? I guess using MSPaint is oneway. Is there better way of doing this?

there is a script in scripts and scraps called "Spraypaint" that takes an image from paint. it does it using dll calls though. you can probably get going in the right direction that way.
Link to comment
Share on other sites

  • Developers

How can I create jpeg or gif from screen print? I guess using MSPaint is oneway. Is there better way of doing this?

I am using HoverSnap to capture PrintScreen/Alt+Printscreen or Ctrl+PrintScreen (Custom area) and save it to PNG or JPG..

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Go http://www.autoitscript.com/fileman/users/Lazycat/ and you will find a way using a dll by Lazycat.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Go http://www.autoitscript.com/fileman/users/Lazycat/ and you will find a way using a dll by Lazycat.

i made this with lazycats dll

#include "GUIConstants.au3"
$CLoc =  @TempDir & "\"
$CFile = "Dumppic.jpg"

$CProgram = $CLoc & "captplugin.dll"
FileInstall("C:\Program Files\AutoIt3\Examples\My Stuff\captplugin.dll", $CProgram)

Dim $pic
_GuiCreater()

While 1
    sleep(5000)
    _get_pic()
WEnd


Func _get_pic()
$hPlugin = PluginOpen($CProgram)
CaptureScreen($CLoc & $CFile, 85)
PluginClose($hPlugin)
GUICtrlSetImage( $pic, $CLoc & $CFile)
EndFunc

Func _GuiCreater()
    GUICreate("My Pic", 200, 200, 10, 10, $WS_POPUP, $WS_EX_TOPMOST )
    $pic = GUICtrlCreatePic($CLoc & $CFile, 0, 0, 200, 200)
    GUISetState()
EndFunc

you might get an error with a missing function... just press continue because the function is inside the dll

8)

NEWHeader1.png

Link to comment
Share on other sites

Here is the example from Lazycats site

HotKeySet("{F9}", "OnScreenShot")
HotKeySet("{ESC}", "Terminate")

While 1
    Sleep(20)
WEnd


Func OnScreenShot()
    If Not FileExists (@scriptdir & "\screenshots") Then DirCreate (@scriptdir & "\screenshots") 
    If Not FileExists(@scriptdir & "\captdll.dll") Then FileInstall( "captdll.dll", @scriptdir & "" ,1)
    Local $Cwin1 = WinGetHandle(""); gets the handle of the active window
    Local $Cwin2 = WinGetPos($Cwin1); gets active window dimensions
    Local $Quality = 85; use -1 to save as BMP or use number between 0 - 100 to save as JPG quality
    If $Quality = -1 Then
        Local $SaveAs = ".bmp"
    Else
        Local $SaveAs = ".jpg"
    EndIf   
    Local $CaptureDirectory = @ScriptDir & "\Screenshots\"; directory uses to store screen caps
    Local $CaptureFile = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & @MIN & "-" & @SEC & $SaveAs
    DllCall(@scriptdir & "\captdll.dll", "int", "CaptureRegion", "str", $CaptureDirectory & $CaptureFile, "int", $Cwin2[0], "int", $Cwin2[1], "int", $Cwin2[2], "int", $Cwin2[3], "int", $Quality)
    If @error Then MsgBox(262160,"ERROR","The screen was not captured",4)
EndFunc


Func Terminate()
    Exit
EndFunc

And attached is the required dll


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

there is a script in scripts and scraps called "Spraypaint" that takes an image from paint. it does it using dll calls though. you can probably get going in the right direction that way.

Spraypaint does nothing about screen print or saving file.

Link to comment
Share on other sites

my example gets a full screen

and lazycats example gets the active window

8)

Sorry posted wrong example

DllCall("captdll.dll", "int", "CaptureScreen", "str", "dump_full.jpg", "int", 85)

Leaves a jpg file in the script folder called dump_full.jpg


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...