TaskMonitorPlus plugin - v0.0.5

Questions and comments specific to a particular plugin should go here.
User avatar
Neytrino-OnLine
Experienced User
Posts: 97
Joined: Tue Aug 20, 2013 7:14 pm
Location: Moscow, Russia

Re: TaskMonitorPlus plugin - v0.0.5

Post by Neytrino-OnLine » Wed Sep 13, 2017 5:11 am

kgschlosser wrote:well you can use the WindowInfo object that is returned as an object to send the keys also. You do not need to use Find Window for this specific task. If you give me a list of the key combinations and what thoes combinations do I can put something together for you pretty quickly.
It is looks like You dislike Find Window so mutch ;)

Ok... That hotkeys i using at the moment:
{Shift+P} - Replay
{Left} - Rewird
{K} or {Space} - Play/Pause
{Right} - Forward
{Shift+N} - Skip
{M} - Mute
{F} - Toggle FullScreen
Sin©erely yours, Neytrino.

User avatar
kgschlosser
Site Admin
Posts: 5002
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TaskMonitorPlus plugin - v0.0.5

Post by kgschlosser » Wed Sep 13, 2017 5:33 am

Its not that I dislike it. it's extremely powerful and very useful. Provided 2 things. A: you know how to use it, and B: The GUI of the program is not a custom drawn GUI
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5002
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TaskMonitorPlus plugin - v0.0.5

Post by kgschlosser » Wed Sep 13, 2017 5:35 am

Neytrino-OnLine wrote:It is looks like You dislike Find Window so mutch ;)

Ok... That hotkeys i using at the moment:
{Shift+P} - Replay
{Left} - Rewird
{K} or {Space} - Play/Pause
{Right} - Forward
{Shift+N} - Skip
{M} - Mute
{F} - Toggle FullScreen
OK one more thing I need the events for the remote button presses
If you like the work I have been doing then feel free to Image

User avatar
Neytrino-OnLine
Experienced User
Posts: 97
Joined: Tue Aug 20, 2013 7:14 pm
Location: Moscow, Russia

Re: TaskMonitorPlus plugin - v0.0.5

Post by Neytrino-OnLine » Wed Sep 13, 2017 5:55 am

kgschlosser, different in fact is not buttons... For example I press the Play button, EG get MCE.Play event, than: if pressing was short - one event will be generated if long - another...
Sin©erely yours, Neytrino.

User avatar
kgschlosser
Site Admin
Posts: 5002
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TaskMonitorPlus plugin - v0.0.5

Post by kgschlosser » Wed Sep 13, 2017 6:05 am

I know there can be 2 different events for a single button. I want to know which events do you want to run the different key combinations. I have already done the whole thing up already and this is the last bit i need.
If you like the work I have been doing then feel free to Image

User avatar
Neytrino-OnLine
Experienced User
Posts: 97
Joined: Tue Aug 20, 2013 7:14 pm
Location: Moscow, Russia

Re: TaskMonitorPlus plugin - v0.0.5

Post by Neytrino-OnLine » Wed Sep 13, 2017 6:17 am

{Shift+P} - Replay - Main.Tasks|Replay
{Left} - Rewird - Main.Tasks|Rewind
{K} or {Space} - Play/Pause - Main.Tasks|Play & Main.Tasks|Pause (I use two events)
{Right} - Forward - Main.Tasks|Forward
{Shift+N} - Skip - Main.Tasks|Skip
{M} - Mute - Main.Tasks|Mute
{F} - Toggle FullScreen - Main.Windows|FullScreen
Sin©erely yours, Neytrino.

User avatar
kgschlosser
Site Admin
Posts: 5002
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TaskMonitorPlus plugin - v0.0.5

Post by kgschlosser » Wed Sep 13, 2017 6:24 am

OK You lost me with the Main.Tasks| thing. I have no clue what you mean by it.

So this is what I am going to do. below is the XML code for the macros. There is a Jump in it that you will have to redo. the Jump Settings are
If: last action unsuccessful
Jump to: YouTube Not Playing
Unchecked: and return after execution

