Close OS Menu after a delay

If you have a question or need help, this is the place to be.

Close OS Menu after a delay

Postby themaster1 » Thu Feb 23, 2012 9:06 am

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 ?
themaster1
Experienced User
 
Posts: 105
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Postby wakko » Thu Feb 23, 2012 1:57 pm

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.
User avatar
wakko
 
Posts: 25
Joined: Sat Aug 20, 2011 9:27 pm
Location: Russia, Siberia

Re: Close OS Menu after a delay

Postby themaster1 » Thu Feb 23, 2012 3:15 pm

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)
themaster1
Experienced User
 
Posts: 105
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Postby wakko » Thu Feb 23, 2012 3:35 pm

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
wakko
 
Posts: 25
Joined: Sat Aug 20, 2011 9:27 pm
Location: Russia, Siberia

Re: Close OS Menu after a delay

Postby Pako » Thu Feb 23, 2012 5:02 pm

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 1132 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
Pako
Plugin Developer
 
Posts: 1283
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic

Re: Close OS Menu after a delay

Postby wakko » Thu Feb 23, 2012 6:07 pm

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
wakko
 
Posts: 25
Joined: Sat Aug 20, 2011 9:27 pm
Location: Russia, Siberia

Re: Close OS Menu after a delay

Postby Pako » Thu Feb 23, 2012 6:13 pm

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
Pako
Plugin Developer
 
Posts: 1283
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic

Re: Close OS Menu after a delay

Postby wakko » Thu Feb 23, 2012 6:35 pm

Pako's second solution looks great and would work perfectly, i think. :) I suggest to topic starter use it.
User avatar
wakko
 
Posts: 25
Joined: Sat Aug 20, 2011 9:27 pm
Location: Russia, Siberia

Re: Close OS Menu after a delay

Postby themaster1 » Thu Feb 23, 2012 11:07 pm

I tried your python commands Pako without luck. Do i need a plugin or something ?
themaster1
Experienced User
 
Posts: 105
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Postby Pako » Fri Feb 24, 2012 8:16 am

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
User avatar
Pako
Plugin Developer
 
Posts: 1283
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic

Re: Close OS Menu after a delay

Postby themaster1 » Fri Feb 24, 2012 8:31 am

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: 105
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Postby themaster1 » Fri Feb 24, 2012 8:54 am

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: 105
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Postby themaster1 » Fri Feb 24, 2012 9:10 am

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
themaster1
Experienced User
 
Posts: 105
Joined: Wed Feb 03, 2010 9:02 pm

Re: Close OS Menu after a delay

Postby Pako » Fri Feb 24, 2012 11:56 am

I think the solution is very easy. Just read the description of the OSM plugin and act accordingly.
OSM_Description.png
Pako
User avatar
Pako
Plugin Developer
 
Posts: 1283
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic

Re: Close OS Menu after a delay

Postby themaster1 » Fri Feb 24, 2012 6:59 pm

Well if i put the OsMenu folder above the Context folder it don't change anything
themaster1
Experienced User
 
Posts: 105
Joined: Wed Feb 03, 2010 9:02 pm

Next

Return to General Support

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests