[Tutor] capturing screenshots

Branimir Petrovic BranimirP@cpas.com
Wed Jan 22 19:59:02 2003


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C2C27A.D03702E0
Content-Type: text/plain;
	charset="iso-8859-1"

 
Since your target platform is Windows, one (and only?) admittedly kludgey
way to pull something of this sort would be via free third party COM
component - AutoIt.dll. It might help you (to a degree) in dealing with
pains emanating from (ahem) lovely, non scriptable, GUI-only aspects of
Windows environment. 
 
You could 'drive' it (AutoIt.dll) from Python and Mark Hammond's Win23all
extensions, activate app you are interested in, then by sending ALT + P or
CTRL + P keystrokes you might capture active window or whole desktop bitmap
an paste it to the clipboard. Once there - on the clipboard - you have a way
with it (Win32all again)...
 
http://www.hiddensoft.com/AutoIt/index.html
<http://www.hiddensoft.com/AutoIt/index.html> 
 
I doubt very much that proper Python way or suitable module for 'driving'
(or interacting with) Windows GUI exists, especially so when even much
simpler task like the one Python Expect module tackles (driving/interacting
with command line apps/utilities) - does not exist for Windows platform.
 
Branimir
 

-----Original Message-----
From: Jmllr891@cs.com [mailto:Jmllr891@cs.com]
Sent: Wednesday, January 22, 2003 5:50 PM
To: tutor@python.org
Subject: [Tutor] capturing screenshots


I have been looking for ways to capture screenshots using Python, but I have
found nothing to help me. I have taken a few looks at the 'os' module, but
couldn't find anything that looked helpful, although I probably missed
something. I have tried to find what I need by searching Google and the
Python tutor archive several times, but to no avail.
 
I'm not looking for a direct answer, just a hint at what I would have to do
to capture screenshots in Python. Would I need to do something like simulate
a key press (if that's possible) or is there a function or module somewhere
that I'm just not aware of yet?
 
Also, I'm trying to accomplish this in Windows.
 
Thanks for the help,
Joshua Miller


------_=_NextPart_001_01C2C27A.D03702E0
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.2800.1126" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2><SPAN 
class=476001300-23012003>Since your target platform is Windows, one (and only?) 
admittedly kludgey way to pull something of this sort would be via free third 
party COM component - AutoIt.dll.&nbsp;It might&nbsp;help you (to a 
degree)&nbsp;in dealing with pains&nbsp;emanating from&nbsp;(ahem) lovely, non 
scriptable, GUI-only&nbsp;aspects of Windows environment. </SPAN></FONT></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2><SPAN 
class=476001300-23012003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2><SPAN 
class=476001300-23012003>You could&nbsp;'drive' it (AutoIt.dll) from Python and 
Mark Hammond's Win23all extensions, activate app you are interested in, then by 
sending ALT + P or CTRL + P keystrokes you&nbsp;might capture active window or 
whole desktop bitmap an paste&nbsp;it to&nbsp;the&nbsp;clipboard. Once there - 
on the clipboard&nbsp;- you have a way with it (Win32all 
again)...</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2><SPAN 
class=476001300-23012003></SPAN></FONT><FONT face="Courier New" color=#0000ff 
size=2><SPAN class=476001300-23012003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2><A 
href="http://www.hiddensoft.com/AutoIt/index.html">http://www.hiddensoft.com/AutoIt/index.html</A></FONT></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2><SPAN 
class=476001300-23012003>I doubt very much that proper Python way or suitable 
module for 'driving' (or interacting with) Windows GUI exists,&nbsp;especially 
so when&nbsp;even much simpler task like the one Python Expect module tackles 
(driving/interacting with command line apps/utilities)&nbsp;- does not exist for 
Windows platform.</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2><SPAN 
class=476001300-23012003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2><SPAN 
class=476001300-23012003>Branimir</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Jmllr891@cs.com 
  [mailto:Jmllr891@cs.com]<BR><B>Sent:</B> Wednesday, January 22, 2003 5:50 
  PM<BR><B>To:</B> tutor@python.org<BR><B>Subject:</B> [Tutor] capturing 
  screenshots<BR><BR></FONT></DIV>
  <DIV><FONT face=Arial size=2>I have been looking for ways to capture 
  screenshots using Python, but I have found nothing to help me. I have taken a 
  few looks at the 'os' module, but couldn't find anything that looked helpful, 
  although I probably missed something. I have tried to find what I need by 
  searching Google and the Python tutor archive several times, but&nbsp;to no 
  avail.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>I'm not looking for a direct answer, just a hint 
  at what I would have to do to capture screenshots in Python. Would I need to 
  do&nbsp;something like simulate a key press (if that's possible) or is there a 
  function or module somewhere that I'm just not aware of yet?</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Also, I'm trying to accomplish this in 
  Windows.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Thanks for the help,<BR>Joshua 
Miller</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C2C27A.D03702E0--