Page 1 of 1

[How to] capture screen image with EventGhost

Posted: Sun Jan 05, 2014 3:35 pm
by Sem;colon
Hello everyone,

I was searching for a way to make a screenshot (or windowshot) with EventGhost, in the end I came up with this little script I'd like to share with you:

Code: Select all

import ImageGrab
import win32gui

hwnd = eg.lastFoundWindows[0]
bbox = win32gui.GetWindowRect(hwnd)
img = ImageGrab.grab(bbox)
img.save("c:/screen_capture.jpg", "JPEG")
It has to be triggered after the "Find Window" action.

I think it would be useful to have this functionality as action in the "Window" plugin - but I don't want to mess around with EGs core plugins, so I leave this task to more experienced developers ;)

Re: capture screen image with EventGhost

Posted: Sun Jan 12, 2014 9:37 am
by Pako
Just to complete.
Something similar occurred here twice already:
Re: eg hangs on script second run
Re: Print screen

Pako

Re: capture screen image with EventGhost

Posted: Sun Jan 12, 2014 11:50 am
by Sem;colon
Pako wrote:Just to complete.
Something similar occurred here twice already:
Re: eg hangs on script second run
Re: Print screen

Pako
ohh... ok, I didn't find these posts using the search function.
But I needed to capture a specific window anyway, so the time was not in vane ;-)