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.

Close OS Menu after a delay

If you have a question or need help, this is the place to be.
themaster1
Experienced User
Posts: 133
Joined: Wed Feb 03, 2010 9:02 pm

Close OS Menu after a delay

Post by themaster1 »

I'm trying to have the OS Menu closed after some time, i have tried with Wait(10sec) + Jump but it don't work, any hint ?
User avatar
wakko
Posts: 33
Joined: Sat Aug 20, 2011 9:27 pm
Location: Russia, Siberia

Re: Close OS Menu after a delay

Post by wakko »

You can use System.Idle timer. Set it up, say, on 10 seconds.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1534">
    <Action>
        System.SetIdleTime(10.0)
    </Action>
</EventGhost>
You can trigger "OS Menu: CANCEL" on System.Idle event.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1534">
    <Macro Name="Cancel" Expanded="True">
        <Event Name="System.Idle" />
        <Action>
            OSM.Cancel_Btn()
        </Action>
    </Macro>
</EventGhost>
I done it right that way.
To stop closing OSMenu after unpredictable period of time, while i'm calling OSMenu, i'm also resetting System.Idle timer to zero.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1534">
    <Folder Name="IdleReseter" Expanded="True">
        <Macro Name="IdleReseter" Expanded="True">
            <Event Name="Lirc.Menu" />
            <Action>
                Window.SendKeys(u'{RShift}', False)
            </Action>
        </Macro>
    </Folder>
</EventGhost>
Also, i'm resetting System.Idle timer with every press OSMenu keys.
Example:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1534">
    <Macro Name="OS Menu: Page Down" Expanded="True">
        <Event Name="Lirc.Left" />
        <Action>
            OSM.PageDown()
        </Action>
        <Action>
            Window.SendKeys(u'{RShift}', False)
        </Action>
    </Macro>
</EventGhost>
To reset System.Idle timer i'm using "Emulate keystrokes <right shift>.
May be there is a better way, but it working OK for me.
themaster1
Experienced User
Posts: 133
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Post by themaster1 »

Python script huh ? Why not , problem is there are errors returned

1st script:
Error compiling script.
Traceback (most recent call last):
SyntaxError: invalid syntax (5, line 1)

2nd script:

Error compiling script.
Traceback (most recent call last):
SyntaxError: invalid syntax (6, line 1)
User avatar
wakko
Posts: 33
Joined: Sat Aug 20, 2011 9:27 pm
Location: Russia, Siberia

Re: Close OS Menu after a delay

Post by wakko »

This is not a python scripts.
This is just a parts of my EG config.
First code is from an autostart section (setting up idle timer).
Second you can copy and paste in any section of your config.
Of course, you already should have OSmenu plagin enabled.
Those codes are given is just as examples for you. You should adapt them to your needs.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Close OS Menu after a delay

Post by Pako »

wakko wrote:You can use System.Idle timer. Set it up, say, on 10 seconds.
You can trigger "OS Menu: CANCEL" on System.Idle event.
I done it right that way.
To stop closing OSMenu after unpredictable period of time, while i'm calling OSMenu, i'm also resetting System.Idle timer to zero.
Also, i'm resetting System.Idle timer with every press OSMenu keys.
To reset System.Idle timer i'm using "Emulate keystrokes <right shift>.
May be there is a better way, but it working OK for me.
I do not understand why you're doing such a complicated manner.
After all you can do it as follows:
CloseOSMdelay.png
CloseOSMdelay.png (9.17 KiB) Viewed 4257 times
However it has one drawback.
If you normally choose some action in OSM and then you open another menu (before the preset time expires),
then it prematurely closes the new menu.

Pako
User avatar
wakko
Posts: 33
Joined: Sat Aug 20, 2011 9:27 pm
Location: Russia, Siberia

Re: Close OS Menu after a delay

Post by wakko »

Thank you Pako for your critics.
However, my main goal was to trigger "OS Menu: Cancel" action only, if there is no any activity for a 10 seconds.
I'm using OS Menu for building TV channels streaming list, with many positions in it. It is huge. The way i'm using "OS Menu: Cancel" gives me as many time as i need to choose TV channel, without OS Menu suddenly closes by time out (triggered by triggerevent action).
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Close OS Menu after a delay

Post by Pako »

If you are uncomfortable mentioned disadvantage, you can do the following:
CloseOSM_2.png
Python Script:

Code: Select all

eg.scheduler.CancelTask(eg.globals.osmDelay)
eg.globals.osmDelay = eg.scheduler.AddTask(10, eg.plugins.OSM.Cancel_Btn)
Pako
User avatar
wakko
Posts: 33
Joined: Sat Aug 20, 2011 9:27 pm
Location: Russia, Siberia

Re: Close OS Menu after a delay

Post by wakko »

Pako's second solution looks great and would work perfectly, i think. :) I suggest to topic starter use it.
themaster1
Experienced User
Posts: 133
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Post by themaster1 »

I tried your python commands Pako without luck. Do i need a plugin or something ?
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Close OS Menu after a delay

Post by Pako »

No, do not need anything else.
I do not see why it would not work.
However it is clear that it can work when you're going to control the menu using the keyboard.
It is necessary to control it using the prepared actions.
In the example shown, however, are no events.
You must complete the required events (of course it depends on what you have remote control).

Pako
themaster1
Experienced User
Posts: 133
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Post by themaster1 »

After further testing it is working. It seems you have to put each command right after OS Menu show menu / Cancel. The problem was that i have things after such as Find window OS Menu; bring to front or enable Context folder.

Picture of the working configuration:
http://imageupload.org/en/file/187177/o ... y.jpg.html


Many thanks to you Pako
Last edited by themaster1 on Fri Feb 24, 2012 8:56 am, edited 1 time in total.
themaster1
Experienced User
Posts: 133
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Post by themaster1 »

I have a request: Can the scrollbar of the Os Menu be cosmetically arranged ? (it look old school)

I have many items on the menu and now the scroll bar appear at the right side

picture:
http://imageupload.org/en/file/187189/s ... r.jpg.html
themaster1
Experienced User
Posts: 133
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Post by themaster1 »

Actually something's wrong with Os Menu Cancel, it don't enable the context menu if i don't pick an item from the list
see this picture again: http://imageupload.org/en/file/187177/o ... y.jpg.html

I guess that's because it is triggered by the python command rather than the event remote. Sounds like i'll need more python commands
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Close OS Menu after a delay

Post by Pako »

I think the solution is very easy. Just read the description of the OSM plugin and act accordingly.
OSM_Description.png
Pako
themaster1
Experienced User
Posts: 133
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Post by themaster1 »

Well if i put the OsMenu folder above the Context folder it don't change anything
Post Reply