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.

read macroname into script?

If you have a question or need help, this is the place to be.
Post Reply
eddiex666
Posts: 41
Joined: Fri Sep 12, 2014 10:34 pm

read macroname into script?

Post by eddiex666 »

simple question..

in a script, how can I read / use the name of the macro?

ex:
macro1:
- event: Tellstick.device1
- script:
- macroname = eg.printmacroname
- print macroname

I wish the result is "macro1"

Any simple tips?

I tryed allmost all eg. commands... :-)

Eddie
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: read macroname into script?

Post by Pako »

Code: Select all

print eg.currentItem.parent.name
It's simple enough?
eddiex666
Posts: 41
Joined: Fri Sep 12, 2014 10:34 pm

Re: read macroname into script?

Post by eddiex666 »

You rock Pako :-)

offcourse if works..

Where can I find those types of commands?

Eddie
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: read macroname into script?

Post by Pako »

eddiex666 wrote:Where can I find those types of commands?
That you find when you're going to read (and study) files with the extension .py.

Pako
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: read macroname into script?

Post by krambriw »

In addition to Pako's suggestions and advice's, I would like to add that one of the best resources is to use the Python Shell (that is available from the Help menu).

As example, start with 'import eg'. From there on it is just to start typing, beginning with 'eg.' and you will see what is happening every time you hit the dot (you get a menu with available selections). As a further example to your question, check the picture below

Best regards
Image2.jpg
Post Reply