This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def createCOMObject(progID): | |
| type = System.Type.GetTypeFromProgID(progID) | |
| if None == type: | |
| return None | |
| return System.Activator.CreateInstance(type) | |
| ... | |
| obj = createCOMObject("Shell.Application") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def getLogicalDrives(): | |
| return System.IO.Directory.GetLogicalDrives() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import clr | |
| clr.AddReference("System.Management") | |
| import System | |
| from System.Management import * | |
| logicalDrives = None | |
| def getLogicalDrives(): | |
| global logicalDrives | |
| if None == logicalDrives: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import clr | |
| clr.AddReference("System.Windows.Forms") | |
| from System.Windows.Forms import * | |
| print dir() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import clr | |
| clr.AddReference("System.Windows.Forms") | |
| import System.Windows.Forms | |
| _f = None | |
| for _x in dir(System.Windows.Forms): | |
| try: | |
| _f = System.Windows.Forms.__dict__[_x] | |
| if callable(_f): | |
| globals()[_x] = _f | |
| except: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import clr | |
| clr.AddReference("System.Management") | |
| from System.Management import * | |
| from System import Console | |
| def EvLogEventArrived(sender, e): | |
| ##Get the Event object and display it | |
| for pd in e.NewEvent.Properties: | |
| Console.WriteLine("{0} = {1}", pd.Name, pd.Value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import clr | |
| import System.Collections | |
| clr.AddReference("System.Management.Automation") | |
| from System.Management.Automation import * | |
| from System.Management.Automation.Runspaces import * | |
| import System.IO | |
| def RunScript(script): | |
| runspace = RunspaceFactory.CreateRunspace() | |
| runspace.Open() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [reflection.assembly]::LoadFrom("C:\IronPython-1.1\IronPython.dll") | |
| $pythonEngine = New-Object -TypeName "IronPython.Hosting.PythonEngine" | |
| $pythonEngine.Execute("print 'Hello World!'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [reflection.assembly]::LoadFrom("C:\IronPython-2.0A7\IronPython.dll") | |
| $pythonEngine = [ironpython.hosting.pythonengine]::CurrentEngine | |
| $pythonEngine.Execute("print 'Hello World!'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Text; | |
| namespace negatives | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { |