Hi I have another problem. I have two photoelectric barriers to count visitors. connected, for example, 1 and 2 buttons on the keyboard to do that after the termination of the first and then the second counter will count it as one and the opposite situation as -1. I tried to use jump to another macro enable and distable buttons clear pending events etc. but it did not work. Can you help me one mor time ?
https://www.youtube.com/watch?v=NFQXi-j_5nY control sample
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.
Counter
Re: Counter
HelloPako wrote:Yes, now I finally understand.nikus_v13 wrote:I want to make something like this: https://www.youtube.com/watch?v=M_X-KrfMF-4
and use eventghost to count visitors.
In this case, we do not need a new feature.
Similar things you can do using EventGhost for many years.
This can be solved in different ways.
Here you see one of them (you may need to add the Webserver plugin to your configuration):Here's a copy of that part of the tree (you can do copy / paste to tree):PakoCode: Select all
<?xml version="1.0" encoding="UTF-8" ?> <EventGhost Version="1640"> <Folder Name="Counter - demo" Expanded="True"> <Macro Name="Webserver: Increment persistent value: visitorCounter" Expanded="True"> <Event Name="Main.VisitorPlus" /> <Action> Webserver.GetPersistentValue(u'visitorCounter') </Action> <Action> EventGhost.PythonCommand(u'eg.result=str(int(eg.result)+1) if eg.result is not None else "1"') </Action> <Action> Webserver.SetPersistentValue(u'visitorCounter', u'{eg.result}') </Action> <Action> Webserver.GetPersistentValue(u'visitorCounter') </Action> <Action> EventGhost.ShowOSD(u'{eg.result}', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;66;Comic Sans MS', (255, 0, 0), (0, 0, 0), 1, (5, 5), 0, 0.0, True) </Action> </Macro> <Macro Name="Webserver: Decrement persistent value: visitorCounter" Expanded="True"> <Event Name="Main.VisitorMinus" /> <Action> Webserver.GetPersistentValue(u'visitorCounter') </Action> <Action> EventGhost.PythonCommand(u'eg.result=str(int(eg.result)-1) if eg.result is not None else "0"') </Action> <Action> Webserver.SetPersistentValue(u'visitorCounter', u'{eg.result}') </Action> <Action> Webserver.GetPersistentValue(u'visitorCounter') </Action> <Action> EventGhost.ShowOSD(u'{eg.result}', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;66;Comic Sans MS', (255, 0, 0), (0, 0, 0), 1, (5, 5), 0, 0.0, True) </Action> </Macro> </Folder> </EventGhost>
Is there any way to display this counter on a webpage using the webserver plugin instead of the OSD
Re: Counter
Hello,
I'm trying to use the persistent variables in the webserver.
And I can set a variable and see it in webserver plugin.
But how do I print/use it?
To be more specific, what's the commando in EG, ex eg.globals.mypersistentvalue does not work.
Cheers!
I'm trying to use the persistent variables in the webserver.
And I can set a variable and see it in webserver plugin.
But how do I print/use it?
To be more specific, what's the commando in EG, ex eg.globals.mypersistentvalue does not work.
Cheers!
Re: Counter
Still learning.. managed to understand "eg.results" better 
so putting a persistent value is just using the action set persistent variable:
Set mypersistentvalue with value {eg.globals.myvariable}
Getting it back I had to use the "get persistent value" action and a little python script to put it back to my normal variable in the startup, OR when called upon by an event or whatever:
eg.plugins.Webserver.GetPersistentValue(u'mypersistentvalue', False)
eg.globals.myvariable = eg.result
Now my eg.globals.myvariable has the same variable as before a reboot of EG
so putting a persistent value is just using the action set persistent variable:
Set mypersistentvalue with value {eg.globals.myvariable}
Getting it back I had to use the "get persistent value" action and a little python script to put it back to my normal variable in the startup, OR when called upon by an event or whatever:
eg.plugins.Webserver.GetPersistentValue(u'mypersistentvalue', False)
eg.globals.myvariable = eg.result
Now my eg.globals.myvariable has the same variable as before a reboot of EG