[Tutor] re: Python for the Microsoft Scripting Engine

alan.gauld@bt.com alan.gauld@bt.com
Thu, 19 Jul 2001 16:56:25 +0100


------_=_NextPart_001_01C1106B.5D685BF0
Content-type: text/plain; charset="ISO-8859-1"

Is there a way to get Python to work with the Microsoft Scripting Engine.
I've seen this done with Perl, and I've read that Python works, but I
haven't been able to find a way.  Any help will be greatly appreciated!  

Yes, you need to install WSH on Windows then run a script from 
the winall(or activestate python distribution) that registers 
Python as a scripting language. (Its pyscript.py found in:
$PYTHON/win32comext/axscript/client - obvious eh?! :-)
Python scripts should then be created with an extension of .pys
 
However I've failed to get this to work! On asking Mark Hammond 
on c.l.p he suggested that it was easier not to bother and 
just use native OLE to instantiate the WSH objects directly.
(Try searching the newsnet archives on Google...)
 
He gives some examples of this in his "Python Programming on 
Win32" book.
 
Alan G
 
PS The doc string for the script is:
"""Python ActiveX Scripting Implementation
 
This module implements the Python ActiveX Scripting client.
 
To register the implementation, simply "run" this Python program - ie
either double-click on it, or run "python.exe pyscript.py" from the
command line.
"""
 
 


------_=_NextPart_001_01C1106B.5D685BF0
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 5.00.3013.2600" name=GENERATOR></HEAD>
<BODY>
<BLOCKQUOTE 
style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; PADDING-LEFT: 5px">
  <DIV><FONT size=2><FONT face=sans-serif>Is there a way to get Python to work 
  with the Microsoft Scripting Engine. &nbsp;I've seen this done with Perl, and 
  I've read that Python works, but I haven't been able to find a way. &nbsp;Any 
  help will be greatly appreciated!&nbsp;<FONT color=#0000ff 
  face="Courier New"><SPAN 
  class=270555215-19072001>&nbsp;</SPAN></FONT></FONT></FONT></DIV></BLOCKQUOTE>
<DIV><FONT size=2><FONT face=sans-serif><FONT color=#0000ff 
face="Courier New"><SPAN class=270555215-19072001>Yes, you need to install WSH 
on Windows then run a script from </SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=sans-serif><FONT color=#0000ff 
face="Courier New"><SPAN class=270555215-19072001>the winall(or activestate 
python distribution) that registers </SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=sans-serif><FONT color=#0000ff 
face="Courier New"><SPAN class=270555215-19072001>Python as a scripting 
language.&nbsp;(Its pyscript.py found in:</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=sans-serif><FONT color=#0000ff 
face="Courier New"><SPAN 
class=270555215-19072001>$PYTHON/win32comext/axscript/client - obvious eh?! 
:-)</SPAN></FONT></FONT></FONT><FONT size=2><FONT face=sans-serif><FONT 
color=#0000ff face="Courier New"><SPAN 
class=270555215-19072001></SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>Python scripts should then be created with&nbsp;an 
extension of .pys</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>However I've failed to get this to work! On asking Mark 
Hammond </SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>on c.l.p he suggested that it was easier not to bother 
and </SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>just use native OLE to instantiate the WSH objects 
directly.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>(Try searching the newsnet archives on 
Google...)</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>He gives some examples of this in his "Python 
Programming on </SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>Win32" book.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>Alan G</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>PS The doc string for the script 
is:</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>"""Python ActiveX Scripting 
Implementation</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>This module implements the Python ActiveX Scripting 
client.</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001>To register the implementation, simply "run" this 
Python program - ie<BR>either double-click on it, or run "python.exe 
pyscript.py" from the<BR>command line.<BR>"""</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face="Courier New" size=2><SPAN 
class=270555215-19072001><FONT color=#0000ff size=2>
<P>&nbsp;</P></FONT></SPAN></FONT></DIV></BODY></HTML>

------_=_NextPart_001_01C1106B.5D685BF0--