Jump to content
Sign in to follow this  
Mursa

Script that takes ss of certain window every 15 minutes.

Recommended Posts

Mursa

Hello, im trying to make script that takes screenshot of certain window every 15 minutes. This is my code atm.

#include <ScreenCapture.au3>

$var = 0;

Do
$timer=TimerInit()
Sleep(5000)
$seconds=Round(TimerDiff($timer)/1000,2)
If IsInt($seconds) Then $seconds&=".00"
$date = @MDAY & "/" & @MON & "/" & @YEAR
_ScreenCapture_Capture("C:\Users\Mursa\Pictures\ProPilk2\" & $var & "_" & $date & ".jpg")
Until $var = 10;

So basically i'm missing the targeting to certain window.

Share this post


Link to post
Share on other sites
spudw2k

I have a script in my signature called ICU that accomplishes (more-or-less) what you are trying to do.

I was able to capture a specific window using the following funcs:

$activewin = WinGetTitle("")
$activewin = WinGetHandle($activewin)
_ScreenCapture_CaptureWnd($filename,$activewin)

 

Modify as necessary/

Share this post


Link to post
Share on other sites
Mursa
#include <ScreenCapture.au3>


$activewin = WinGetTitle("Calculator") ;Modified here window Title & didin't work
$activewin = WinGetHandle($activewin)
_ScreenCapture_CaptureWnd("C:\Users\MYUSER\Pictures\image1.jpg" ,$activewin)
Edited by Mursa

Share this post


Link to post
Share on other sites
Mursa

I'm afraid you'll have to do a little better than that.

Well could you give me helping hand instead of telling that? I'm beginner and wan't go get my code working. 

; Autoit window gives me these results on the window

;Title: Pro Pilkki 2
;Class: MainWClass
;Position: -8,-8

;Controls > Empty

Share this post


Link to post
Share on other sites
Mursa

I want to take screenshot of specified window that is not the current window shown. Example my window is down there minimized and i want to take picture at it.

Share this post


Link to post
Share on other sites
Mursa

Well, is it possible that it could focus and maximize the window take screenshot and minimize it?

Share this post


Link to post
Share on other sites
Mursa

Well how i get back to windows background or to background i came from? :)

Share this post


Link to post
Share on other sites
Mursa

Certainly is.

WinActivate() should do the trick.

EDIT:

In fact WinSetState() might be better, for both restoring and minimizing the window.

 

WinSetState() works like charm, ty :)

Share this post


Link to post
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
Sign in to follow this  

×