Uploaded Test files

This commit is contained in:
Batuhan Berk Başoğlu 2020-11-12 11:05:57 -05:00
parent f584ad9d97
commit 2e81cb7d99
16627 changed files with 2065359 additions and 102444 deletions

View file

@ -0,0 +1,19 @@
<HTML>
<SCRIPT Language="Python" RUNAT=Server>
# Just for the sake of the demo, our Python script engine
# will create a Python.Interpreter COM object, and call that.
# This is completely useless, as the Python Script Engine is
# completely normal Python, and ASP does not impose retrictions, so
# there is nothing the COM object can do that we can not do natively.
o = Server.CreateObject("Python.Interpreter")
Response.Write("Python says 1+1=" + str(o.Eval("1+1")))
</SCRIPT>
</HTML>

View file

@ -0,0 +1,52 @@
<%@ Language=Python %>
<HTML>
<HEAD>
<BODY BACKGROUND="/samples/images/backgrnd.gif">
<TITLE>Python test</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<SCRIPT Language="Python" RUNAT=Server>
# NOTE that the <% tags below execute _before_ these tags!
Response.Write("Hello from Python<P>")
Response.Write("Browser is "+bc.browser)
import win32api # Should be no problem using win32api in ASP pages.
Response.Write("<p>Win32 username is "+win32api.GetUserName())
</SCRIPT>
<BODY BGCOLOR="FFFFFF">
<%
import sys
print sys.path
from win32com.axscript.asputil import *
print "Hello"
print "There"
print "How are you"
%>
<%bc = Server.CreateObject("MSWC.BrowserType")%>
<BODY BGCOLOR="FFFFFF">
<table border=1>
<tr><td>Browser</td><td> <%=bc.browser %>
<tr><td>Version</td><td> <%=bc.version %> </td></TR>
<tr><td>Frames</td><td>
<%Response.Write( iif(bc.frames, "TRUE", "FALSE")) %></td></TR>
<tr><td>Tables</td><td>
<%Response.Write( iif (bc.tables, "TRUE", "FALSE")) %></td></TR>
<tr><td>BackgroundSounds</td><td>
<%Response.Write( iif(bc.BackgroundSounds, "TRUE", "FALSE"))%></td></TR>
<tr><td>VBScript</td><td>
<%Response.Write( iif(bc.vbscript, "TRUE", "FALSE"))%></td></TR>
<tr><td>JavaScript</td><td>
<%Response.Write( iif(bc.javascript, "TRUE", "FALSE"))%></td></TR>
</table>
</body>
</html>

View file

@ -0,0 +1,4 @@
<%@ language=python%>
<html>
<%Response.Redirect("test1.html")%>
</html>

View file

@ -0,0 +1,10 @@
<html>
<head>
<body>
GOT There
<script language=javascript>
location.href ="http://192.168.0.1/Python/interrupt/test.asp"
</script>
</body>
</head>
</html>

View file

@ -0,0 +1,6 @@
<%@ language =Python%>
<html>
<head>
<%Response.Redirect("test.html")%>
</head>
</html>

View file

@ -0,0 +1,11 @@
<html>
<head>
<body>
GOT HERE
<script language=javascript>
location.href ="http://192.168.0.1/Python/interrupt/test1.asp"
</script>
</body>
</head>
</html>

View file

@ -0,0 +1,11 @@
<HTML>
<SCRIPT Language="Python" RUNAT=Server>
for i in range(3,8):
Response.Write("<FONT SIZE=%d>Hello World!!<BR>" % i)
</SCRIPT>
</HTML>

View file

@ -0,0 +1,25 @@
<HTML>
<HEAD>
<base target="text">
<TITLE> Internet Workshop </TITLE>
</HEAD>
<BODY leftmargin=8 bgcolor="#FFFFFF" VLINK="#666666" LINK="#FF0000">
<FONT FACE="ARIAL,HELVETICA" SIZE="2">
<P>
<BR>
<P><FONT FACE="ARIAL,HELVETICA" SIZE="5"><B>Python AX Script Engine</B></FONT>
<BR>Demo using the Marquee Control
<BR>Mark Hammond.
<P>This is really quite a boring demo, as the Marquee control does everything. However, there is Python code behind the buttons that change the speed. This code is all of 2 lines per button!!!
<P>For more information on Python as an ActiveX scripting language, see
<P><B>Python</B>
<BR><A HREF="http://www.python.org">http://www.python.org</A>
</FONT>
</BODY>
</HTML>

