def __init__(self): EnsureModule('{EA433010-2BAC-43C4-857C-7AEAC4A8CCE0}', 0, 1, 0) EnsureModule('{F66684D7-AAFE-4A62-9156-FF7A7853F764}', 0, 1, 0) self.TheConnection = EnsureDispatch("ZOSAPI.ZOSAPI_Connection") print(self.TheConnection) self.TheApplication = self.TheConnection.CreateNewApplication() print(self.TheApplication) self.TheSystem = self.TheApplication.PrimarySystem print(self.TheSystem)
def __init__(self): # make sure the Python wrappers are available for the COM client and # interfaces EnsureModule('ZOSAPI_Interfaces', 0, 1, 0) # Note - the above can also be accomplished using 'makepy.py' in the # following directory: # {PythonEnv}\Lib\site-packages\wind32com\client\ # Also note that the generate wrappers do not get refreshed when the # COM library changes. # To refresh the wrappers, you can manually delete everything in the # cache directory: # {PythonEnv}\Lib\site-packages\win32com\gen_py\*.* self.TheConnection = EnsureDispatch("ZOSAPI.ZOSAPI_Connection") if self.TheConnection is None: raise PythonStandaloneApplication.ConnectionException( "Unable to intialize COM connection to ZOSAPI") self.TheApplication = self.TheConnection.CreateNewApplication() if self.TheApplication is None: raise PythonStandaloneApplication.InitializationException( "Unable to acquire ZOSAPI application") if self.TheApplication.IsValidLicenseForAPI == False: raise PythonStandaloneApplication.LicenseException( "License is not valid for ZOSAPI use") self.TheSystem = self.TheApplication.PrimarySystem if self.TheSystem is None: raise PythonStandaloneApplication.SystemNotPresentException( "Unable to acquire Primary system")
def __init__(self,url=None,w=800,h=600,title="",fullscreen=False, headless=False,transparent=False,embedIn=None): """ See http://wiki.wxpython.org/SynchronisingToInternetExplorer?highlight=(activex) https://www.codeproject.com/articles/3365/embed-an-html-control-in-your-own-window-using-pla """ Browser.__init__(self,url,w,h,title,fullscreen,headless,transparent,embedIn) self._url=None clsid='{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}' module=EnsureModule(clsid,0,1,1) theClass=MakeActiveXClass(module.WebBrowser,eventObj=self) self.browser=theClass(self,-1) self.uiControl=wxFrame(None,-1,title) self.uiControl.SetAutoLayout(True) lc=wxLayoutConstraints() lc.right.SameAs(self.uiControl,wxRight) lc.left.SameAs(self.uiControl,wxLeft) lc.top.SameAs(self.uiControl,wxTop) lc.bottom.SameAs(self.uiControl,wxBottom) self.browser.SetConstraints(lc) app=wxApp() self.uiControl.Show(True) app.SetTopWindow(self.uiControl) if url is not None: self.url=url
def Connect(): global NOTIFY, GATE #the below is required in order to establish the com-object links #that way you don't need to run makepy first EnsureModule('{98B8AE14-466F-11D6-A27B-00B0D0F3CCA6}', 0, 1, 0) GATE = EnsureDispatch('XTAPI.TTGate') NOTIFY = DispatchWithEvents('XTAPI.TTInstrNotify', InstrNotify)
def Connect(): global NotifyTF, NotifySPRD, Gate #the below is required in order to establish the com-object links #that way you don't need to run makepy first EnsureModule('{98B8AE14-466F-11D6-A27B-00B0D0F3CCA6}', 0, 1, 0) Gate = EnsureDispatch('XTAPI.TTGate') NotifyTF = DispatchWithEvents('XTAPI.TTInstrNotify', InstrNotify) NotifyTF.gen_agent('agentTF', 'channelTF') print('Connected...') NotifySPRD = DispatchWithEvents('XTAPI.TTInstrNotify', InstrNotify) NotifySPRD.gen_agent('agentSPRD', 'channelSPRD') print(' Connected Spreads...')
from win32com.client.gencache import EnsureDispatch, EnsureModule from win32com.client import CastTo, constants # Notes # # The python project and script was tested with the following tools: # Python 3.4.3 for Windows (32-bit) (https://www.python.org/downloads/) - Python interpreter # Python for Windows Extensions (32-bit, Python 3.4) (http://sourceforge.net/projects/pywin32/) - for COM support # Microsoft Visual Studio Express 2013 for Windows Desktop (https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx) - easy-to-use IDE # Python Tools for Visual Studio (https://pytools.codeplex.com/) - integration into Visual Studio # # Note that Visual Studio and Python Tools make development easier, however this python script should should run without either installed. # make sure the Python wrappers are available for the COM client and # interfaces EnsureModule('ZOSAPI_Interfaces', 0, 16, 0) EnsureModule('ZOSAPI', 0, 16, 0) # Note - the above can also be accomplished using 'makepy.py' in the # following directory: # {PythonEnv}\Lib\site-packages\wind32com\client\ # Also note that the generate wrappers do not get refreshed when the # COM library changes. # To refresh the wrappers, you can manually delete everything in the # cache directory: # {PythonEnv}\Lib\site-packages\win32com\gen_py\*.* TheConnection = EnsureDispatch("ZOSAPI.ZOSAPI_Connection") if TheConnection is None: raise Exception("Unable to intialize COM connection to ZOSAPI") TheApplication = TheConnection.ConnectAsExtension(0)