A simple functioning screenshot script working with AHKv2
My little practice to implement screenshot application on AHKv2. Tested to work on AHK v2.0.2.
- Requires AHK v2.0, can download it from here: https://www.autohotkey.com/
- Run the Sample.ahk script, which will load rest of the code
- the hotkeys:
- Select region to capture: Ctrl+Win+Shift+r
- Repeat capture with the previous setting (windows or screen region): Ctrl+Win+r For me, I typically assign these to mouse custom keys so they can be triggered within a second.
- For "select to capture", a green mask will show up indicating the window or window component to capture, you can move the mouse around to select other window, then click the mouse (don't move) to indicate you've finished.
- If you don't want to capture an existing window but a desktop region, feel free to drag with your mouse to select the region, and once the mouse button is up, the region is set
- after 4 or 5, a blue transparent window will show up, and you can still move/resize the window to refine your region selection
- After that, press "Enter" to finish the screen capturing.
- At any time through 4 to 7, press "Esc" or Right Click to cancel the screen capture.
- screenshot is saved to file (abs path configured in .config.ini) and clipboard for further use.
Important Please make sure you update .config.ini before running the AHK scrip for the first time
- LogPath: A relative path (starting from the script folder) to the log file for AHK to log important messages
- ScreenshotPath: an absolute path to the folder that stores all captured pictures
- Gdip library: gdip_all.ahk is updated based on mmikeww's work. The file is updated to work with released AHKv2 (mmikeww's version worked on AHK v2-a108).
- Got the original screen selection idea from https://autohotkey.com/board/topic/45921-letuserselectrect-select-a-portion-of-the-screen/.