View file

@ -0,0 +1,116 @@
<HTML>
<HEAD><TITLE>Python Script sample: Calculator</TITLE></HEAD>
<BODY><FONT FACE=ARIAL SIZE=3> <!-- global default -->
<SCRIPT LANGUAGE="Python">
# globals
Accum = 0.0 # Previous number (operand) awaiting operation
FlagNewNum = 1 # Flag to indicate a new number (operand) is being entered
NullOp = lambda x,y: y
PendingOp = NullOp# Pending operation waiting for completion of second operand
numberButNames = ['Zero','One','Two','Three','Four','Five','Six','Seven','Eight','Nine']
def NumPressed(Num):
print "NumPressed", Num
global FlagNewNum
if FlagNewNum:
ax.document.Keypad.ReadOut.Value = Num
FlagNewNum = None
else:
if ax.document.Keypad.ReadOut.Value == "0":
ax.document.Keypad.ReadOut.Value = str(Num)
else:
ax.document.Keypad.ReadOut.Value= ax.document.Keypad.ReadOut.Value + str(Num)
# Dynamically create handlers for all the decimal buttons.
# (ie, this will dynamically create "One_OnClick()"... etc handlers
for i in range(len(numberButNames)):
exec "def %s_OnClick():\tNumPressed(%d)\n" % (numberButNames[i],i)
def Decimal_OnClick():
global curReadOut, FlagNewNum
curReadOut = ax.document.Keypad.ReadOut.Value
if FlagNewNum:
curReadOut = "0."
FlagNewNum = None
else:
if not ("." in curReadOut):
curReadOut = curReadOut + "."
ax.document.Keypad.ReadOut.Value = curReadOut
import sys, string
def Operation(Op, fn):
global FlagNewNum, PendingOp, Accum
ReadOut = ax.document.Keypad.ReadOut.Value
print "Operation", Op, ReadOut, PendingOp, Accum
if FlagNewNum:
# User is hitting op keys repeatedly, so don't do anything
PendingOp = NullOp
else:
FlagNewNum = 1
Accum = PendingOp( Accum, string.atof(ReadOut) )
ax.document.Keypad.ReadOut.Value = str(Accum)
PendingOp = fn
def ClearEntry_OnClick():
# Remove current number and reset state
global FlagNewNum
ax.document.Keypad.ReadOut.Value = "0"
FlagNewNum = 1
def Clear_OnClick():
global Accum, PendingOp
Accum = 0
PendingOp = NullOp
ClearEntry_OnClick()
def Neg_OnClick():
ax.document.Keypad.ReadOut.Value = str(-string.atof(ax.document.Keypad.ReadOut.Value))
</SCRIPT>
<form action="" Name="Keypad">
<TABLE>
<B>
<TABLE BORDER=2 WIDTH=50 HEIGHT=60 CELLPADDING=1 CELLSPACING=5>
<CAPTION ALIGN=top> <b>Calculator</b><p> </CAPTION>
<TR>
<TD COLSPAN=3 ALIGN=MIDDLE><INPUT NAME="ReadOut" TYPE="Text" SIZE=24 VALUE="0" WIDTH=100%></TD>
<TD></TD>
<TD><INPUT NAME="Clear" TYPE="Button" VALUE=" C " ></TD>
<TD><INPUT NAME="ClearEntry" TYPE="Button" VALUE=" CE " ></TD>
</TR>
<TR>
<TD><INPUT NAME="Seven" TYPE="Button" VALUE=" 7 " ></TD>
<TD><INPUT NAME="Eight" TYPE="Button" VALUE=" 8 " ></TD>
<TD><INPUT NAME="Nine" TYPE="Button" VALUE=" 9 " ></TD>
<TD></TD>
<TD><INPUT NAME="Neg" TYPE="Button" VALUE=" +/- " ></TD>
<TD><INPUT NAME="Percent" TYPE="Button" VALUE=" % " OnClick="Operation('%', lambda x,y: x*y/100.0)"></TD>
</TR>
<TR>
<TD><INPUT NAME="Four" TYPE="Button" VALUE=" 4 " ></TD>
<TD><INPUT NAME="Five" TYPE="Button" VALUE=" 5 " ></TD>
<TD><INPUT NAME="Six" TYPE="Button" VALUE=" 6 " ></TD>
<TD></TD>
<TD ALIGN=MIDDLE><INPUT NAME="Plus" TYPE="Button" VALUE=" + " OnClick="Operation('+', lambda x,y: x+y)"></TD>
<TD ALIGN=MIDDLE><INPUT NAME="Minus" TYPE="Button" VALUE=" - " OnClick="Operation('-', lambda x,y: x-y)"></TD>
</TR>
<TR>
<TD><INPUT NAME="One" TYPE="Button" VALUE=" 1 " ></TD>
<TD><INPUT NAME="Two" TYPE="Button" VALUE=" 2 " ></TD>
<TD><INPUT NAME="Three" TYPE="Button" VALUE=" 3 " ></TD>
<TD></TD>
<TD ALIGN=MIDDLE><INPUT NAME="Multiply" TYPE="Button" VALUE=" * " OnClick="Operation('*', lambda x,y: x*y)" ></TD>
<TD ALIGN=MIDDLE><INPUT NAME="Divide" TYPE="Button" VALUE=" / " OnClick="Operation('/', lambda x,y: x/y)" ></TD>
</TR>
<TR>
<TD><INPUT NAME="Zero" TYPE="Button" VALUE=" 0 " ></TD>
<TD><INPUT NAME="Decimal" TYPE="Button" VALUE=" . " ></TD>
<TD COLSPAN=3></TD>
<TD><INPUT NAME="Equals" TYPE="Button" VALUE=" = " OnClick="Operation('=', lambda x,y: x)"></TD>
</TR></TABLE></TABLE></B>
</FORM>
</FONT></BODY></HTML>

