AutoHotkey - printscreen command Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Filipi

AutoHotkey - printscreen command

25 Jul 2018, 07:52

I want a lil help to write a code that take printscreens each hour and save these images on a specific directory. Since now l apreciate.
egocarib
Posts: 100
Joined: 21 May 2015, 18:21

Re: AutoHotkey - printscreen command  Topic is solved

25 Jul 2018, 10:33

There is no simple AHK function to take a screenshot.

This thread outlines some of the easier methods to do it, though. For example, you can:
  • Use a third-party image capture program that AHK can call with a Run command.
  • Use an AHK library such as GDip.
garry
Posts: 3763
Joined: 22 Dec 2013, 12:50

Re: AutoHotkey - printscreen command

25 Jul 2018, 14:28

Example with freeware Irfanview ( picture viewer ) , allow commandline parameters
https://www.heise.de/download/product/i ... 5/download

( create a folder screenshots at desktop )

Code: Select all

;========================= HOTKEYS ===============================================

;################# PRINTSCREEN -- IrfanView ##########################################

*~$printscreen::
irfan      =%a_programfiles%\IrfanView\i_view64.exe
ifnotexist,%irfan%
{
run,https://www.heise.de/download/product/irfanview-1965/download
exitapp
}

ifexist,%irfan%
    {
    screenshots=%a_desktop%\SCREENSHOTS
    ifnotexist,%screenshots%
       filecreatedir,%screenshots%
	   
   runwait, "%irfan%" "/capture=0 /convert=%screenshots%\%A_now%_screenshot.png"
   ;runwait, "%irfan%" "/capture=0 /convert=%screenshots%\%A_now%_screenshot.bmp"
   run,%screenshots%
   return
    }
return


;-- active window keys = ALT+Printscreen
~$!printscreen::
irfan      =%a_programfiles%\IrfanView\i_view64.exe
ifnotexist,%irfan%
{
run,https://www.heise.de/download/product/irfanview-1965/download
exitapp
}

ifexist,%irfan%
    {
    screenshots=%a_desktop%\SCREENSHOTS
    ifnotexist,%screenshots%
       filecreatedir,%screenshots%

    InputBox, UserInput,Screenshot input File-Name 
    if errorlevel<>0
      return
    runwait, "%irfan%" "/capture=2 /convert=%screenshots%\%userinput%.png"
    ;runwait, "%irfan%" "/capture=2 /convert=%screenshots%\%a_now%_screenshot.png"
    run,%screenshots%
    return
    }
return
;--------------


;----------------------------------------------------------------------------------
/*
https://www.heise.de/download/product/irfanview-1965/download
( http://www.irfanview.com/ )

--- capture values:
0 = whole screen
1 = current monitor, where mouse is located
2 = foreground window
3 = foreground window - client area
4 = rectangle selection
5 = object selected with the mouse
6 = start in capture mode (can't be combined with other commandline options)

--- Advanced examples:
i_view32.exe /capture=2 /convert=c:\test.jpg
Capture foreground window and save result as file.

i_view32.exe /capture=2 /convert=c:\capture_$U(%d%m%Y_%H%M%S).jpg
Capture foreground window and save result as file; the file name contains time stamp.
*/

;################# END PRINTSCREEN ############################################
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: AutoHotkey - printscreen command

25 Jul 2018, 16:27

nircmd.exe screenshot <path> or Send #{PrintScreen} on windows10

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 203 guests