In the Checking remote button action (Python Script) you will see the following in the file.

Code: Select all

key_mapping = dict(
    Replay='{Shift+P}',
    Rewind='{Left}',
    Play='{Space}',
    Pause='{Space}',
    Forward='{Right}',
    Skip='{Shift+N}',
    Mute='{M}',
    FullScreen='{F}'
)
This is the event to keystroke mapping. You need to change the mappings to match the suffix of the event that gets triggered for the specific button you want to use.
So if you want to use the Stop button to play the YouTube video then you would change Play='{Space}' to be Stop='{Space}'.

If you want a different/multiple events to be processed by the Remote checking you will have to add the event prefix to the macro. with a .* after it. I highly recommend you do NOT use Main.* as this will parse all events that occur with the prefix of Main. If you need to add multiple events to send the keys then you will have to add a new line to the key mapping for those suffixes with the same keystroke. as you see how i did with Play and Pause

Here is the XML

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="WIP">
    <Folder Name="YouTube" XML_Guid="{A1C97D94-D721-4EF7-845A-8FEED458AAB9}" Expanded="True">
        <Macro Name="YouTube Remote" XML_Guid="{49AD5019-705F-4989-8D47-BC8939F6C5E7}" Expanded="True">
            <Event Name="MCE.*" XML_Guid="{CE02F36F-B29A-49F7-9F1F-5954C789EF7B}" />
            <Action Name="Checking remote button" XML_Guid="{6AD38DD3-3A9E-4771-A24E-0494C6280782}">
                EventGhost.PythonScript(u"if not hasattr(eg.globals, 'youtube_window'):\n    eg.globals.youtube_window = None\n\nkey_mapping = dict(\n    Replay='{Shift+P}',\n    Rewind='{Left}',\n    Play='{Space}',\n    Pause='{Space}',\n    Forward='{Right}',\n    Skip='{Shift+N}',\n    Mute='{M}',\n    FullScreen='{F}'\n)\n    \nif eg.globals.youtube_window is None:\n    eg.StopMacro()\n\nbutton = eg.eventString.split('.')[-1]\nif button not in key_mapping:\n    eg.StopMacro()\n        \neg.result = key_mapping[button]\n\n")
            </Action>
            <Action Name="Sending remote button to YouTube" XML_Guid="{265698C4-379D-4C0B-89F4-337DC37C600E}">
                EventGhost.PythonCommand(u'eg.globals.youtube_window.SendKeystrokes(eg.result)')
            </Action>
        </Macro>
        <Macro Name="Checking if YouTube is playing" XML_Guid="{A07A7A07-D2C7-4EB9-AF03-B46A39D7474C}" Expanded="True">
            <Event Name="TaskMonitorPlus.Activated.firefox" XML_Guid="{5F8CE813-127D-4BEF-A3EA-59015EF265AD}" />
            <Event Name="TaskMonitorPlus.TitleChanged.firefox" XML_Guid="{5BCAF444-61B3-4B78-8BBE-6DE70876D7C3}" />
            <Event Name="TaskMonitorPlus.NewWindow.firefox" XML_Guid="{0CA73ACD-7DAD-40E8-93CD-C30957946250}" />
            <Action Name="Checking if YouTube is playing" XML_Guid="{F0CC6812-08D1-425B-A1B8-8AEAFBD495C9}">
                EventGhost.PythonScript(u"window = eg.event.payload\n\ntitle = window.title.split('-')\n\nif len(title) >= 2:\n    if title[1].strip().lower() != 'youtube':\n        eg.result = False\n    else:\n        eg.result = True\nelse:\n    eg.result = False")
            </Action>
            <Action XML_Guid="{959AF9D3-BC54-46B9-A1B4-B86A703A6EDE}">
                EventGhost.NewJumpIf(XmlIdLink(9), 1, False)
            </Action>
            <Action Name="YouTube is playing" XML_Guid="{82717FBE-C0F9-44D1-AC2B-76DD42AE8F11}">
                EventGhost.PythonCommand(u'eg.globals.youtube_window = eg.event.payload')
            </Action>
        </Macro>
        <Macro Name="YouTube Not Playing" id="9" XML_Guid="{A9DEB6E8-4F7E-4B9F-A005-CD3379C7368C}" Expanded="True">
            <Event Name="TaskMonitorPlus.ClosedWindow.firefox" XML_Guid="{3D7A4593-EB66-49AB-BCE4-0877B0BB7F22}" />
            <Action Name="YouTube is not playing" XML_Guid="{B6CD5788-431F-42CA-AE19-ABDDC6EED515}">
                EventGhost.PythonCommand(u'eg.globals.youtube_window = None')
            </Action>
        </Macro>
    </Folder>
