Assume that you want to take screenshots and name them accordingly by date and time. You can achieve this by following these steps:
- Press "PrintScreen" key on keyboard
- Start "Paint" application
- Paste the screenshot
- Save it and name it
No matter how fast you are, it will take you about 10 seconds and if you need to do this repeatedly (for example if you are running a test case), it will be more and more difficult to do it manually.
So, you can automate this task using AutoIt and the script below. After downloading and installing AutoIt IDE, you can try it on your computer.
; PrintScreen
Send("!{PRINTSCREEN}")
; OpenPaint
Run("mspaint")
WinWaitActive("Untitled - Paint")
; PasteScreenShot
Send("^v")
; SaveWithTodaysDate
Send("^s")
WinWaitActive("Save As")
Send(@ScriptDir & "\" & @YEAR & "." & @MON & "." & @MDAY & "-" & @HOUR & @MIN & ".jpeg")
Send("{ENTER}")
Send("y")
; Close
WinWaitActive(@YEAR & "." & @MON & "." & @MDAY & "-" & @HOUR & @MIN & ".jpeg - Paint")
Send("!{F4}")
No comments:
Post a Comment