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.

10 Times event => Action

If you have a question or need help, this is the place to be.
Post Reply
PieterDM
Posts: 5
Joined: Tue Dec 16, 2014 4:52 pm

10 Times event => Action

Post by PieterDM »

Hi everybody,

I'm new to EG and I have a problem. I've searched for 2 days but found no answer so I decided to ask you guys.
I want to trigger an action after an event has occured let's say 10 times.

For example:
when I pres the "A" key 10 times, I want a program to open. ( it's not the trigger I want, it's just an example)
I use that program for a while and close is.
afterwards I want to press the "A" key again 10 times to open that program.

I think I should write a Python script that is excecuted every time the event occures?
Or is there an other easyer solution? ( I have no experience with Python )

If someone could help me it would save me a lot of time :)

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

Re: 10 Times event => Action

Post by Pako »

You do not need any scripting, when you use the Multitap plugin with "Single key" mode.
In fact it can be any event (this is not restricted to the real key).

Pako
PieterDM
Posts: 5
Joined: Tue Dec 16, 2014 4:52 pm

Re: 10 Times event => Action

Post by PieterDM »

Pako,

Thank you for Your quick reply, I will look into multitap!

Kind regards
PieterDM
Posts: 5
Joined: Tue Dec 16, 2014 4:52 pm

Re: 10 Times event => Action

Post by PieterDM »

Hi Pako,

I looked into multitap and tried to find some examples on the forum.
This is what I came up with so far:

Image
Image
Image

On these images you see my settings. Now what I want is to push the 'A key' 3 times to start DTLite.exe .
When I right click and execute, DTLite starts, so that's ok.
My problem is that DTLite doesn't start when I press the 'A key' 3 times, and when I press a forth time it restarts at 1x.

I must have overlooked something, hope you can help me?

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

Re: 10 Times event => Action

Post by Pako »

Perhaps it would be helpful if timeout is not zero.

Pako
PieterDM
Posts: 5
Joined: Tue Dec 16, 2014 4:52 pm

Re: 10 Times event => Action

Post by PieterDM »

OK, thanks Pako, I see how multitap works now.

However I don't think multitap is a solution to my problem.
The presses of the 'A key' can be 20min appart, and by the 10th press on the button my command should be excecuted.

Can multitap be a solution to this problem?
Is there another way to insert a counter of some kind?
Or should I try to make a Python script for this?

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

Re: 10 Times event => Action

Post by Pako »

I do not know what it means "appart" (I could not find it in the dictionary).
However, I understand how it is meant.
Yes, in this case Multitap plugin is not suitable.
Here it is necessary to use a simple Python Script.
For example, it might look like this:

Code: Select all

limit = 10
if "myCounter" not in eg.globals.__dict__:
    eg.globals.myCounter = 0
eg.globals.myCounter += 1
if eg.globals.myCounter == limit:
    eg.TriggerEvent("Limit.Reached", prefix = "MyCounter")
    eg.globals.myCounter = 0
Pako
PieterDM
Posts: 5
Joined: Tue Dec 16, 2014 4:52 pm

Re: 10 Times event => Action

Post by PieterDM »

Woehoew, got it working!

You were great help Pako, thank you and happy holidays!
Post Reply