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.

No OSD showing with latest MPC-Home

If you have a question or need help, this is the place to be.
Post Reply
molitar
Experienced User
Posts: 209
Joined: Fri Sep 11, 2009 6:44 am

No OSD showing with latest MPC-Home

Post by molitar »

I am not able to get the OSD working with the newest MPC-Home. The code I am using below from previous code that Pako helped out with previously.

Code: Select all

import re

mpc = eg.WindowMatcher(u'mpc-hc.exe', None, u'MediaPlayerClassicW', None, None, None, True, 0.0, 0)
hWnd = mpc()

if len(hWnd) > 0:
    from eg.WinApi import GetWindowText
    title = GetWindowText(hWnd[0])
    if re.search(".mkv",title,re.I):
        eg.result = title.split(".mkv")[0]
    elif re.search(".mp4",title,re.I):
        eg.result = title.split(".mp4")[0]
    elif re.search(".avi",title,re.I):
        eg.result = title.split(".avi")[0]
    elif re.search(".ogm",title,re.I):
        eg.result = title.split(".ogm") [0]
    else:
        eg.result = title.split(".")[0]


Find_MPC_Time=eg.WindowMatcher(u'mpc-hc.exe', u'{*}Media Player Classic{*}', u'MediaPlayerClassicW', None, u'Static', 2, True, 0.0, 0)
hwnd = Find_MPC_Time()

x = 1