View file

@ -0,0 +1,16 @@
<HTML>
<BODY>
<SCRIPT>
b="Hello There, how are you"
</SCRIPT>
<SCRIPT LANGUAGE="Python">
print "Hello"
a="Hi there"
document.write("Hello<P>")
alert("Hi there")
</SCRIPT>
</BODY>
</HTML>

View file

@ -0,0 +1,26 @@
<HTML>
<HEAD>
<TITLE>Python AXScript Demos</TITLE>
</HEAD>
<SCRIPT LANGUAGE="Python">
def Window_OnLoad():
pass
# import win32traceutil
# print "Frames are", ax.window.frames._print_details_()
# print "Frame 0 href = ", ax.frames.Item(0).location.href
def Name_OnLoad():
print "Frame loading"
</SCRIPT>
<FRAMESET FRAMEBORDER=1 COLS = "250, *">
<FRAME SRC="demo_menu.htm">
<FRAME SRC="demo_check.htm" NAME="Body">
</FRAMESET>
</HTML>

View file

@ -0,0 +1,42 @@
<HTML>
<H1>Engine Registration</H1>
<BODY>
<p>The Python ActiveX Scripting Engine is not currently registered.<p>
<p>Due to a <a href="http://starship.python.net/crew/mhammond/win32/PrivacyProblem.html">privacy
concern</a> discovered in the engine, the use of Python inside IE has been disabled.</p>
Before any of the supplied demos will work, the engine must be successfully registered.
<P>To install a version of the engine, that does work with IE, you can execute the Python program
<CODE>win32com\axscript\client\pyscript_rexec.py</CODE> must be run. You can either do this manually, or follow the instructions below.</p>
<H2>Register the engine now!</H2>
<p>If you have read about the <a href="http://starship.python.net/crew/mhammond/win32/PrivacyProblem.html">privacy
concern</a> and still wish to register the engine, just follow the process outlined below:</p>
<OL>
<LI>Click on the link below
<LI><B>A dialog will be presented asking if the file should be opened or saved to disk. Select "Open it".</B>
<LI>A Console program will briefly open, while the server is registered.
</OL>
<P><A HREF="..\..\..\client\pyscript_rexec.py">Register the engine now</A>
<H2>Checking the registration</H2>
After the registration is complete, simply hit the Reload button. If the
registration was successful, the page will change to the Python/AvtiveX Demo Page.
<SCRIPT LANGUAGE="Python">
try:
window.open("demo_intro.htm", "Body")
except:
history.back()
</SCRIPT>
</BODY></HTML>

