Hi all,
I have a python script which controls a number of remote plugins, these are based on VMC controller and control Windows7 Media Center and it's Extenders.
However there are times i need to control then enable/disable of the plugin from within a script, after reading and decoding lots of other source i have tried :-
eg.plugins.EventGhost.EnableItem("VMCControl")
but i get a string parameter error and missing target.
Traceback (most recent call last):
Python script "96", line 17, in <module>
eg.plugins.EventGhost.EnableItem("MCXControl4")
File "C:\Program Files\EventGhost\plugins\EventGhost\__init__.py", line 134, in __call__
AttributeError: 'str' object has no attribute 'target'
Is it possible that someone could point me in the right direction.
Before you ask, yes i could define mutilple events and actions and use the Enable/Disable Item option within the plugin tree or XML file, i am specifically enquiring about doing this from within a python script.
Thank you in advance for any help.
Regards
Nigel
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Help needed with Start/Stop plugin from a python script
-
jsonnabend
- Experienced User
- Posts: 127
- Joined: Wed Apr 23, 2008 7:35 pm
Re: Help needed with Start/Stop plugin from a python script
I think the parameter needs to be the ID attribute of the node you are trying to enable/disable (and it needs to be cast as an XMLIdLink). For example:
- Jeff
Code: Select all
eg.plugins.EventGhost.EnableItem(XmlIdLink(28))Re: Help needed with Start/Stop plugin from a python script
Thanks for the reply Jeff,
I tried as you advised but just get the following message;-
23:49:10 Traceback (most recent call last):
23:49:10 Python script "18", line 1, in <module>
23:49:10 eg.plugins.EventGhost.DisableItem(XmlIdLink(4))
23:49:10 NameError: name 'XmlIdLink' is not defined
Thanks for your help though.
Regards
Nigel
I tried as you advised but just get the following message;-
23:49:10 Traceback (most recent call last):
23:49:10 Python script "18", line 1, in <module>
23:49:10 eg.plugins.EventGhost.DisableItem(XmlIdLink(4))
23:49:10 NameError: name 'XmlIdLink' is not defined
Thanks for your help though.
Regards
Nigel
-
jsonnabend
- Experienced User
- Posts: 127
- Joined: Wed Apr 23, 2008 7:35 pm
Re: Help needed with Start/Stop plugin from a python script
I see the same problem here. I've played around with this some, but I can't figure out a work around. Perhaps Bitmonster will chime in.
- Jeff
- Jeff
Re: Help needed with Start/Stop plugin from a python script
For what it's worth - I've found a workaround.
I wanted to be able to toggle from a program, to the mouse, and then back to the program without having to push another button.
First I initialized a variable using PythonCommand in Autostart, mouse=0
I set a trigger on the mouse button to execute a Python script
Next I set up event handlers for those events:
TurnMouseOn enables exclusive on the mouse emulation context folder
I show OSD: Mouse Mode: ON
and set using Python command mouse =1
TurnMouseOff executes a Python Script:
next, set mouse=0 using Python Command, and
show OSD Mouse Mode: OFF
I created event handlers for each of the above, e.g. enableEx:MCE. All those do is Enable exclusive for each respective item.
"programControl" is a variable I set when the application is launched, e.g. programControl = "MCE" when MediaCenter is launched.
I'm considering setting programControl to "0" if the application is destroyed.
I wanted to be able to toggle from a program, to the mouse, and then back to the program without having to push another button.
First I initialized a variable using PythonCommand in Autostart, mouse=0
I set a trigger on the mouse button to execute a Python script
Code: Select all
from os import path
if eg.globals.mouse == 1:
eg.TriggerEvent("TurnMouseOff")
else:
eg.TriggerEvent("TurnMouseOn")TurnMouseOn enables exclusive on the mouse emulation context folder
I show OSD: Mouse Mode: ON
and set using Python command mouse =1
TurnMouseOff executes a Python Script:
Code: Select all
from os import path
if eg.globals.programControl == "MCE":
eg.TriggerEvent("enableEx:MCE")
elif eg.globals.programControl == "XBMC":
eg.TriggerEvent("enableEx:XBMC")
elif eg.globals.programControl == "BeyondTV":
eg.TriggerEvent("enableEx:BeyondTV")
else:
eg.TriggerEvent("enableEx:Keyboard")
show OSD Mouse Mode: OFF
I created event handlers for each of the above, e.g. enableEx:MCE. All those do is Enable exclusive for each respective item.
"programControl" is a variable I set when the application is launched, e.g. programControl = "MCE" when MediaCenter is launched.
I'm considering setting programControl to "0" if the application is destroyed.