Jump to content

[How To] Getting desktop screenshot


Recommended Posts

Hello guys,

really new here. I think this forum section is the correct one for my issue.

My goal is building a bot to get screenshot of desktop or even better of single windows at fixed hours...let's say every two hours.

Is it possible with AutoIt? If yes, any suggestions?

Thank you very much.

Francesco

Link to comment
Share on other sites

Hello guys,

really new here. I think this forum section is the correct one for my issue.

My goal is building a bot to get screenshot of desktop or even better of single windows at fixed hours...let's say every two hours.

Is it possible with AutoIt? If yes, any suggestions?

Thank you very much.

Francesco

Hi Francesco,

Welcome to the forums and Autoit.

I recommend you go to the help file index and look up _ScreenCapture_Capture

_ScreenCapture_Capture

--------------------------------------------------------------------------------

Captures a region of the screen

#Include <ScreenCapture.au3>

_ScreenCapture_Capture([$sFileName = ""[, $iLeft = 0[, $iTop = 0[, $iRight = -1[, $iBottom = -1[, $fCursor = True]]]]]])

Parameters

$sFileName Full path and extension of the image file

$iLeft X coordinate of the upper left corner of the rectangle

$iTop Y coordinate of the upper left corner of the rectangle

$iRight X coordinate of the lower right corner of the rectangle. If this is -1, the current screen

width will be used.

$iBottom Y coordinate of the lower right corner of the rectangle. If this is -1, the current screen

height will be used.

$fCursor If True the cursor will be captured with the image

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Link to comment
Share on other sites

Yes i found them, thank you.

Is there any other command to let it repeat every 2 hours?

while 1

_ScreenCapture_Capture()

sleep(7200000) ;7.2million milliseconds = 2 hours

wend

This is seudocode but i think you can figure it out from here :(

-1

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Link to comment
Share on other sites

You will need to put a variable in the file name that you write to.

"Screenshot" & $x

$x = $x + 1

autoit will treat Screenshot & $x as:

Screenshot1

Screenshot2

Screenshot3

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Link to comment
Share on other sites

#include <ScreenCapture.au3>

; Capture region

_ScreenCapture_Capture([$sFileName = "Screenshot" & $x

$x = $x + 1] & $x @MyDocumentsDir & "\Screenshot.jpg", 0, 0, 796, 596)

while 1

_ScreenCapture_Capture()

sleep(7200000) ;7.2million milliseconds = 2 hours

wend

I think now i did some errors... lol
Link to comment
Share on other sites

#include <ScreenCapture.au3>

$x = 0

while 1
$x = $x + 1
_ScreenCapture_Capture(@MyDocumentsDir & "\Screenshot" & $x & ".jpg" , 0, 0, 796, 596)

sleep(7200000) ;7.2million milliseconds = 2 hours

wend

It's untested but give it a try

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Link to comment
Share on other sites

Amazing it worked! I tried it with time range 2 seconds and worked fine!

I'm very thankful for your effort!

PS! Since i'm using AC Tool software just to refresh the window i need to screen capture, are you able to add at that Autoit script the refresh option every 2hours?

This is the logic: Take the screenshot first and then refresh. Time range is always 2 hours for taking screenshot and for refreshing but taking screenshot must comes 1 second earlier than refresh.

If it is hard i could continue using that other sfotware.

Thanks in any case!!

Link to comment
Share on other sites

  • Moderators

darkjohn20,

AdlibRegister (in Beta) or AdlibEnable (in regular)

Time for you to update! :(

The current "Release" (v3.3.6.0) uses AdlibRegister - the previous release (v3.3.4.0) dispatched "AdlibEnable" to the great Recycle Bin in the sky..... And we have no "Beta" at the moment.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

This is the logic: Take the screenshot first and then refresh. Time range is always 2 hours for taking screenshot and for refreshing but taking screenshot must comes 1 second earlier than refresh.

If it is hard i could continue using that other sfotware.

Thanks in any case!!

Anyone can help me on this? :(

Link to comment
Share on other sites

Anyone can help me on this? :(

I'm not familar with the software you are using to "refresh" the window. However if you are click a button to refresh the window start autoit window info tool (included with the autoit download package) and hover the mouse over the button. Press Ctrl+Alt+F to freeze the window info tool. Then click the tab "Control Info" if there is a number beside "control ID" you can use the command controlclick() to click the button using autoit.

good luck

-1

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

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