View file

@ -0,0 +1,38 @@
<HTML>
<BODY>
<H1>
<MARQUEE NAME="Marquee1" DIRECTION=LEFT BEHAVIOR=SCROLL SCROLLAMOUNT=10 SCROLLDELAY=200
>Python ActiveX Scripting Demonstation
</MARQUEE>
</H1>
<p>Congratulations on installing the Python ActiveX Scripting Engine</p>
<p>Be warned that there is a <a href="http://starship.python.net/crew/mhammond/win32/PrivacyProblem.html">privacy
concern</a> with this engine. Please read this information, including how to disable the feature.</p>
<H3>Object model</H3>
<P>Except as described below, the object module exposed should be similar to that exposed
by Visual Basic, etc. Due to the nature of ActiveX Scripting, the details for each
host are different, but Python should work "correctly".
<P>The object model exposed via Python for MSIE is not as seamless as VB. The biggest limitation is
the concept of a "local" namespace. For example, in VB, you can
code <code>text="Hi there"</code>, but in Python, you must code
<code>MyForm.ThisButton.Text="Hi There"</code>. See the <A HREF="foo2.htm">foo2</A> sample
for futher details.
<H3>Known bugs and problems</H3>
<UL>
<LI><P>This release seems to have broken Aaron's mouse-trace sample. No idea why, and Im supposed to be looking into it.
<LI><P>Builtin objects such as MARQUEE are giving me grief. Objects accessed via forms are generally
no problem.
<LI><P>If you are trying to use Python with the Windows Scripting Host, note that
.pys files are not correct registered - you will need to explicitely
specify either cscript.exe or wscript.exe on the command line.
</UL>
</BODY></HTML>

View file

@ -0,0 +1,16 @@
<HTML>
<BODY>
<H1>Scripting Demos</H1>
<P>An <A HREF="demo_check.htm" TARGET=Body>Introduction</A> to the
scripting engine.
<P>The <A HREF="calc.htm" TARGET=Body>Calculator Demo</A> is a very
cool sample written by Aaron Watters.
<P><A HREF="mouseTrack.htm" TARGET=Body>Mouse track</A> is another of
Aaron's samples, and shows how fast the Python engine is!
<P>The <A HREF="foo2.htm" TARGET=Body>foo2 sample</A> is mainly used
for debugging and testing, but does show some forms in action.

View file

@ -0,0 +1,25 @@
<HTML>
<BODY>
A page generated by Python
<SCRIPT LANGUAGE="XXXVBScript">
document.open()
document.writeLn "<P>Hello from VBScript"
document.close()
</SCRIPT>
<SCRIPT LANGUAGE="Python">
ax.document.write("<P>Hello from Python")
ax.document.close()
ax.document.open()
ax.document.write("<P>Hello again from Python")
ax.document.close()
def Window_OnLoad():
pass
# ax.document.write("<P>Hello from Load from Python")
# ax.document.close()
</SCRIPT>
</BODY>
</HTML>

View file

