Jump to content

ScreenCap and save


Mast3rpyr0
 Share

Recommended Posts

I made this for someone on RentACoder but they declined my bid so guess ill post it here.

PrnScr will take a screenshot and save it in C:\Program Files\ScreenCap with the date and time as the name. It will then add the complete path to the image to the clipboard.

Esc will close the program.

#Include <A3LClipBoard.au3>
#Include <A3LScreenCap.au3>

HotKeySet("{PRINTSCREEN}", "PicFunc")
HotKeySet("{ESC}", "ExitFunc")

SplashTextOn("ScreenCap", "Starting ScreenCap...", 200, 50)
Sleep(1000)
SplashOff()

While 1
WEnd
Func PicFunc()
    _Clip_Empty()
    $sFileName = @ProgramFilesDir & "\ScreenCap\Cap_" & @MON & @MDAY & @HOUR & @MIN & @SEC & ".bmp"
    _ScreenCap_Capture($sFileName)
    _Clip_SetData($sFileName)
    Sleep(100)
EndFunc

Func ExitFunc()
    Exit
EndFunc
Edited by Mast3rpyr0
Link to comment
Share on other sites

probably not needed but i put it in all my programs. or do you not know what tha means?

Definitly not needed here gecause you don't have a GUI therefore you have no GUI Constants to include. I never include that file (or any of the constants files) anyway. Just use the value of the constant.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Definitly not needed here gecause you don't have a GUI therefore you have no GUI Constants to include. I never include that file (or any of the constants files) anyway. Just use the value of the constant.

I never do any #includes unless I use like 3 UDFs/Variables from them.

Link to comment
Share on other sites

You have the A3Lib installed?

If not its the first sticky post in Example scripts.

yes i do... but ill reinstall now just to dubble check

Checked it still not working...

Edited by SalazarCheats

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

Mast3rpyr0 you code so cool, but it output .bmp, i wanna change output file to .jpg so it tat only change 1 line

$sFileName = @ProgramFilesDir & "\ScreenCap\Cap_" & @MON & @MDAY & @HOUR & @MIN & @SEC & ".bmp"

but when i press prtsc key, nothin happen. Help me plz, how to output .jpg ???

(Sori my ENG so bad :whistle:)

Link to comment
Share on other sites

You don't need the ExitFunc. By default AutoIt exits when Esc is pressed.

http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]
Link to comment
Share on other sites

AutoIt does not exit by default if Escape is pressed.

Not bad program, I think you should put in a DirCreate to create the folder (I had to create the folder manually for script to work). Also, don't hotkeyset the print screen key until after the splash has finished, that way there is no screen capture during startup.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

  • 2 weeks later...

i can't output *.jpg, plz help!!!!!

in A3LScreenCap.au3 :

Func _ScreenCap_SaveImage($sFileName, $hBitmap, $fFreeBmp=True)

......

......

Switch $sExt

case "BMP"

$iX = _GDIP_ImageGetWidth ($hImage)

$iY = _GDIP_ImageGetHeight($hImage)

$hClone = _GDIP_BitmapCloneArea($hImage, 0, 0, $iX, $iY, $giA3LBMPFormat)

_GDIP_ImageDispose($hImage)

$hImage = $hClone

case "JPG", "JPEG"

$tParams = _GDIP_ParamInit(1)

$tData = DllStructCreate("int Quality")

DllStructSetData($tData, "Quality", $giA3LJPGQuality)

_GDIP_ParamAdd($tParams, $GDIP_EPGQUALITY , 1, $GDIP_EPTLONG, DllStructGetPtr($tData))

so tat mean just change .bmp ====> .jpg. but y script not working????

Edited by tonlo
Link to comment
Share on other sites

AutoIt does not exit by default if Escape is pressed.

Not bad program, I think you should put in a DirCreate to create the folder (I had to create the folder manually for script to work). Also, don't hotkeyset the print screen key until after the splash has finished, that way there is no screen capture during startup.

You could use a FileCopy() or FileMove() with the flag set to 9 which will overwrite existing and create the folder structure if required.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

  • 5 weeks later...

Now This saves in JPG

Easy and any one can understand the code ......

;Gets Screen HackMan
SEND("{PRINTSCREEN}")
Run("mspaint.exe")
WinWaitActive("untitled - Paint")
WinSetState ( "untitled - Paint", "", @SW_MAXIMIZE )
Send("!EP")
Send("P")
WinWaitActive("untitled - Paint")
Send("!FA")
Send("!T")
Send("{DOWN}")
Send("{DOWN}")
Send("{ENTER}")
Send("!N")
$sFileName = @MON & @MDAY & @HOUR & @MIN & @SEC & ".jpg"
Send($sFileName)
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
MsgBox(0,"HackMan","This Program Has been Done by Hackman ")
MsgBox(0,"HackMan","In Case if u wanna use this to some pgm pls give me credits  ")
EXIT
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...