Automatic Screen shot taking code

Hello All,

I need a code (if possible in VBS or any other language, it should work on windows machine) that would automatically take screeshot after a set time interval and keep the screenshots in project-wise folders. I want this to provide my clients with screenshots of my computer so that they can see how their paid hours are being utilized.

Any help with this will be greatly appreciated.

Amit SinghAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

How to capture a screenshot using VBScript

To capture a desktop screenshot, use the Sys.Desktop.Picture method. To save the resulting image to a file, use its SaveToFile method:

Sys.Desktop.Picture.SaveToFile "E:\screenshot.png"

Open in new window

Amit SinghAuthor Commented:
Thank you very much Kulboy, I tried it in a .vbs file but could not make it work (I'm not a programmer although can make small changes to the code) could you please provide me with complete piece of code that I can use in a .vbs file and run it by double clicking it.

Thanks a lot for all your help!

this should do the trick:

Set ApplicationScreenShot = AppWindow.Picture
  Set DesktopScreenshot = Sys.Desktop.Picture
  Call ApplicationScreenshot.SaveToFile("C:\Folder1\AppScreenshot.jpg")
  Call DesktopScreenshot.SaveToFile("C:\Folder2\DesktopScreenshot.jpg")

Open in new window

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Amit SinghAuthor Commented:
when I run your code in a vbs file I'm getting this error: "Object Required 'AppWindow'" and Object required 'Sys'
Ypu have to replace AppWindow with the full name of the object that corresponds to your application window
Alternatively to the previous testcomplete example you could use this
This version of script take a screenshot of the entire desktop and save as .png.

' Taking Screenshot.
' Tested on windows 7.

    Set oWordBasic = CreateObject("Word.Basic")
    oWordBasic.SendKeys "{prtsc}" 
    oWordBasic.AppClose "Microsoft Word"
    Set oWordBasic = Nothing
    WScript.Sleep 2000
    set WshShell = CreateObject("WScript.Shell")
    WshShell.Run "mspaint"
    WScript.Sleep 2000
    set shl=createobject("shell.application")  
    WScript.Sleep 1000
    Set shl=Nothing
    WScript.Sleep 1000
    WshShell.AppActivate "untitled - Paint"
    WScript.Sleep 1000
    WshShell.SendKeys "^v"
    WScript.Sleep 500
    WshShell.SendKeys "^s"
    WScript.Sleep 500
    WshShell.SendKeys "C:\Users\rmartiro\Desktop\" & "screenshot" & ".png"
    WScript.Sleep 500
    WshShell.SendKeys "{ENTER}"
    WScript.Sleep 500
    WshShell.SendKeys "%{F4}"
    Set WshShell=Nothing

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Amit SinghAuthor Commented:
Thanks a lot! It works however I want everything to happen in the background without showing anything to the user.

I mean it should take screen shot and save it into a folder without showing anything to the user or requiring any input from the user.

Also I want to save each screenshot as a .jpg file.
Amit SinghAuthor Commented:
Extremely helpful!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.