@ -0,0 +1,105 @@
<HTML>
<BODY>
<SCRIPT>
b="Hello"
</SCRIPT>
<SCRIPT LANGUAGE="Python">
import win32traceutil
import sys
print "Hello"
a="Hi there"
print "Location is", document.location
document.write("Hello", " from version ", 2, " of the Python AXScript Engine","<P>")
document.writeln("This is Python", sys.version)
</SCRIPT>
<P>The caption on the first button is set by the Window Load code. Clicking
that button changes the text in the first edit box.
<P>The second button changes its own text when clicked.
<P>The fourth button calls a global function, defined in the global 'script' scope,
rather than the 'MyForm' scope.
<FORM NAME="MyForm" METHOD="GET">
<SCRIPT LANGUAGE="Python">
print "Hello from in the form"
</SCRIPT>
<INPUT NAME="Button1" TYPE="Button" OnClick="MyForm.Text1.value='Hi'" LANGUAGE="Python">
<INPUT TYPE="TEXT" SIZE=25 NAME="Text1">
<INPUT NAME="Button2" TYPE="Button" VALUE="Click for 'Hi'" OnClick="a='Howdy'; MyForm.Button2.value='Hi'" LANGUAGE="Python">
<INPUT NAME="Button3" TYPE="Button" VALUE="Click for URL" OnClick="MyForm.Text2.value=document.location" LANGUAGE="Python">
<INPUT TYPE="TEXT" SIZE=25 NAME="Text2">
<INPUT NAME="Button4" TYPE="Button" VALUE="Call global fn" OnClick="foo1()" LANGUAGE="Python">
<INPUT NAME="Button5" TYPE="Button" VALUE="Script for... Test">
<script for="Button5" event="onClick" language="Python">
print "HelloThere";
window.alert("Hello")
def ATest():
print "Hello from ATEst"
ATest()
</script>
<INPUT NAME="Button6" TYPE="Button" VALUE="Set Other" OnClick="Form2.Text1.Value='Hi from other'" LANGUAGE="Python">
</FORM><BR>
<P>
And here is a second form
<P>
<FORM NAME="Form2" METHOD="GET">
<INPUT NAME="Button1" TYPE="Button" OnClick="Form2.Text1.Value='Hi'" LANGUAGE="Python">
<INPUT NAME="Button2" TYPE="Button" VALUE="Set Other" OnClick="MyForm.Text1.Value='Hi from other'" LANGUAGE="Python">
<INPUT TYPE="TEXT" SIZE=25 NAME="Text1">
<INPUT NAME="ButRExec" TYPE="Button" VALUE="RExec fail" OnClick="import win32api;win32api.MessageBox(0,'Oops')" LANGUAGE="Python">
<INPUT NAME="ButRExec2" TYPE="Button" VALUE="RExec fail 2" OnClick="import sys,win32traceutil;print sys.modules;from win32com.client import dynamic;import win32com.client.dynamic, pythoncom, win32com.client;o=win32com.client.Dispatch('Word.Application')" LANGUAGE="Python">
<INPUT NAME="ButVB" TYPE="Button" VALUE="VBScript Button" OnClick='alert("Hi from VBScript")'>
<INPUT NAME="ButCallChain" TYPE="Button" VALUE="Multi-Language call" OnClick='CallPython()'>
</FORM><BR>
<SCRIPT LANGUAGE="VBScript">
function CallPython()
alert("Hello from VB - Im about to call Python!")
PythonGlobalFunction()
end function
</SCRIPT>
<SCRIPT LANGUAGE="JScript">
function JScriptFunction()
{
alert("Hello from JScript");
}
</SCRIPT>
<SCRIPT LANGUAGE="Python">
x=13
def foo1():
y = 14
for name, item in globals().items():
print name, `item`
alert ("Hello from AXCode")
print "Y is ",y
def PythonGlobalFunction():
window.alert("Hello from Python - Im about to call JScript!")
window.JScriptFunction()
def Window_OnLoad():
print "X is", x
print "a is", a
# print "------ GLOBALS ----------"
# for n,v in globals().items():
# print n,'=',v
print "MyForm is", MyForm
print "MyForm is repr", `MyForm`
print "MyForm.Button1 is", `MyForm.Button1`
MyForm.Button1.Value = "Python Rules!"
Form2.Button1.value = "Form2!"
MyForm.Text1.value = document.location
</SCRIPT>
</BODY>
</HTML>

View file

@ -0,0 +1,25 @@
<HTML>
<BODY>
<FORM NAME="TestForm" METHOD="POST" >
<INPUT TYPE="TEXT" SIZE=25 NAME="Name">Name<br>
<INPUT TYPE="TEXT" SIZE=25 NAME="Address">Address<br>
<INPUT TYPE=SUBMIT
</FORM>
<SCRIPT LANGUAGE="Python" for="TestForm" Event="onSubmit">
return Validate()
</SCRIPT>
<SCRIPT LANGUAGE="Python">
def Validate():
if not TestForm.Name.Value or not TestForm.Address.Value:
ax.alert("You must enter a name and address.")
return 1
return 0
</SCRIPT>
</BODY>
</HTML>

