Project

General

Profile

Bug #1166 » gatantest.py

Jim Pulokas, 01/31/2011 11:41 AM

 
import pythoncom
import pywintypes
import win32com.client

def hasScriptFunction(cam, name):
script = 'if(DoesFunctionExist("%s")) Exit(1.0) else Exit(-1.0)'
script %= name
result = cam.ExecuteScript(script)
return result > 0.0

script_functions = [
'AFGetSlitState',
'AFSetSlitState',
'AFGetSlitWidth',
'AFSetSlitWidth',
'AFDoAlignZeroLoss',
'IFCGetSlitState',
'IFCSetSlitState',
'IFCGetSlitWidth',
'IFCSetSlitWidth',
'IFCDoAlignZeroLoss',
]

pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED)
camera = win32com.client.dynamic.Dispatch('TecnaiCCD.GatanCamera.2')

for name in script_functions:
if hasScriptFunction(camera, name):
print 'SUPPORTED:', name
else:
print 'UNSUPPORTED:', name
raw_input('enter to quit')
(2-2/5)