</EventGhost>
If you like the work I have been doing then feel free to Image

User avatar
Neytrino-OnLine
Experienced User
Posts: 97
Joined: Tue Aug 20, 2013 7:14 pm
Location: Moscow, Russia

Re: TaskMonitorPlus plugin - v0.0.5

Post by Neytrino-OnLine » Wed Sep 13, 2017 6:32 am

I wouldn't use "Main". but I generate these events using TriggerEvent and it doesn't ask me - adding "Main".
Sin©erely yours, Neytrino.

User avatar
Neytrino-OnLine
Experienced User
Posts: 97
Joined: Tue Aug 20, 2013 7:14 pm
Location: Moscow, Russia

Re: TaskMonitorPlus plugin - v0.0.5

Post by Neytrino-OnLine » Wed Sep 13, 2017 7:28 am

kgschlosser, So again, we returned to a good old way - to stay in a background and every time when the YouTube tab will be opened - switch somethin... We have spent a lot of time to find out what I already know...
So, let me to ask you last time about this:
kgschlosser wrote:use that event to trigger the find window action. using mozilla the name of the tab that is in focus ends up in the window name and you can wildcard that name for the find window. and use the jump if to jump you to another macro if the find window is successful in locating the window to do whatever it is you need it to do.
Could you show me example how it works?
Sin©erely yours, Neytrino.

User avatar
kgschlosser
Site Admin
Posts: 5002
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TaskMonitorPlus plugin - v0.0.5

Post by kgschlosser » Wed Sep 13, 2017 9:34 am

Neytrino-OnLine wrote:Could you show me example how it works?
I have already explained this to you. but here it goes again.

if you had read the other post I stated about custom drawn GUI's and there being no support for selecting a specific control. and I used Firefox as one of these examples of a program that uses a custom drawn GUI. So with Firefox you do not have the ability to send keystrokes to anything other then the main GUI window. I did not make Firefox and this is because of the way Firefox was written.This problem is not a problem with EG it is a problem with Firefox.

Neytrino-OnLine wrote:kgschlosser, So again, we returned to a good old way - to stay in a background and every time when the YouTube tab will be opened - switch somethin...
I gave you the code to make this work. I do not understand what the problem is now. if you do not like the way it has to be done then I am unable to help you as this is the best/easiest possible solution at the moment.
If you like the work I have been doing then feel free to Image

Medy
Experienced User
Posts: 70
Joined: Sat Nov 15, 2014 8:33 pm
Location: Germany

Re: TaskMonitorPlus plugin - v0.0.5

Post by Medy » Fri Aug 17, 2018 1:25 pm

I only get errors with this plugin ?
Are there any prerequisites for this ? Im on latest eg version windows 8.1
I deleted the default task monitor ... I also get this errors if I run it on clean profile....

Code: Select all

Unhandled exception in WorkerThread <ActionThread>:
Callers stack:
  File "threading.pyc", line 504, in __bootstrap
