def ExecuteMacro(self, sMacro): sRet = "Command not found...:" + sMacro if len(self.aTreeMacros) == 0: self.BrowseTree() oMacro = self.aTreeMacros.get(sMacro) if oMacro is None: oMacro = self.aRawMacros.get(sMacro) if oMacro is not None: sRet = oMacro.Execute if isinstance(oMacro, eg.MacroItem): eg.programCounter = (oMacro, 0) sRet = eg.RunProgram() elif isinstance(oMacro, eg.ActionItem): sRet = oMacro.Execute() #def ExecuteTreeItem(obj, event): if sRet is None: sRet = '' if not isinstance(sRet, str): print("ORCA: ErrorExecute:", type(sRet)) sRet = str(sRet) return sRet return "Error"
def StartSession(self, filename): eg.eventTable.clear() self.corePluginInfos = [] for guid in eg.CORE_PLUGIN_GUIDS: try: pluginInfo = eg.pluginManager.OpenPlugin(guid, None, ()) pluginInfo.instance.__start__() pluginInfo.isStarted = True self.corePluginInfos.append(pluginInfo) except: # pylint: disable-msg=W0702 eg.PrintTraceback() start = clock() eg.document.Load(filename) eg.PrintDebugNotice("XML loaded in %f seconds." % (clock() - start)) missingHardwareIds = (set(eg.WinUsb.ListDevices().iterkeys()) - set(pluginInfo.info.hardwareId for pluginInfo in eg.pluginList)) missingPlugins = [ pluginInfo for pluginInfo in eg.pluginManager.database.itervalues() # NOQA if pluginInfo.hardwareId in missingHardwareIds ] if missingPlugins: print "EventGhost has found devices on your system, that can be " print "handled by the following plugins and are not loaded by your" print "current configuration:" for pluginInfo in missingPlugins: print " -", pluginInfo.name print "If you want to use them, please add the missing plugins." eg.programCounter = (eg.document.autostartMacro, None) eg.RunProgram()
def ExecuteTreeItem(obj, event): eg.SetProcessingState(2, event) eg.event = event if isinstance(obj, eg.MacroItem): eg.programCounter = (obj, 0) eg.RunProgram() elif isinstance(obj, eg.ActionItem): obj.Execute() eg.SetProcessingState(1, event)
def StartSession(self, filename): eg.eventTable.clear() self.corePluginInfos = [] for guid in eg.CORE_PLUGIN_GUIDS: try: pluginInfo = eg.pluginManager.OpenPlugin(guid, None, ()) pluginInfo.instance.__start__() pluginInfo.isStarted = True self.corePluginInfos.append(pluginInfo) except: # pylint: disable-msg=W0702 eg.PrintTraceback() start = clock() eg.document.Load(filename) eg.PrintDebugNotice("XML loaded in %f seconds." % (clock() - start)) missingHardwareIds = (set(eg.WinUsb.ListDevices().keys()) - set(pluginInfo.info.hardwareId for pluginInfo in eg.pluginList)) missingPlugins = [ pluginInfo for pluginInfo in eg.pluginManager.database.values() # NOQA if pluginInfo.hardwareId in missingHardwareIds ] if missingPlugins: print("EventGhost has found devices on your system, that can be ") print( "handled by the following plugins and are not loaded by your") print("current configuration:") for pluginInfo in missingPlugins: print(" -", pluginInfo.name) print("If you want to use them, please add the missing plugins.") payload = dict(IsLocalAdmin=User.IsLocalAdmin(), IsDomainLogin=User.IsDomainLogin()) if payload['IsDomainLogin']: payload['IsDomainAdmin'] = User.IsDomainAdmin() event = eg.EventGhostEvent(prefix='Windows', suffix='User.' + User.Name(), payload=payload) event.Execute() eg.programCounter = (eg.document.autostartMacro, None) eg.RunProgram()