Does anyone know of a way to enable or disable a folder or macro inside of a python script in EG?
So far eg.plugins.EventGhost.DisableItem(XmlIdLink(1130)) wont work because XmlIDLink is not defined in the script. This would make designing triggers far easier if I could do this in one piece of code.
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.
Disable/Enable macro in script
-
eatmeimadanish
- Experienced User
- Posts: 118
- Joined: Thu Oct 01, 2009 5:11 pm
Re: Disable/Enable macro in script
Check out the code in EventGhost\eg\Classes\UndoHandler\ToggleEnable.py
I used one of the classes in UndoHandler in the RCAware plugin, to paste an XML document into the config tree after plugin installation:
You should be able to figure out how to get the TreePosition object to the node you want to enable/disable (see EventGhost\eg\Classes\TreeItem.py, looks like GetAllItems() may be useful).
I used one of the classes in UndoHandler in the RCAware plugin, to paste an XML document into the config tree after plugin installation:
Code: Select all
if self.firstLoad:
try:
xmlFile = open(os.path.join(self.pluginDir, "macros.xml"), "r")
xmlString = xmlFile.read()
xmlFile.close()
wx.TheClipboard.Open()
wx.TheClipboard.SetData(wx.TextDataObject(xmlString))
wx.TheClipboard.Close()
eg.document.selection = eg.document.selection.parent
[b]eg.UndoHandler.Paste(eg.document).Do(eg.document.selection)[/b]
except:
pass
-
eatmeimadanish
- Experienced User
- Posts: 118
- Joined: Thu Oct 01, 2009 5:11 pm
Re: Disable/Enable macro in script
Wow thanks, I was totally going down a different path, but that makes much more sense. I wonder if this could be a feature request inside of EG for a an enhancement. I know that if I could easily script enable or disable based on payload data, it would make web based settings pages far easier to manage and simpler to control programmaticly then tons of macros.
-
eatmeimadanish
- Experienced User
- Posts: 118
- Joined: Thu Oct 01, 2009 5:11 pm
Re: Disable/Enable macro in script
Or maybe I will just write my own update... 
-
eatmeimadanish
- Experienced User
- Posts: 118
- Joined: Thu Oct 01, 2009 5:11 pm
Re: Disable/Enable macro in script
I noticed that this method would only update the XML file, but not sure it would trigger the actual action.