File "threading.pyc", line 532, in __bootstrap_inner
  File "threading.pyc", line 484, in run
  File "C:\EventGhostNEW\eg\Classes\ThreadWorker.py", line 354, in __MainLoop
    self.__DoOneEvent()
  File "C:\EventGhostNEW\eg\Classes\ThreadWorker.py", line 342, in __DoOneEvent
    eg.PrintTraceback()
  File "C:\EventGhostNEW\eg\Classes\ThreadWorker.py", line 289, in HandleAction
  File "C:\EventGhostNEW\eg\Classes\EventThread.py", line 85, in Transfer
    event.SetShouldEnd()
Traceback (most recent call last) (1722):
  File "C:\EventGhostNEW\eg\Classes\ThreadWorker.py", line 326, in __DoOneEvent
    self.HandleAction(action)
  File "C:\EventGhostNEW\eg\Classes\ActionThread.py", line 87, in HandleAction
    action()
  File "C:\EventGhostNEW\eg\Classes\ThreadWorker.py", line 62, in __call__
    self.returnValue = self.func(*self.args, **self.kwargs)
  File "C:\EventGhostNEW\eg\Classes\EventGhostEvent.py", line 166, in Execute
    LogEvent(self)
  File "C:\EventGhostNEW\eg\Classes\Log.py", line 253, in LogEvent
    mesg = eventstring + ' ' + repr(payload)
  File "C:\ProgramData\EventGhost\plugins\TaskMonitorPlus\WindowInfo.py", line 77, in __repr__
    return "<title={}, window_class={},...>".format(repr(self.title), repr(self.window_class))
ValueError: zero length field name in format

User avatar
kgschlosser
Site Admin
Posts: 5002
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TaskMonitorPlus plugin - v0.0.5

Post by kgschlosser » Fri Aug 17, 2018 3:44 pm

Medy wrote:
Fri Aug 17, 2018 1:25 pm
Im on latest eg version windows 8.1
you have stated that you are running on the latest version of EG
Medy wrote:
Fri Aug 17, 2018 1:25 pm
Traceback (most recent call last) (1722):
by the lines above it is telling me that you are running on revision 1722 which is EG 0.4 and the latest version of EG is 0.5 RC4. this plugin needs to be run on EG 0.5 RC4. I am not sure if the author realized that not filling in the format fields with indexes is only something that works in python 2.7 and above which EG 0.4 is running on python 2.6.

there have been many bug fixes in eg 0.5 and I would strongly suggest running it. but if there is a need to be on 0.4 i can submit a fix for the code to the original author. I do not know if the author is still around and supporting the plugin. this would drag out the how long it would take to fix the issue. where as if you upgrade the problem would be soled very quickly.

let me know what you would like to do.
If you like the work I have been doing then feel free to Image

Medy
Experienced User
Posts: 70
Joined: Sat Nov 15, 2014 8:33 pm
Location: Germany

Re: TaskMonitorPlus plugin - v0.0.5

Post by Medy » Sat Aug 18, 2018 12:56 am

Ohh thanks. Im not running the latest "pre release" . I just grabbed the "latest "realease from website . I will check if that works right away.
I would like to use this plugin for checking active browser tabs in firefox / creating events.

I think author of plugin should mention the things you said.

Greetings.

User avatar
kgschlosser
Site Admin
Posts: 5002
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TaskMonitorPlus plugin - v0.0.5

Post by kgschlosser » Sat Aug 18, 2018 2:04 am

I do not think he/she knew. It's not a huge deal to fix. It is simply something that is going to need to get done.

And yes you can use this plugin to monitor caption bar changes which is what the plugin is going to generate events for. when you change tabs in a browser it changes the caption bar of the program to reflect the name on the tab.
If you like the work I have been doing then feel free to Image

pralima87
Posts: 11
Joined: Tue Sep 11, 2018 3:36 pm

Re: TaskMonitorPlus plugin - v0.0.5

Post by pralima87 » Tue Sep 11, 2018 3:39 pm

Any chance you could release a version of this plugin for 0.4?
The reason is that I'm also running a 0.4 plugin that is not updated to 0.5.

Is egSamsungTV.
A plugin for network control of more modern Samsung TVs.
IT can even turn the TV on :wink:

Post Reply