View file

@ -0,0 +1,60 @@
<HTML>
<HEAD>
<base target="text">
<TITLE> Internet Workshop </TITLE>
</HEAD>
<BODY leftmargin=8 bgcolor="#FFFFFF" VLINK="#666666" LINK="#FF0000">
<FONT FACE="ARIAL,HELVETICA" SIZE="2">
<P>
<BR>
<P><FONT FACE="ARIAL,HELVETICA" SIZE="5"><B>Marquee Demo</B></FONT>
<P>
<OBJECT
ID="Marquee1"
CLASSID="CLSID:1A4DA620-6217-11CF-BE62-0080C72EDD2D"
CODEBASE="/workshop/activex/gallery/ms/marquee/other/marquee.ocx#Version=4,70,0,1112"
TYPE="application/x-oleobject"
WIDTH=100%
HEIGHT=80
>
<PARAM NAME="szURL" VALUE="marqueeText1.htm">
<PARAM NAME="ScrollPixelsX" VALUE="0">
<PARAM NAME="ScrollPixelsY" VALUE="-5">
<PARAM NAME="ScrollDelay" VALUE="100">
<PARAM NAME="Whitespace" VALUE="0">
</OBJECT>
<br> <br>
<INPUT TYPE="Button" NAME="btnFaster" VALUE="Faster">
<INPUT TYPE="Button" NAME="btnNormal" VALUE="Normal">
<INPUT TYPE="Button" NAME="btnSlower" VALUE="Slower">
<SCRIPT Language="Python">
def btnFaster_Onclick():
ax.Marquee1.ScrollDelay = 0
def btnNormal_Onclick():
ax.Marquee1.ScrollDelay = 50
def btnSlower_Onclick():
ax.Marquee1.ScrollDelay = 300
</SCRIPT>
<P>&nbsp;
<HR>
<B>Notes:</B>
<P>
</FONT>
</BODY>
</HTML>

View file

@ -0,0 +1,83 @@
<HTML>
<HEAD><TITLE>Python Scripting sample: Mouse tracking</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF" TOPMARGIN=8>
<FONT SIZE=5>
<TABLE Border=0><TR VALIGN=MIDDLE><TD>
<A ID="Image"> <IMG
SRC="file:..\..\..\..\..\win32com\html\image\pycom_blowing.gif"
ALT="Clickable Map Image" HEIGHT=113 WIDTH=624 BORDER=0></A>
</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR VALIGN=MIDDLE><TD VALIGN=MIDDLE ALIGN=CENTER><FONT SIZE=5><INPUT
TYPE="text" NAME="TxtLinkDescription" SIZE=50></FONT></TD></TR></TABLE>
</FONT>
<P>
A mouse tracking demo. Move the mouse over the image above...
<SCRIPT Language="Python">
<!--
# Remember the last location clicked
#print "here we go", 1
mx = my = 0
# class for rectangle testing
class rect:
def __init__(self, lowx, lowy, upx, upy, desc, url):
self.lowx, self.lowy, self.upx, self.upy, self.desc, self.url = \
lowx, lowy, upx, upy, desc, url
def inside(self, x, y):
# print (x,y), "inside", self.desc,
result = self.lowx <= x <= self.upx and self.lowy <= y <= self.upy
# print result
return result
def mouse_move(self):
# print "move", self.desc
ax.TxtLinkDescription.Value = coords + " - " + self.desc
def onclick(self):
# print "click", self.desc
ax.TxtLinkDescription.Value = coords +" click! " + `self.url`
if self.url: ax.location = self.url
blows = "Blows away "
rects =[rect(12,48,59,101,blows+"Visual Basic", ""),
rect(107,0,172,58,blows+"Internet Explorer", ""),
rect(193,0,261,56,blows+"Microsoft Access", ""),
rect(332,43,392,93,blows+"Microsoft Word", ""),
rect(457,52,521,99,blows+"Microsoft Excel", ""),
rect(537,12,613,85,"Python blows them all away!", "http://www.python.org"),
]
default = rect(0,0,0,0,"Click on an icon","")
def Image_MouseMove(s, b, x, y):
global mx, my, coords
coords =`(x,y)`
# print coords,
mx, my = x, y
for r in rects:
if r.inside(x,y):
# print r.desc
r.mouse_move()
break
else:
# print default.desc
default.mouse_move()
def Image_OnClick():
for r in rects:
if r.inside(mx,my):
r.onclick()
break
-->
</SCRIPT>
<P>
</FONT>
</BODY>
</HTML>

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -0,0 +1,34 @@
#app=WScript.Application
#app._print_details_() # Use this to see what Python knows about a COM object.
g_index = 1
# A procedure, using a global.
def Show(desc, value = None):
global g_index # Need global for g_index, as I locally assign.
# No global needed to "xl" object, as only referenced.
# Also note "xl" is assigned later in the script - ie, Python is very late bound.
xl.Cells(g_index, 1).Value = desc
if value: xl.Cells(g_index, 2).Value = value
g_index = g_index + 1
xl = WScript.CreateObject("Excel.Application")
import sys
xl.Visible = 1
#xl.Workbooks().Add() # Excel versions before 98
xl.Workbooks.Add()
# Show the WScript properties.
Show("Application Friendly Name", WScript.Name)
Show("Application Version", WScript.Version)
Show("Application Context: Fully Qualified Name", WScript.FullName)
Show("Application Context: Path Only", WScript.Path)
Show("State of Interactive Mode", WScript.Interactive)
Show("All script arguments:")
args = WScript.Arguments
for i in range(0,args.Count()):
Show("Arg %d" % i, args(i))