while x < 4:

    if len(hwnd) > 0:
        if eg.globals.WindowsState == "Fullscreen": howManyBars = 80
        if eg.globals.WindowsState != "Fullscreen": howManyBars = 80

        timeE,timeR = eg.WinApi.GetWindowText(hwnd[0]).split(' / ')
        secArray = timeE.split(':')
        secArrayTotal = timeR.split(':')
        secondsTotal = int(secArrayTotal[0])*(60)+int(secArrayTotal[1])
        secondsElapsed = int(secArray[0])*(60)+int(secArray[1])
        percent = (secondsElapsed*howManyBars)/secondsTotal
        osd = eg.result + "\n \n" + "[" + "|"*(percent) + " "*(howManyBars-percent) + "]" + "\n" + " "*30 + timeE + " / " + timeR
 
        if eg.globals.WindowsState <> "Fullscreen":
            eg.plugins.EventGhost.ShowOSD(osd, u'0;-40;0;0;0;700;0;0;0;0;3;2;1;49;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 0, 1.0, False)
        else:
            eg.plugins.EventGhost.ShowOSD(osd, u'0;-40;0;0;0;700;0;0;0;0;3;2;1;49;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 1, 1.0, False)
        mpc = eg.WindowMatcher(u'mpc-hc.exe', None, u'MediaPlayerClassicW', None, None, None, True, 0.0, 0)
    hWnd = mpc()
    eg.Wait(0.8)
    print x    
    x = x + 1
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: No OSD showing with latest MPC-Home

Post by Pako »

You are using the plugin Media Player Classic?
If so, why do you not use the action Get Times?
You can use it in the script too.
Try to put into your script this snippet:

Code: Select all

elaps, rem, total = eg.plugins.MediaPlayerClassic.GetTimes()
print "elaps, rem, total =",elaps, rem, total
For you, does not work the function Find_MPC_Time. You can to delete it.

Pako
molitar
Experienced User
Posts: 209
Joined: Fri Sep 11, 2009 6:44 am

Re: No OSD showing with latest MPC-Home

Post by molitar »

Pako, ok here is the code I am using now.. Was their perhaps a better method for doing the same thing? Problem comes in if I use any howManyBars value that is not 100. I am not able to figure out how to work the code when the number of bars for total percentage is not 100.

Code: Select all

import re

mpc = eg.WindowMatcher(u'mpc-hc.exe', None, u'MediaPlayerClassicW', None, None, None, True, 0.0, 0)
hWnd = mpc()

if len(hWnd) > 0:
    from eg.WinApi import GetWindowText
    title = GetWindowText(hWnd[0])
    if re.search(".mkv",title,re.I):
        eg.result = title.split(".mkv")[0]
    elif re.search(".mp4",title,re.I):
        eg.result = title.split(".mp4")[0]
    elif re.search(".avi",title,re.I):
        eg.result = title.split(".avi")[0]
    elif re.search(".ogm",title,re.I):
        eg.result = title.split(".ogm") [0]
    else:
        eg.result = title.split(".")[0]


elaps, rem, total = eg.plugins.MediaPlayerClassic.GetTimes()
print "elaps, rem, total =",elaps, rem, total
hwnd = eg.plugins.MediaPlayerClassic.GetTimes()

x = 1

while x < 4:

    if len(hwnd) > 0:
        if eg.globals.WindowsState == "Fullscreen": howManyBars = 100
        if eg.globals.WindowsState != "Fullscreen": howManyBars = 150

        secArray = elaps.split(':')
        secArrayTotal = total.split(':')
        
        secondsTotal = int(secArrayTotal[0])*(3600)+int(secArrayTotal[1])*(60)+int(secArrayTotal[2])
        secondsElapsed = int(secArray[0])*(3600)+int(secArray[1])*(60)+int(secArray[2])
        
        percent = (1.0*secondsElapsed)/(secondsTotal)*100
        percent = int(round(percent))
        print percent
        
        osd = eg.result + "\n \n" + "[ " + "|" * percent + " " * (howManyBars - percent) + " ]" + "\n" + " "*30 + elaps + " / " + total
 
        if eg.globals.WindowsState <> "Fullscreen":
            eg.plugins.EventGhost.ShowOSD(osd, u'0;-40;0;0;0;700;0;0;0;0;3;2;1;49;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 0, 1.0, False)
        else:
            eg.plugins.EventGhost.ShowOSD(osd, u'0;-40;0;0;0;700;0;0;0;0;3;2;1;49;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 1, 1.0, False)
        mpc = eg.WindowMatcher(u'mpc-hc.exe', None, u'MediaPlayerClassicW', None, None, None, True, 0.0, 0)
    hWnd = mpc()
    eg.Wait(0.8)
    print x
    
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: No OSD showing with latest MPC-Home

Post by Pako »

Code: Select all

import re

mpc = eg.WindowMatcher(u'mpc-hc.exe', None, u'MediaPlayerClassicW', None, None, None, True, 0.0, 0)
hWnd = mpc()

if len(hWnd) > 0:
    from eg.WinApi import GetWindowText
    title = GetWindowText(hWnd[0])
    if re.search(".mkv",title,re.I):
        eg.result = title.split(".mkv")[0]
    elif re.search(".mp4",title,re.I):
        eg.result = title.split(".mp4")[0]
    elif re.search(".avi",title,re.I):
        eg.result = title.split(".avi")[0]
    elif re.search(".ogm",title,re.I):
        eg.result = title.split(".ogm") [0]
    else:
        eg.result = title.split(".")[0]


elaps, rem, total = eg.plugins.MediaPlayerClassic.GetTimes()


x = 1

while x < 4:

    if elaps != "00:00:00":
        if eg.globals.WindowsState == "Fullscreen": howManyBars = 100
        if eg.globals.WindowsState != "Fullscreen": howManyBars = 150

        secArray = elaps.split(':')
        secArrayTotal = total.split(':')
       
        secondsTotal = int(secArrayTotal[0])*(3600)+int(secArrayTotal[1])*(60)+int(secArrayTotal[2])
        secondsElapsed = int(secArray[0])*(3600)+int(secArray[1])*(60)+int(secArray[2])
       
        percent = (1.0*secondsElapsed)/(secondsTotal)*100
        percent = int(round(percent))
        bars = (percent * howManyBars)/100

        #print "percent =",percent
        #print "bars =",bars
       
        osd = eg.result + "\n \n" + "[ " + "|" * bars + " " * (howManyBars - bars) + " ]" + "\n" + " "*30 + elaps + " / " + total

        if eg.globals.WindowsState <> "Fullscreen":
            eg.plugins.EventGhost.ShowOSD(osd, u'0;-40;0;0;0;700;0;0;0;0;3;2;1;49;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 0, 1.0, False)
        else:
            eg.plugins.EventGhost.ShowOSD(osd, u'0;-40;0;0;0;700;0;0;0;0;3;2;1;49;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 1, 1.0, False)
        #mpc = eg.WindowMatcher(u'mpc-hc.exe', None, u'MediaPlayerClassicW', None, None, None, True, 0.0, 0)
    #hWnd = mpc()
    eg.Wait(0.8)
    #print x
    x += 1
1) It seems that you forgot to convert a percentage to the number bars. It is only mathematics, not programming.
2) Why do you use a variable eg.result?
This makes sense only if in your configuration tree under this Python Script action is placed some other action, that eg.result uses.
But I do not believe it. Instead eg.result use just result or for example movie or title.

Pako
molitar
Experienced User
Posts: 209
Joined: Fri Sep 11, 2009 6:44 am

Re: No OSD showing with latest MPC-Home

Post by molitar »

Pako, thanks for the general rule and the help with the bars. I changed it to title like suggested.
molitar
Experienced User
Posts: 209
Joined: Fri Sep 11, 2009 6:44 am

Re: No OSD showing with latest MPC-Home

Post by molitar »

Pako, Ok I had to fix the volume control also so I changed line three from:

#Find_MPC_Volume_Ctrl=eg.WindowMatcher(u'mpc-hc.exe', u'{*}Media Player Classic{*}', u'MediaPlayerClassicW', u'', u'msctls_trackbar32', 1, True, 0.0, 0)
Find_MPC_Volume_Ctrl=eg.WindowMatcher(u'mpc-hc.exe', None, u'MediaPlayerClassicW', None, u'msctls_trackbar32', 1, True, 0.0, 0)

Full code below is their a more efficient method of doing this like their was with progress bar?

Code: Select all

from eg.WinApi.Dynamic import SendMessage
TBM_GETPOS = 1024
Find_MPC_Volume_Ctrl=eg.WindowMatcher(u'mpc-hc.exe', u'{*}Media Player Classic{*}', u'MediaPlayerClassicW', u'', u'msctls_trackbar32', 1, True, 0.0, 0)
hwnd = Find_MPC_Volume_Ctrl()

M = 2

if len(hwnd) > 0:
    if eg.globals.WindowsState == "Fullscreen": volume = int(SendMessage(hwnd[0], TBM_GETPOS, 0, 0)/5)
    if eg.globals.WindowsState != "Fullscreen": volume = int(SendMessage(hwnd[0], TBM_GETPOS, 0, 0)/4)
    eg.result = volume * M * u'\u2588'
    volume2 = SendMessage(hwnd[0], TBM_GETPOS, 0, 0)
    if volume2 == 1 : volume2 = 0
    eg.result2 = volume2
else:
    print "Window not found"
    eg.result = ''
    
if eg.globals.WindowsState <> "Fullscreen":
    eg.plugins.EventGhost.ShowOSD(u'    Volume:  {eg.result} {eg.result2}% ', u'0;-36;0;0;0;400;0;0;0;238;3;2;1;49;Lucida Console', (255, 0, 0), (0, 0, 0), 0, (60, 150), 0, 2.0, False)
else:
    eg.plugins.EventGhost.ShowOSD(u'Volume: {eg.result} {eg.result2}%', u'0;-36;0;0;0;400;0;0;0;238;3;2;1;49;Lucida Console', (255, 0, 0), (0, 0, 0), 0, (60, 150), 1, 2.0, False)
    
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: No OSD showing with latest MPC-Home

Post by Pako »

It is always possible to make some improvements:

Code: Select all

from eg.WinApi.Dynamic import SendMessage
TBM_GETPOS = 1024
Find_MPC_Volume_Ctrl=eg.WindowMatcher(u'mpc-hc.exe', u'{*}Media Player Classic{*}', u'MediaPlayerClassicW', u'', u'msctls_trackbar32', 1, True, 0.0, 0)
hwnd = Find_MPC_Volume_Ctrl()

M = 2

if len(hwnd) > 0:
    if eg.globals.WindowsState == "Fullscreen":
        factor = 5
        mon = 1
    else:
        factor = 4
        mon = 0
    volume = SendMessage(hwnd[0], TBM_GETPOS, 0, 0)
    bar = volume * M/factor * u'\u2588'
    if volume == 1 : volume = 0
    eg.plugins.EventGhost.ShowOSD(u'    Volume:  %s %i%%' % (bar, volume), u'0;-36;0;0;0;400;0;0;0;238;3;2;1;49;Lucida Console', (255, 0, 0), (0, 0, 0), 0, (60, 150), mon, 2.0, False)
else:
    print "Window not found"
BTW - another unnecessary using eg.result plus eg.result2 is utter nonsense.

Pako
molitar
Experienced User
Posts: 209
Joined: Fri Sep 11, 2009 6:44 am

Re: No OSD showing with latest MPC-Home

Post by molitar »

Thanks Pako. Yeah when I modified that code quite a while ago I misunderstood eg. to mean global variable.. but later understood that was not the case.. Thanks for the clean code works great. But I did have to remove the part u'{*}Media Player Classic{*}', from the line with Find_MPC_Volume_Ctrl=eg.WindowMatcher(u'mpc-hc.exe', u'{*}Media Player Classic{*}', u'MediaPlayerClassicW', u'', u'msctls_trackbar32', 1, True, 0.0, 0) as it appears the newer version no longer has Media Player Classic in the title bar anymore. Other than that the code works perfectly and much cleaner.. thanks for the cleanup on that code.
molitar
Experienced User
Posts: 209
Joined: Fri Sep 11, 2009 6:44 am

Re: No OSD showing with latest MPC-Home

Post by molitar »

Pako, I changed the code from a bar to a percentage box. As you can see I have an issue with how to place the location of the box so I used a top variable but I am sure the code could be much simpler than what I have to make it more efficient.

Code: Select all

from eg.WinApi.Dynamic import SendMessage
TBM_GETPOS = 1024
Find_MPC_Volume_Ctrl=eg.WindowMatcher(u'mpc-hc.exe', None, u'MediaPlayerClassicW', None, u'msctls_trackbar32', 1, True, 0.0, 0)

hwnd = Find_MPC_Volume_Ctrl()

if len(hwnd) > 0:
    if eg.globals.WindowsState <> "Fullscreen":
        mon = 1
        top = 900
    else:
        mon = 0
        top = 600
    volume = SendMessage(hwnd[0], TBM_GETPOS, 0, 0)
    osd = "Volume: %i%%"
    if volume == 1 : volume = 0
    eg.plugins.EventGhost.ShowOSD(osd % volume, u'0;-64;0;0;0;700;0;0;0;238;3;2;1;66;Arial', (255, 255, 255), (0, 0, 0), 5, (0, top), mon, 3.0, True)
else:
    print "Window not found"
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: No OSD showing with latest MPC-Home

Post by Pako »

I can help you, but you must tell me what you have requirements.
What is the task for that script?

Pako
molitar
Experienced User
Posts: 209
Joined: Fri Sep 11, 2009 6:44 am

Re: No OSD showing with latest MPC-Home

Post by molitar »

I am using a macro to check what monitor the display is on first either secondary or primary monitor.

Code: Select all

from win32gui import GetWindowPlacement

#SW_SHOWNORMAL = 1
#SW_SHOWMINIMIZED = 2
#SW_SHOWMAXIMIZED = 3

FindWin = eg.WindowMatcher(None, None, u'MediaPlayerClassicW' , None, None, None, True, 0.0, 0)
hwnd = FindWin()

def GetWindowStatus(hwnd):
    showList  = (None, "Normal", "Minimized", "Maximized")
    placement = GetWindowPlacement(hwnd)
    #unrem the below line to display the placement values that you need for the if placement[4] line
    print placement
   
    if placement[4] == (1680, 1050, 2960, 1770):
        return "Fullscreen"
    else:
        return showList[placement[1]]

eg.globals.WindowsState = GetWindowStatus(hwnd[0])
print "Windows State = " + eg.globals.WindowsState
Once I know what monitor I am than using the above script to display volume level for Media Player Classic. But because of the way Windows 7 works it assigns my HDTV as Monitor one which is at 720p (1280 x 720) and the primary monitor is running at 1680 x 1050. When the MPC is at full screen resolution I have it switch to the HDTV monitor 1 so the above script was the best way for me to determine my fullscreen is enabled or not. Once I have my fullscreen variable I than show the volume for MPC Home.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1544">
    <Folder Name="Volume Controls" Expanded="True">
        <Macro Name="Volume Up">
            <Event Name="DXusbPCR.Num2" />
            <Event Name="PcRemoteController.Up" />
            <Action>
                EventGhost.NewJumpIf(XmlIdLink(252), 2, True)
            </Action>
            <Action Name="Python Script Bar Method" Enabled="False">
                EventGhost.PythonScript(u'from eg.WinApi.Dynamic import SendMessage\nTBM_GETPOS = 1024\nFind_MPC_Volume_Ctrl=eg.WindowMatcher(u\'mpc-hc.exe\', None, u\'MediaPlayerClassicW\', None, u\'msctls_trackbar32\', 1, True, 0.0, 0)\n\nhwnd = Find_MPC_Volume_Ctrl()\n\nM = 2\n\nif len(hwnd) > 0:\n    if eg.globals.WindowsState <> "Fullscreen":\n        factor = 5\n        mon = 1\n    else:\n        factor = 5\n        mon = 0\n    volume = SendMessage(hwnd[0], TBM_GETPOS, 0, 0)\n    bar = volume * M/factor * u\'\\u2588\'\n    if volume == 1 : volume = 0\n    eg.plugins.EventGhost.ShowOSD(u\'Volume: %s %i%%\' % (bar, volume), u\'0;-36;0;0;0;400;0;0;0;238;3;2;1;49;Lucida Console\', (255, 0, 0), (0, 0, 0), 0, (60, 150), mon, 2.0, False)\nelse:\n    print "Window not found"')
            </Action>
            <Action>
                MediaPlayerClassic.VolumeUp()
            </Action>
            <Action Name="Python Script">
                EventGhost.PythonScript(u'from eg.WinApi.Dynamic import SendMessage\nTBM_GETPOS = 1024\nFind_MPC_Volume_Ctrl=eg.WindowMatcher(u\'mpc-hc.exe\', None, u\'MediaPlayerClassicW\', None, u\'msctls_trackbar32\', 1, True, 0.0, 0)\n\nhwnd = Find_MPC_Volume_Ctrl()\n\nif len(hwnd) > 0:\n    if eg.globals.WindowsState <> "Fullscreen":\n        mon = 1\n        top = 900\n    else:\n        mon = 0\n        top = 600\n    volume = SendMessage(hwnd[0], TBM_GETPOS, 0, 0)\n    osd = "Volume: %i%%"\n    if volume == 1 : volume = 0\n    eg.plugins.EventGhost.ShowOSD(osd % volume, u\'0;-64;0;0;0;700;0;0;0;238;3;2;1;66;Arial\', (255, 255, 255), (0, 0, 0), 5, (0, top), mon, 3.0, True)\nelse:\n    print "Window not found"')
            </Action>
            <Action>
                EventGhost.AutoRepeat(0.5, 0.20000000000000001, 0.029999999999999999, 0.0)
            </Action>
        </Macro>
        <Macro Name="Volume Down">
            <Event Name="DXusbPCR.Num8" />
            <Event Name="PcRemoteController.Down" />
            <Action>
                EventGhost.NewJumpIf(XmlIdLink(252), 2, True)
            </Action>
            <Action Name="Python Script Bar Method" Enabled="False">
                EventGhost.PythonScript(u'from eg.WinApi.Dynamic import SendMessage\nTBM_GETPOS = 1024\nFind_MPC_Volume_Ctrl=eg.WindowMatcher(u\'mpc-hc.exe\', None, u\'MediaPlayerClassicW\', None, u\'msctls_trackbar32\', 1, True, 0.0, 0)\n\nhwnd = Find_MPC_Volume_Ctrl()\n\nM = 2\n\nif len(hwnd) > 0:\n    if eg.globals.WindowsState <> "Fullscreen":\n        factor = 5\n        mon = 1\n    else:\n        factor = 5\n        mon = 0\n    volume = SendMessage(hwnd[0], TBM_GETPOS, 0, 0)\n    bar = volume * M/factor * u\'\\u2588\'\n    if volume == 1 : volume = 0\n    eg.plugins.EventGhost.ShowOSD(u\'Volume: %s %i%%\' % (bar, volume), u\'0;-36;0;0;0;400;0;0;0;238;3;2;1;49;Lucida Console\', (255, 0, 0), (0, 0, 0), 0, (60, 150), mon, 2.0, False)\nelse:\n    print "Window not found"')
            </Action>
            <Action>
                MediaPlayerClassic.VolumeDown()
            </Action>
            <Action Name="Python Script">
                EventGhost.PythonScript(u'from eg.WinApi.Dynamic import SendMessage\nTBM_GETPOS = 1024\nFind_MPC_Volume_Ctrl=eg.WindowMatcher(u\'mpc-hc.exe\', None, u\'MediaPlayerClassicW\', None, u\'msctls_trackbar32\', 1, True, 0.0, 0)\n\nhwnd = Find_MPC_Volume_Ctrl()\n\nif len(hwnd) > 0:\n    if eg.globals.WindowsState <> "Fullscreen":\n        mon = 1\n        top = 900\n    else:\n        mon = 0\n        top = 600\n    volume = SendMessage(hwnd[0], TBM_GETPOS, 0, 0)\n    osd = "Volume: %i%%"\n    if volume == 1 : volume = 0\n    eg.plugins.EventGhost.ShowOSD(osd % volume, u\'0;-64;0;0;0;700;0;0;0;238;3;2;1;66;Arial\', (255, 255, 255), (0, 0, 0), 5, (0, top), mon, 3.0, True)\nelse:\n    print "Window not found"')
            </Action>
            <Action>
                EventGhost.AutoRepeat(0.5, 0.20000000000000001, 0.029999999999999999, 0.0)
            </Action>
        </Macro>
        <Macro Name="Volume Mute">
            <Action>
                MediaPlayerClassic.VolumeMute()
            </Action>
        </Macro>
    </Folder>
</EventGhost>
But the major requirement would be to have the display set from top not bottom of the screen. Right now I have to manually guesstimate to get it as close to say around 100 pixels from the top of the screen. That is the reason I am using top in the one place value because I did not know how to do the value from the top of the screen and not the bottom. Too bad MPC does not have a way to get full screen status easily but the code you helped me with is still going strong just have to print new values if used on a different video card or screen resolution.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: No OSD showing with latest MPC-Home

Post by Pako »

Oh, so now I probably understand where the problem is.
If you have two or more monitors, then you must use for determining the coordinates of the so-called "virtual screen".
Maybe these links can help you:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
http://www.howtogeek.com/howto/14875/ma ... correctly/
http://www.flounder.com/virtual_screen_coordinates.htm

Pako
molitar
Experienced User
Posts: 209
Joined: Fri Sep 11, 2009 6:44 am

Re: No OSD showing with latest MPC-Home

Post by molitar »

This part of the code measures from x and y respectively. So it shows in center just fine but the top is a guesstimate I would like to be able to set the box from the top at exactly 100 pixels from the top so subs at top or bottom do not get blocked when being displayed. The first number (0, top) if I change it it from default it moves it from center and spaces it at the value specified from the left it seems. The second one if I set it to 100 it displays the box 100 from the bottom of the display. Is their other coordinate settings that can be used to set the box from the top and not bottom? The 0 current centers it which is what I want but the value I am using for top is actually the placement from the bottom and not top.

Code: Select all

eg.plugins.EventGhost.ShowOSD(osd % volume, u'0;-64;0;0;0;700;0;0;0;238;3;2;1;66;Arial', (255, 255, 255), (0, 0, 0), 5, [color=#FF0000](0, top)[/color], mon, 3.0, True)
Variable top is how far up from bottom of screen when what I really want is how far down from top of screen?
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: No OSD showing with latest MPC-Home

Post by Pako »

You can open (using notepad.exe for example) the file ...\EventGhost\plugins\EventGhost\ShowOSD.py.
There you can also find these snippets:

Code: Select all

alignmentChoices = [
    "Top Left",
    "Top Right",
    "Bottom Left",
    "Bottom Right",
    "Screen Center",
    "Bottom Center",
    "Top Center",
    "Left Center",
    "Right Center",
]
# ############################################
    def ShowOSD(
        self,
        osdText="",
        fontInfo=None,
        textColour=(255, 255, 255),
        outlineColour=(0, 0, 0),
        alignment=0,
        offset=(0, 0),
        displayNumber=0,
        timeout=3.0,
        event=None,
        skin=None,
    ):
But beware, the alignmentChoices you have to count from 0!
So if you want to use the option Top Center, then you must enter the number 6 at position of the argument alignment.
But there you have number 5, so you have selected the option Bottom Center.

That's it, or I misunderstood it?
Pako
molitar
Experienced User
Posts: 209
Joined: Fri Sep 11, 2009 6:44 am

Re: No OSD showing with latest MPC-Home

Post by molitar »

No that is perfect.. so the number before the alignment is the position to use and position starts at value 0 so I just need to renumber the 5 to a 6 than it will measure from the top. Thanks now I know how the alignment works.
Post Reply