Jump to content

Recommended Posts

Posted (edited)

Hi

I created this program as a means to quickly save screen shots to assist in documenting various system settings.

The programs runs as a TSR.

If you press <ctr><f3> it prompts you for a file name before saving the screen.

If you press <ctr><f4> it saves a sequentially numbered screen shot.

I recenty enhanced the program to remember the last screen shot number recorded (this was because I frequently had to reboot between sessions).

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.6.1
Author: Joel Susser (susserj)
Last Modified: 10/22/2012

Purpose: Capture Screen and save files in directory
Instructions: Start Application
Press CTR F3 to save to a specific name
Press CTR F4 to save to a secquencial number (number gets reset when application is shutdown)

10/22/2012
Added functionality to remember last saved saved image file by reading counter file

Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <ScreenCapture.au3>

Global $Paused
Local $file = FileOpen("count.txt",0)
If $file = -1 Then
Global $count = 0
Else
$count = Number (FileReadline($file))
FileClose($file)
Endif

HotKeySet("^{F3}", "capture") ;Ctr F3
HotKeySet("^{F4}", "captureby_number") ;Ctr F4
;;;; Body of program would go here ;;;;

While 1
Sleep(100)
WEnd
;;;;;;;;

func capture()
$filename = InputBox("Filename", "Enter Filename","","",30,20)
$filename = $filename & ".jpg"
SplashTextOn("FileName", $filename, 120, 50, 0, 0, 0, "")
Sleep(1000)
;SplashOff()

; Capture full screen
;Print The screen and save it to a temporary file
Local $hBmp
_ScreenCapture_SetJPGQuality(60)
$hBmp = _ScreenCapture_Capture ("")

; Save bitmap to file
_ScreenCapture_SaveImage ($filename, $hBmp)
SplashOff()
endFunc

func captureby_number()
$count = $count + 1
$filename = string($count)
$filename = $filename & ".jpg"
;MsgBox(4096, "Filename", $filename, 1)
SplashTextOn("FileName", $filename, 120, 50, 0, 0, 0, "")
Sleep(1000)
;SplashOff()

; Capture full screen
;Print The screen and save it to a temporary file
Local $hBmp
; Capture full screen
_ScreenCapture_SetJPGQuality(60)
$hBmp = _ScreenCapture_Capture ("")

; Save bitmap to file
_ScreenCapture_SaveImage ($filename, $hBmp)
SplashOff()

;save the new counter in a file
Local $file= FileOpen("count.txt", 2)
filewrite($file, $count)
FileClose($file)
endFunc

screen_save.au3

Edited by susserj
Posted

Hello, seems like a good project.

But i got undefined functions on these:

_ScreenCapture_SetJPGQuality(60)

$hBmp = _ScreenCapture_Capture ("")

_ScreenCapture_SaveImage ($filename, $hBmp)

You got an empty include.

Are you using some UDF? point out the udf so we can test this.

why so much space between the codes?

greetings.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted (edited)

Hi Wayfarer

Thanks for pointing out the difficulties.

Cut and paste didn't work exactly as I expected. It fixed the #include <ScreenCapture.au3> and added a bunch of extra lines.

Hopefully it we be better now.

Edited by susserj
Posted

Good work man, works as intended here. :)

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

  • 3 years later...
Posted

I would like the screen capture (using CTRL + F4) to happen automatically when the script runs.  Tried "Send('^{F4}')", but not go.  Any ideas?  I would like this screen shot to happen while the screen is locked.

If taking a screenshot while the screen is locked isn't possible, could I get some script for unlocking the screen?

  • Developers
Posted
  On 8/16/2016 at 5:10 PM, SalamanderSoup said:

 I would like this screen shot to happen while the screen is locked.

Expand  

This will never happen unless somebody can performs magic.
There are many questions around screen captures to file etc in this forum and working solutions, so do some searching and reading to get yourself up to speed.

ps. unsure why you decided to post in a 4 year old thread, but it would be better to start your own topic in case it is not directly related to the thread.

Jos

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.
  :)

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
  • Recently Browsing   0 members

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