View file

@ -0,0 +1,45 @@
""" Windows Script Host Sample Script
' Ported to Python
'
' ------------------------------------------------------------------------
' Copyright (C) 1996 Microsoft Corporation
'
' You have a royalty-free right to use, modify, reproduce and distribute
' the Sample Application Files (and/or any modified version) in any way
' you find useful, provided that you agree that Microsoft has no warranty,
' obligations or liability for any Sample Application Files.
' ------------------------------------------------------------------------
'
' This sample demonstrates how to write/delete from the registry.
"""
WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Popup("This script shows how to use registry related methods.", 2)
WshShell.Popup("Create key HKCU\\Foo with value 'Top level key'")
WshShell.RegWrite("HKCU\\Foo\\", "Top level key")
WshShell.Popup("Create key HKCU\\Foo\\Bar with value 'Second level key'")
WshShell.RegWrite( "HKCU\\Foo\\Bar\\", "Second level key")
WshShell.Popup ("Set value HKCU\\Foo\\Value to REG_SZ 1")
WshShell.RegWrite( "HKCU\\Foo\\Value", 1)
WshShell.Popup ("Set value HKCU\\Foo\\Bar to REG_DWORD 2")
WshShell.RegWrite ("HKCU\\Foo\\Bar", 2, "REG_DWORD")
WshShell.Popup ("Set value HKCU\\Foo\\Bar to REG_EXPAND_SZ '3'")
WshShell.RegWrite ("HKCU\\Foo\\Bar\\Baz", "%SystemRoot%\\Foo")
WshShell.Popup ("Delete value HKCU\\Foo\\Bar\\Baz")
WshShell.RegDelete ("HKCU\\Foo\\Bar\\Baz")
WshShell.Popup ("Delete key HKCU\\Foo\\Bar")
WshShell.RegDelete ("HKCU\\Foo\\Bar\\")
WshShell.Popup ("Delete key HKCU\\Foo")
WshShell.RegDelete ("HKCU\\Foo\\")
WScript.Echo ("Done")

View file

@ -0,0 +1,15 @@
# Testall - test core AX support.
# Test "Restricted Execution" (ie, IObjectSafety).
# This will fail if in a "restricted execution" environment, but
# will silenty do nothing of not restricted. This same line in an MSIE
# script would cause an exception.
print("Importing win32api...")
import win32api
if 1==1:
print("Hi")
WScript.Echo("Hello from WScript")
#fail