Jump to content

Capture Screenshot using snipping tool


Recommended Posts

I've created a simple script that opens the Snipping Tool; Selects the "Full Screen Snip" option; then closes the program, prompting a save.  What I can't figure is how to name the file using the system date and time.

Can anyone help?

Run(@WindowsDir & '\system32\SnippingTool.exe')
AutoItSetOption('MouseCoordMode', 0)

Sleep(1)
$hWnd= WinWait("Snipping Tool", "ToolBarWindow32", 1)
WinActive($hWnd)
MouseClick('primary', 84, 48, 1, 0)
MouseClick('primary', 84, 140, 1, 0)
WinClose("[Class:Microsoft-Windows-Tablet-SnipperEditor]")

ControlClick("Snipping Tool", "", "Button1")

 

 

 

 

Link to comment
Share on other sites

  • Moderators

@SalamanderSoup moved your topic to General Help and Support, as you seemed to have missed this at the top of the Examples forum:

Do not post general support questions here, instead use the AutoIt Help and Support forums.

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Probably because windows wont allow you to save a file with back slashes/forward slashes\ in it.

Try using _NowDate() and StringReplace and replace the " / \ " with "." for instance...

 

p.s. unless you are dead set on using SnippetTool, Autoit has a very cool function called:

_ScreenCapture_Capture that does this job very well ;)

Edited by l3ill
p.s.
Link to comment
Share on other sites

Thanks l3ill, could you possibly give me an example of how the NowDate and StringReplace scripts might look together?  I've looked at the AutoScript Help File, and still feel a bit confused at how I should code it.  I'm very new at this.

3 hours ago, l3ill said:

Probably because windows wont allow you to save a file with back slashes/forward slashes\ in it.

Try using _NowDate() and StringReplace and replace the " / \ " with "." for instance...

 

p.s. unless you are dead set on using SnippetTool, Autoit has a very cool function called:

_ScreenCapture_Capture that does this job very well ;)

Link to comment
Share on other sites

Here is your script.

#include <Date.au3>
#include <ScreenCapture.au3>

$filename = _NowDate()
;                         String     Find Replace
$filename = StringReplace($filename, "/", ".")

; I'm guessing fixed location wants the cursor off
;                      Filepath      \    Filename    .Type   x1  y1  x2  y2   Capture Mouse Cursor
_ScreenCapture_Capture(@ScriptDir & "\" & $filename & ".png", 84, 48, 84, 140, False)

It's only programmed to read 1 pixel width, but I hope you know that already.

If you want a BMP or something else you can change the type ".png"

Edited by Xandy
Link to comment
Share on other sites

4 hours ago, l3ill said:

Nice follow up Xandy...

I hope this is not going to be too expensive ;)

I try SO hard!

Your advice gave me a concise path to victory.

2 hours ago, SalamanderSoup said:

I was able to add the system time to the file name, as well.

Then you're learning and all is well.  There's nothing wrong with eating a free fish, unless you're the fish.

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

×
×
  • Create New...