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.

FindWindow wie ist der richtige Aufruf?

Allgemeines zum Thema EventGhost
Milbrot
Plugin Developer
Posts: 79
Joined: Wed Mar 29, 2006 11:07 am

Post by Milbrot »

Ja und wie funktioniert das? Geht das mit einem Debugger was braucht man dazu? Ich habe mal ActivePython installiert da gibts ja z.B. diese Funktion.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

Nein, einen Debugger brauchst du nicht. Ich habe zum Schreiben von EG auch nie einen gebraucht. Es reicht die Fehlermeldungen (Tracebacks) von Python anzusehen, um rauszufinden wo es klemmt.
Milbrot
Plugin Developer
Posts: 79
Joined: Wed Mar 29, 2006 11:07 am

Post by Milbrot »

Hm ich glaub ich verschiebe den Einbau der Execute Funktion auf unbestimmte Zeit, geht ja auch ohne.
Daf├╝r brauche ich vermutlich mehr Zeit zum einarbeiten.

Das ├╝berarbeitete Plugin schaut nun so aus:

Code: Select all























CommonList = (
('0', 'Number 0', None, 2399142008),
('1', 'Number 1', None, 2399142009),
('2', 'Number 2', None, 2399142010),
('3', 'Number 3', None, 2399142011),
('4', 'Number 4', None, 2399142012),
('5', 'Number 5', None, 2399142013),
('6', 'Number 6', None, 2399142014),
('7', 'Number 7', None, 2399142015),
('8', 'Number 8', None, 2399142016),
('9', 'Number 9', None, 2399142017),
('PAUSE', 'Pause', None, 2399141991),
('FF', 'Forward', None, 2399141990),
('RW', 'Rewind', None, 2399141989),
('VOLUP', 'Volume Up', None, 2399141993),
('VOLDN', 'Volume Down', None, 2399141992),
('MUTE', 'Mute', None, 2399141994),
('SLEEP', 'Sleep Timer', None, 2399142001),
('FS', 'Fullscreen', None, 2399141995),
('INFO', 'OSD Info', None, 2399141996),
('TOLIVE', 'DVD/File to Live', None, 2399141997),
('TOPLAY', 'Live to DVD/File', None, 2399141998),
('OSD', 'OSD Menu', None, 2399142000),
('OPTWS', 'Optimize for Widescreen', None, 2399142022),
('CANCEL', 'Cancel', None, 2399142087),
('EXIT', 'Exit Program', None, 2399141999),
('FAV1', 'Favorit 1', None, 2399142021),
('FAV2', 'Favorit 2', None, 2399141993),
('FAV3', 'Favorit 3', None, 2399141992),
('OPENFILE', 'Open File', None, 2399142023),
('SLTIMERSET', 'Sleep Timer Setup', None, 2399142024),
('BESTFIT', 'Best Fit', None, 2399142025),
('STAYONTOP', 'Stay on Top', None, 2399142026),
('MAKEVISIBLE', 'Show on Primary Monitor', None, 2399142027),
('SETTINGS', 'Settings', None, 2399142028),
('BKGMODE', 'Background Mode', None, 2399142029),
)

LiveList = (
('SIDECLIST', 'Side Channel List', None, 2399142089),
('OSDCHLIST', 'OSD Favorit Channel List', None, 2399142090),
('LAST', 'Last', None, 2399142091),
('RECORD', 'Record', None, 2399142092),
('RECPOS', 'Goto Record Position', None, 2399142098),
('INCSPEED', 'Increase Speed', None, 2399142101),
('DECSPEED', 'Decrease Speed', None, 2399142102),
('EPGWIN', 'EPG Window', None, 2399142093),
('EPGOSD', 'EPG OSD', None, 2399142099),
('NEXTFAV', 'Next Favorit Channel', None, 2399142095),
('PREVFAV', 'Previous Favorit Channel', None, 2399142094),
('NEXTENUM', 'Next Enumerate Channel', None, 2399141997),
('PREVENUM', 'Previous Enumerate Channel', None, 2399141996),
('STREAMINF', 'Show Stream Info', None, 2399142100),
('VIDEO', 'Video', None, 2399142103),
('IVRGEN', 'IVR/Generic', None, 2399142104),
('APID', 'Auto Pid', None, 2399142105),
('AB', 'Audio AB/A+B', None, 2399142106),
('SUBS', 'Subtitles', None, 2399142107),
('RECTIMERWND', 'Record Timer Window', None, 2399142108),
('OPENSCHED', 'Open Scheduler', None, 2399142109),
('PIDGRABBER', 'Pid Grabber', None, 2399142111),
('PIDLIST', 'Pid List', None, 2399142112),
('PIDSTAT', 'Pid Statistic', None, 2399142113),
('LNBSETTINGS', 'LNB Settings', None, 2399142114),
('POSCONSOLE', 'Positioner Console', None, 2399142115),
('CICONSOLE', 'CI Console', None, 2399142116),
)

FileList = (
('SIDEFILST', 'Side File List', None, 2399142189),
('OSDFLIST', 'OSD File List', None, 2399142190),
('NEXTFILE', 'Next File', None, 2399142192),
('PREVFILE', 'Previous File', None, 2399142191),
)

DVDList = (
('DVDSUBS', 'DVD Subtitles', None, 2399142291),
('NEXTCHAP', 'Next Chapter', None, 2399142293),
('PREVCHAP', 'Previous Chapter', None, 2399142292),
('OSDCHPLIST', 'OSD Chapter List', None, 2399142294),
('CHAPLIST', 'Chapter List', None, 2399142290),
('DVDMENU', 'DVD Menu', None, 2399142289),
('DVDMUP', 'DVD Move Up', None, 2399142295),
('DVDMDN', 'DVD Move Down', None, 2399142296),
('DVDMLEFT', 'DVD Move Left', None, 2399142297),
('DVDMRIGHT', 'DVD Move Right', None, 2399142298),
('DVDMSELECT', 'DVD Select', None, 2399142299),
)

OSDList = (
('OSDUP', 'OSD Up', None, 2399142389),
('OSDDN', 'OSD Down', None, 2399142390),
('OSDLEFT', 'OSD Left', None, 2399142391),
('OSDRIGHT', 'OSD Right', None, 2399142392),
('CATUP', 'OSD Page/Category Up', None, 2399142393),
('CATDN', 'OSD Page/Category Down', None, 2399142394),
('SELECT', 'Select', None, 2399142395),
('EVINFO', 'Event Info', None, 2399142397),
)

SideList = (
('SCFUP', 'Side Channel File Up', None, 2399142489),
('SCFDN', 'Side Channel File Down', None, 2399142490),
('SCFSELECT', 'Side Channel File Select', None, 2399142491),
('SCFDELETE', 'Side Channel File Delete', None, 2399142492),
('SCFSAT', 'Side Channel File Satellit', None, 2399142493),
('SCFPROV', 'Side Channel File Provider', None, 2399142494),
('SCFPROVID', 'Side Channel File NetID', None, 2399142495),
('SCFTRANSP', 'Side Channel File Transponder', None, 2399142496),
('SCFFAV', 'Side Channel File Favorit', None, 2399142497),
('SCFALL', 'Side Channel File All', None, 2399142498),
)

EPGList = (
('EPGWUP', 'EPG Window Up', None, 2399142589),
('EPGWDN', 'EPG Window Down', None, 2399142590),
('EPGWPGUP', 'EPG Window Page Up', None, 2399142591),
('EPGWPGDN', 'EPG Window Page Down', None, 2399142592),
('EPGWCHUP', 'EPG Window Channel Up', None, 2399142593),
('EPGWCHDN', 'EPG Window Channel Down', None, 2399142594),
('EPGWSEL', 'EPG Window Select', None, 2399142595),
('EPGWSHED', 'EPG Window Shedule', None, 2399142596),
('EPGWANN', 'EPG Window All/Now/Next', None, 2399142597),
)

PresetsList = ( 
('PRESET1', 'Preset 1', None, 2399142689), 
('PRESET2', 'Preset 2', None, 2399142690), 
('PRESET3', 'Preset 3', None, 2399142691), 
('PRESET4', 'Preset 4', None, 2399142692), 
('PRESET5', 'Preset 5', None, 2399142693), 
('PRESET6', 'Preset 6', None, 2399142694), 
)

PluginsList = (
('PLGUP', 'Plugin Up', None, 2399142789),
('PLGDN', 'Plugin Down', None, 2399142790),
('PLGLEFT', 'Plugin Left', None, 2399142791),
('PLGRIGHT', 'Plugin Right', None, 2399142792),
('PLGPGUP', 'Plugin Page Up', None, 2399142793),
('PLGPGDN', 'Plugin Page Down', None, 2399142794),
('PLGSEL', 'Plugin Select', None, 2399142795),
('PLGALTSEL', 'Plugin Alternate Select', None, 2399142796),
('PLGCANCEL', 'Plugin Cancel', None, 2399142797),
('PLGTAB', 'Plugin Tab', None, 2399142798),
)

import eg
from win32gui import FindWindow
from eg.WinAPI.win32types import PostMessage


class MyTheatre(eg.PluginClass): 

    def __init__(self): 
        
        def makeActions(group_name, fn_list): 
            subGroup = self.AddGroup(group_name) 
            for tmp_classname, tmp_name, tmp_description, tmp_value in fn_list: 
                
                if tmp_description is None: 
                    tmp_description = tmp_name 
                    
                class tmp_action(eg.ActionClass): 
                    name = tmp_name 
                    description = tmp_description 
                    value = tmp_value 
                    
                    def __call__(self): 
                        try: 
                            hMedia = FindWindow("TDVBMainForm", "MyTheatre") 
                            PostMessage(hMedia, 3025, self.value, 0) 
                        except: 
                            eg.PrintError("MyTheatre not running") 
                            
                tmp_action.__name__ = tmp_classname 
                subGroup.AddAction(tmp_action) 

        makeActions('Common Functions', CommonList) 
        makeActions('Live Mode Functions', LiveList) 
        makeActions('File Mode', FileList) 
        makeActions('DVD Mode', DVDList) 
        makeActions('OSD', OSDList) 
        makeActions('Side Channel/File List Functions', SideList) 
        makeActions('EPG Window Mode', EPGList) 
        makeActions('Presets', PresetsList) 
        makeActions('Plugins', PluginsList)   
Ist getestet und funktioniert.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

Ähm, die ersten Parameter sehen noch nicht ganz gut aus. Die sollen ja den Klassennamen angeben und daher Python/EG-typischen Konventionen folgen.

'1' geht z.B. gar nicht, weil ein Klassenname nicht mit einer Zahl anfangen darf in Python. Vollständige Großschreibung ist für Konstanten vorbehalten. Also besser würden sie so aussehen:
Num0
Num1
...
VolumeUp
OsdChannelList (bei Abkürzungen wie OSD nur den ersten Buchstaben groß schreiben)
OsdUp
...
Ruhig ausschreiben bzw. etwas länger machen die Bezeichner, damit sie lesbar bleiben.
Statt 'STREAMINF' sieht 'ShowStreamInfo' für die Skripter später einfach verständlicher aus.
Milbrot
Plugin Developer
Posts: 79
Joined: Wed Mar 29, 2006 11:07 am

Post by Milbrot »

Grund daf├╝r war bei ├änderungen im App kann man sp├ñter leicher den zugeh├Ârigen Wert finden.
Leider waren mir die Python typischen Beschränkungen nicht bekannt: Wo steht das eigentlich alles?
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

Also genau steht es hier:
http://docs.python.org/ref/identifiers.html

Der abstrakte Syntax hilft dir aber wenig. Ein guter Einstieg ist noch immer das Python-Tutorial, besonders wenn man schon irgendeine Programmiersprache andeutungsweise kann:
http://docs.python.org/tut/tut.html

Beides ist auch in der Hilfe von ActivePython drin.
Milbrot
Plugin Developer
Posts: 79
Joined: Wed Mar 29, 2006 11:07 am

Post by Milbrot »

So hier die ├╝berarbeitete Version:

Code: Select all






















CommonList = (
('Number0', 'Number 0', None, 2399142008), #SHORTCUT_0 
('Number1', 'Number 1', None, 2399142009), #SHORTCUT_1
('Number2', 'Number 2', None, 2399142010), #SHORTCUT_2
('Number3', 'Number 3', None, 2399142011), #SHORTCUT_3
('Number4', 'Number 4', None, 2399142012), #SHORTCUT_4
('Number5', 'Number 5', None, 2399142013), #SHORTCUT_5
('Number6', 'Number 6', None, 2399142014), #SHORTCUT_6
('Number7', 'Number 7', None, 2399142015), #SHORTCUT_7
('Number8', 'Number 8', None, 2399142016), #SHORTCUT_8
('Number9', 'Number 9', None, 2399142017), #SHORTCUT_9
('Pause', 'Pause', None, 2399141991), #SHORTCUT_PAUSE
('Forward', 'Forward', None, 2399141990), #SHORTCUT_FF
('Rewind', 'Rewind', None, 2399141989), #SHORTCUT_RW
('VolumeUp', 'Volume Up', None, 2399141993), #SHORTCUT_VOLUP
('VolumeDown', 'Volume Down', None, 2399141992), #SHORTCUT_VOLDN
('Mute', 'Mute', None, 2399141994), #SHORTCUT_MUTE
('SleepTimer', 'Sleep Timer', None, 2399142001), #SHORTCUT_SLEEP
('Fullscreen', 'Fullscreen', None, 2399141995), #SHORTCUT_FS
('OSDInfo', 'OSD Info', None, 2399141996), #SHORTCUT_INFO
('DvdFileToLive', 'DVD/File to Live', None, 2399141997), #SHORTCUT_TOLIVE
('LiveToDvdFile', 'Live to DVD/File', None, 2399141998), #SHORTCUT_TOPLAY
('OsdMenu', 'OSD Menu', None, 2399142000), #SHORTCUT_OSD
('OptimizeForWidescreen', 'Optimize for Widescreen', None, 2399142022), #SHORTCUT_OPTWS
('Cancel', 'Cancel', None, 2399142087), #SHORTCUT_CANCEL
('ExitProgram', 'Exit Program', None, 2399141999), #SHORTCUT_EXIT
('Favorit1', 'Favorit 1', None, 2399142021), #SHORTCUT_FAV1
('Favorit2', 'Favorit 2', None, 2399141993), #SHORTCUT_FAV2
('Favorit3', 'Favorit 3', None, 2399141992), #SHORTCUT_FAV3
('OpenFile', 'Open File', None, 2399142023), #SHORTCUT_OPENFILE
('SleepTimerSetup', 'Sleep Timer Setup', None, 2399142024), #SHORTCUT_SLTIMERSET
('BestFit', 'Best Fit', None, 2399142025), #SHORTCUT_BESTFIT
('StayOnTop', 'Stay on Top', None, 2399142026), #SHORTCUT_STAYONTOP
('ShowOnPrimaryMonitor', 'Show on Primary Monitor', None, 2399142027), #SHORTCUT_MAKEVISIBLE
('Settings', 'Settings', None, 2399142028), #SHORTCUT_SETTINGS
('BackgroundMode', 'Background Mode', None, 2399142029), #SHORTCUT_BKGMODE
)

LiveList = (
('SideChannelList', 'Side Channel List', None, 2399142089), #SHORTCUT_SIDECLIST
('OsdFavoritChannelList', 'OSD Favorit Channel List', None, 2399142090), #SHORTCUT_OSDCHLIST
('Last', 'Last', None, 2399142091), #SHORTCUT_LAST
('Record', 'Record', None, 2399142092), #SHORTCUT_RECORD
('GotoRecordPosition', 'Goto Record Position', None, 2399142098), #SHORTCUT_RECPOS
('IncreaseSpeed', 'Increase Speed', None, 2399142101), #SHORTCUT_INCSPEED
('DecreaseSpeed', 'Decrease Speed', None, 2399142102), #SHORTCUT_DECSPEED
('EpgWindow', 'EPG Window', None, 2399142093), #SHORTCUT_EPGWIN
('EpgOsd', 'EPG OSD', None, 2399142099), #SHORTCUT_EPGOSD
('NextFavoritChannel', 'Next Favorit Channel', None, 2399142095), #SHORTCUT_NEXTFAV
('PreviousFavoritChannel', 'Previous Favorit Channel', None, 2399142094), #SHORTCUT_PREVFAV
('NextEnumerateChannel', 'Next Enumerate Channel', None, 2399141997), #SHORTCUT_NEXTENUM
('PreviousEnumerateChannel', 'Previous Enumerate Channel', None, 2399141996), #SHORTCUT_PREVENUM
('ShowStreamInfo', 'Show Stream Info', None, 2399142100), #SHORTCUT_STREAMINF
('Video', 'Video', None, 2399142103), #SHORTCUT_VIDEO
('IvrGeneric', 'IVR/Generic', None, 2399142104), #SHORTCUT_IVRGEN
('AutoPid', 'Auto Pid', None, 2399142105), #SHORTCUT_APID
('AudioAb', 'Audio AB/A+B', None, 2399142106), #SHORTCUT_AB
('Subtitles', 'Subtitles', None, 2399142107), #SHORTCUT_SUBS
('RecordTimerWindow', 'Record Timer Window', None, 2399142108), #SHORTCUT_RECTIMERWND
('OpenScheduler', 'Open Scheduler', None, 2399142109), #SHORTCUT_OPENSCHED
('PidGrabber', 'Pid Grabber', None, 2399142111), #SHORTCUT_PIDGRABBER
('PidList', 'Pid List', None, 2399142112), #SHORTCUT_PIDLIST
('PidStatistic', 'Pid Statistic', None, 2399142113), #SHORTCUT_PIDSTAT
('LnbSettings', 'LNB Settings', None, 2399142114), #SHORTCUT_LNBSETTINGS
('PositionerConsole', 'Positioner Console', None, 2399142115), #SHORTCUT_POSCONSOLE
('CiConsole', 'CI Console', None, 2399142116), #SHORTCUT_CICONSOLE
)

FileList = (
('SideFileList', 'Side File List', None, 2399142189), #SHORTCUT_SIDEFILST
('OsdFileList', 'OSD File List', None, 2399142190), #SHORTCUT_OSDFLIST
('NextFile', 'Next File', None, 2399142192), #SHORTCUT_NEXTFILE
('PreviousFile', 'Previous File', None, 2399142191), #SHORTCUT_PREVFILE
)

DVDList = (
('DvdSubtitles', 'DVD Subtitles', None, 2399142291), #SHORTCUT_DVDSUBS
('NextChapter', 'Next Chapter', None, 2399142293), #SHORTCUT_NEXTCHAP
('PreviousChapter', 'Previous Chapter', None, 2399142292), #SHORTCUT_PREVCHAP
('OsdChapterList', 'OSD Chapter List', None, 2399142294), #SHORTCUT_OSDCHPLIST
('ChapterList', 'Chapter List', None, 2399142290), #SHORTCUT_CHAPLIST
('DvdMenu', 'DVD Menu', None, 2399142289), #SHORTCUT_DVDMENU
('DvdMoveUp', 'DVD Move Up', None, 2399142295), #SHORTCUT_DVDMUP
('DvdMoveDown', 'DVD Move Down', None, 2399142296), #SHORTCUT_DVDMDN
('DvdMoveLeft', 'DVD Move Left', None, 2399142297), #SHORTCUT_DVDMLEFT
('DvdMoveRight', 'DVD Move Right', None, 2399142298), #SHORTCUT_DVDMRIGHT
('DvdSelect', 'DVD Select', None, 2399142299), #SHORTCUT_DVDMSELECT
)

OSDList = (
('OsdUp', 'OSD Up', None, 2399142389), #SHORTCUT_OSDUP
('OsdDown', 'OSD Down', None, 2399142390), #SHORTCUT_OSDDN
('OsdLeft', 'OSD Left', None, 2399142391), #SHORTCUT_OSDLEFT
('OsdRight', 'OSD Right', None, 2399142392), #SHORTCUT_OSDRIGHT
('OsdPageCategoryUp', 'OSD Page/Category Up', None, 2399142393), #SHORTCUT_CATUP
('OsdPageCategoryDown', 'OSD Page/Category Down', None, 2399142394), #SHORTCUT_CATDN
('Select', 'Select', None, 2399142395), #SHORTCUT_SELECT
('EventInfo', 'Event Info', None, 2399142397), #SHORTCUT_EVINFO
)

SideList = (
('SideChannelFileUp', 'Side Channel File Up', None, 2399142489), #SHORTCUT_SCFUP
('SideChannelFileDown', 'Side Channel File Down', None, 2399142490), #SHORTCUT_SCFDN
('SideChannelFileSelect', 'Side Channel File Select', None, 2399142491), #SHORTCUT_SCFSELECT
('SideChannelFileDelete', 'Side Channel File Delete', None, 2399142492), #SHORTCUT_SCFDELETE
('SideChannelFileSatellit', 'Side Channel File Satellit', None, 2399142493), #SHORTCUT_SCFSAT
('SideChannelFileProvider', 'Side Channel File Provider', None, 2399142494), #SHORTCUT_SCFPROV
('SideChannelFileNetid', 'Side Channel File NetID', None, 2399142495), #SHORTCUT_SCFPROVID
('SideChannelFileTransponder', 'Side Channel File Transponder', None, 2399142496), #SHORTCUT_
('SideChannelFileFavorit', 'Side Channel File Favorit', None, 2399142497), #SHORTCUT_SCFTRANSP
('SideChannelFileAll', 'Side Channel File All', None, 2399142498), #SHORTCUT_SCFALL
)

EPGList = (
('EpgWindowUp', 'EPG Window Up', None, 2399142589), #SHORTCUT_EPGWUP
('EpgWindowDown', 'EPG Window Down', None, 2399142590), #SHORTCUT_EPGWDN
('EpgWindowPageUp', 'EPG Window Page Up', None, 2399142591), #SHORTCUT_EPGWPGUP
('EpgWindowPageDown', 'EPG Window Page Down', None, 2399142592), #SHORTCUT_EPGWPGDN
('EpgWindowChannelUp', 'EPG Window Channel Up', None, 2399142593), #SHORTCUT_EPGWCHUP
('EpgWindowChannelDown', 'EPG Window Channel Down', None, 2399142594), #SHORTCUT_EPGWCHDN
('EpgWindowSelect', 'EPG Window Select', None, 2399142595), #SHORTCUT_EPGWSEL
('EpgWindowShedule', 'EPG Window Shedule', None, 2399142596), #SHORTCUT_EPGWSHED
('EpgWindowAllNowNext', 'EPG Window All/Now/Next', None, 2399142597), #SHORTCUT_EPGWANN
)

PresetsList = ( 
('Preset1', 'Preset 1', None, 2399142689), #SHORTCUT_PRESET1
('Preset2', 'Preset 2', None, 2399142690), #SHORTCUT_PRESET2
('Preset3', 'Preset 3', None, 2399142691), #SHORTCUT_PRESET3
('Preset4', 'Preset 4', None, 2399142692), #SHORTCUT_PRESET4
('Preset5', 'Preset 5', None, 2399142693), #SHORTCUT_PRESET5
('Preset6', 'Preset 6', None, 2399142694), #SHORTCUT_PRESET6
)

PluginsList = (
('PluginUp', 'Plugin Up', None, 2399142789), #SHORTCUT_PLGUP
('PluginDown', 'Plugin Down', None, 2399142790), #SHORTCUT_PLGDN
('PluginLeft', 'Plugin Left', None, 2399142791), #SHORTCUT_PLGLEFT
('PluginRight', 'Plugin Right', None, 2399142792), #SHORTCUT_PLGRIGHT
('PluginPageUp', 'Plugin Page Up', None, 2399142793), #SHORTCUT_PLGPGUP
('PluginPageDown', 'Plugin Page Down', None, 2399142794), #SHORTCUT_PLGPGDN
('PluginSelect', 'Plugin Select', None, 2399142795), #SHORTCUT_PLGSEL
('PluginAlternateSelect', 'Plugin Alternate Select', None, 2399142796), #SHORTCUT_PLGALTSEL
('PluginCancel', 'Plugin Cancel', None, 2399142797), #SHORTCUT_PLGCANCEL
('PluginTab', 'Plugin Tab', None, 2399142798), #SHORTCUT_PLGTAB
)

ExecuteList = (
('StartLiveMode', 'Start with Live Mode', None, '/toggle'),
('StartDvdMode', 'Start with in DVD Mode', None, '/dvd'),
('StartFileMode', 'Start with in File Mode', None, '/remote F10'),
)

import eg
from win32gui import FindWindow
from eg.WinAPI.win32types import PostMessage


class MyTheatre(eg.PluginClass): 

    def __init__(self): 
        
        def makeActions(group_name, fn_list): 
            subGroup = self.AddGroup(group_name) 
            for tmp_classname, tmp_name, tmp_description, tmp_value in fn_list: 
                
                if tmp_description is None: 
                    tmp_description = tmp_name 
                    
                class tmp_action(eg.ActionClass): 
                    name = tmp_name 
                    description = tmp_description 
                    value = tmp_value 
                    
                    def __call__(self): 
                        try: 
                            hMedia = FindWindow("TDVBMainForm", "MyTheatre") 
                            PostMessage(hMedia, 3025, self.value, 0) 
                        except: 
                            eg.PrintError("MyTheatre not running") 
                            
                tmp_action.__name__ = tmp_classname 
                subGroup.AddAction(tmp_action) 

        makeActions('Common Functions', CommonList) 
        makeActions('Live Mode Functions', LiveList) 
        makeActions('File Mode', FileList) 
        makeActions('DVD Mode', DVDList) 
        makeActions('OSD', OSDList) 
        makeActions('Side Channel/File List Functions', SideList) 
        makeActions('EPG Window Mode', EPGList) 
        makeActions('Presets', PresetsList) 
        makeActions('Plugins', PluginsList)
Natürlich hat mir die Execute Funktion auch keine Ruhe gelassen. Ich hab mal ein Code Snippet gemacht das Standalone läuft:

Code: Select all

import _winreg
from win32api import ShellExecute

path = None

try:
        myTh = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MyTheatre")
        path, dummy = _winreg.QueryValueEx(myTh, "InstallLocation")
        ShellExecute(0, None, "MTStart.exe", "/dvd", path, 0)
except:
        print "MyTheatre not found"
Nur brauch ich Hilfe wie man das nun richtig ins Plugin einbaut. Eine ExecuteList habe ich ja schon ins Plugin aufgenommen. Aber wie kommt nun der Rest da rein?
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

Yo, das zeig ich dir noch. Aber heute habe ich eine kleine Party und morgen sicher einen Schädel. :)
Aber dann k├╝mmere ich mich drum. Ist eigentlich recht einfach zu machen.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

Ich habe das jetzt mal folgenderma├ƒen gel├Âst:

Code: Select all

#



















import eg
from win32gui import FindWindow, SendMessageTimeout 
from win32con import SMTO_ABORTIFHUNG, SMTO_NORMAL
import _winreg
from win32api import ShellExecute
import sys

WORD = (sys.maxint + 1) * 2

class MsgAction(eg.ActionClass):
    def __call__(self):
        try:
            hWnd = FindWindow("TDVBMainForm", "MyTheatre")
            _, result = SendMessageTimeout(
                hWnd, 
                3025, 
                int(self.value - (self.value > sys.maxint) * WORD),
                0, 
                SMTO_ABORTIFHUNG|SMTO_NORMAL, 
                1000
            )
            return result
        except:
            eg.PrintError("MyTheatre is not running!") 
            return None



class ExeAction(eg.ActionClass):
    def __call__(self):
        try:
            ShellExecute(0, None, "MTStart.exe", self.value, self.plugin.myTheatrePath, 0) 
            return True
        except:
            eg.PrintError("MyTheatre not found!") 
            return None


MyActionList = (
('Common Functions', None, 
  (
    (MsgAction, 'Number0', 'Number 0', None, 2399142008), #SHORTCUT_0
    (MsgAction, 'Number1', 'Number 1', None, 2399142009), #SHORTCUT_1
    (MsgAction, 'Number2', 'Number 2', None, 2399142010), #SHORTCUT_2
    (MsgAction, 'Number3', 'Number 3', None, 2399142011), #SHORTCUT_3
    (MsgAction, 'Number4', 'Number 4', None, 2399142012), #SHORTCUT_4
    (MsgAction, 'Number5', 'Number 5', None, 2399142013), #SHORTCUT_5
    (MsgAction, 'Number6', 'Number 6', None, 2399142014), #SHORTCUT_6
    (MsgAction, 'Number7', 'Number 7', None, 2399142015), #SHORTCUT_7
    (MsgAction, 'Number8', 'Number 8', None, 2399142016), #SHORTCUT_8
    (MsgAction, 'Number9', 'Number 9', None, 2399142017), #SHORTCUT_9
    (MsgAction, 'Pause', 'Pause', None, 2399141991), #SHORTCUT_PAUSE
    (MsgAction, 'Forward', 'Forward', None, 2399141990), #SHORTCUT_FF
    (MsgAction, 'Rewind', 'Rewind', None, 2399141989), #SHORTCUT_RW
    (MsgAction, 'VolumeUp', 'Volume Up', None, 2399141993), #SHORTCUT_VOLUP
    (MsgAction, 'VolumeDown', 'Volume Down', None, 2399141992), #SHORTCUT_VOLDN
    (MsgAction, 'Mute', 'Mute', None, 2399141994), #SHORTCUT_MUTE
    (MsgAction, 'SleepTimer', 'Sleep Timer', None, 2399142001), #SHORTCUT_SLEEP
    (MsgAction, 'Fullscreen', 'Fullscreen', None, 2399141995), #SHORTCUT_FS
    (MsgAction, 'OSDInfo', 'OSD Info', None, 2399141996), #SHORTCUT_INFO
    (MsgAction, 'DvdFileToLive', 'DVD/File to Live', None, 2399141997), #SHORTCUT_TOLIVE
    (MsgAction, 'LiveToDvdFile', 'Live to DVD/File', None, 2399141998), #SHORTCUT_TOPLAY
    (MsgAction, 'OsdMenu', 'OSD Menu', None, 2399142000), #SHORTCUT_OSD
    (MsgAction, 'OptimizeForWidescreen', 'Optimize for Widescreen', None, 2399142022), #SHORTCUT_OPTWS
    (MsgAction, 'Cancel', 'Cancel', None, 2399142087), #SHORTCUT_CANCEL
    (MsgAction, 'ExitProgram', 'Exit Program', None, 2399141999), #SHORTCUT_EXIT
    (MsgAction, 'Favorit1', 'Favorit 1', None, 2399142021), #SHORTCUT_FAV1
    (MsgAction, 'Favorit2', 'Favorit 2', None, 2399141993), #SHORTCUT_FAV2
    (MsgAction, 'Favorit3', 'Favorit 3', None, 2399141992), #SHORTCUT_FAV3
    (MsgAction, 'OpenFile', 'Open File', None, 2399142023), #SHORTCUT_OPENFILE
    (MsgAction, 'SleepTimerSetup', 'Sleep Timer Setup', None, 2399142024), #SHORTCUT_SLTIMERSET
    (MsgAction, 'BestFit', 'Best Fit', None, 2399142025), #SHORTCUT_BESTFIT
    (MsgAction, 'StayOnTop', 'Stay on Top', None, 2399142026), #SHORTCUT_STAYONTOP
    (MsgAction, 'ShowOnPrimaryMonitor', 'Show on Primary Monitor', None, 2399142027), #SHORTCUT_MAKEVISIBLE
    (MsgAction, 'Settings', 'Settings', None, 2399142028), #SHORTCUT_SETTINGS
    (MsgAction, 'BackgroundMode', 'Background Mode', None, 2399142029), #SHORTCUT_BKGMODE 
  )
),
('Live Mode Functions', None, 
  (
    (MsgAction, 'SideChannelList', 'Side Channel List', None, 2399142089), #SHORTCUT_SIDECLIST
    (MsgAction, 'OsdFavoritChannelList', 'OSD Favorit Channel List', None, 2399142090), #SHORTCUT_OSDCHLIST
    (MsgAction, 'Last', 'Last', None, 2399142091), #SHORTCUT_LAST
    (MsgAction, 'Record', 'Record', None, 2399142092), #SHORTCUT_RECORD
    (MsgAction, 'GotoRecordPosition', 'Goto Record Position', None, 2399142098), #SHORTCUT_RECPOS
    (MsgAction, 'IncreaseSpeed', 'Increase Speed', None, 2399142101), #SHORTCUT_INCSPEED
    (MsgAction, 'DecreaseSpeed', 'Decrease Speed', None, 2399142102), #SHORTCUT_DECSPEED
    (MsgAction, 'EpgWindow', 'EPG Window', None, 2399142093), #SHORTCUT_EPGWIN
    (MsgAction, 'EpgOsd', 'EPG OSD', None, 2399142099), #SHORTCUT_EPGOSD
    (MsgAction, 'NextFavoritChannel', 'Next Favorit Channel', None, 2399142095), #SHORTCUT_NEXTFAV
    (MsgAction, 'PreviousFavoritChannel', 'Previous Favorit Channel', None, 2399142094), #SHORTCUT_PREVFAV
    (MsgAction, 'NextEnumerateChannel', 'Next Enumerate Channel', None, 2399141997), #SHORTCUT_NEXTENUM
    (MsgAction, 'PreviousEnumerateChannel', 'Previous Enumerate Channel', None, 2399141996), #SHORTCUT_PREVENUM
    (MsgAction, 'ShowStreamInfo', 'Show Stream Info', None, 2399142100), #SHORTCUT_STREAMINF
    (MsgAction, 'Video', 'Video', None, 2399142103), #SHORTCUT_VIDEO
    (MsgAction, 'IvrGeneric', 'IVR/Generic', None, 2399142104), #SHORTCUT_IVRGEN
    (MsgAction, 'AutoPid', 'Auto Pid', None, 2399142105), #SHORTCUT_APID
    (MsgAction, 'AudioAb', 'Audio AB/A+B', None, 2399142106), #SHORTCUT_AB
    (MsgAction, 'Subtitles', 'Subtitles', None, 2399142107), #SHORTCUT_SUBS
    (MsgAction, 'RecordTimerWindow', 'Record Timer Window', None, 2399142108), #SHORTCUT_RECTIMERWND
    (MsgAction, 'OpenScheduler', 'Open Scheduler', None, 2399142109), #SHORTCUT_OPENSCHED
    (MsgAction, 'PidGrabber', 'Pid Grabber', None, 2399142111), #SHORTCUT_PIDGRABBER
    (MsgAction, 'PidList', 'Pid List', None, 2399142112), #SHORTCUT_PIDLIST
    (MsgAction, 'PidStatistic', 'Pid Statistic', None, 2399142113), #SHORTCUT_PIDSTAT
    (MsgAction, 'LnbSettings', 'LNB Settings', None, 2399142114), #SHORTCUT_LNBSETTINGS
    (MsgAction, 'PositionerConsole', 'Positioner Console', None, 2399142115), #SHORTCUT_POSCONSOLE
    (MsgAction, 'CiConsole', 'CI Console', None, 2399142116), #SHORTCUT_CICONSOLE 
  )
),
('File Mode', None, 
  (
    (MsgAction, 'SideFileList', 'Side File List', None, 2399142189), #SHORTCUT_SIDEFILST
    (MsgAction, 'OsdFileList', 'OSD File List', None, 2399142190), #SHORTCUT_OSDFLIST
    (MsgAction, 'NextFile', 'Next File', None, 2399142192), #SHORTCUT_NEXTFILE
    (MsgAction, 'PreviousFile', 'Previous File', None, 2399142191), #SHORTCUT_PREVFILE
  )
),
('DVD Mode', None, 
  (
    (MsgAction, 'DvdSubtitles', 'DVD Subtitles', None, 2399142291), #SHORTCUT_DVDSUBS
    (MsgAction, 'NextChapter', 'Next Chapter', None, 2399142293), #SHORTCUT_NEXTCHAP
    (MsgAction, 'PreviousChapter', 'Previous Chapter', None, 2399142292), #SHORTCUT_PREVCHAP
    (MsgAction, 'OsdChapterList', 'OSD Chapter List', None, 2399142294), #SHORTCUT_OSDCHPLIST
    (MsgAction, 'ChapterList', 'Chapter List', None, 2399142290), #SHORTCUT_CHAPLIST
    (MsgAction, 'DvdMenu', 'DVD Menu', None, 2399142289), #SHORTCUT_DVDMENU
    (MsgAction, 'DvdMoveUp', 'DVD Move Up', None, 2399142295), #SHORTCUT_DVDMUP
    (MsgAction, 'DvdMoveDown', 'DVD Move Down', None, 2399142296), #SHORTCUT_DVDMDN
    (MsgAction, 'DvdMoveLeft', 'DVD Move Left', None, 2399142297), #SHORTCUT_DVDMLEFT
    (MsgAction, 'DvdMoveRight', 'DVD Move Right', None, 2399142298), #SHORTCUT_DVDMRIGHT
    (MsgAction, 'DvdSelect', 'DVD Select', None, 2399142299), #SHORTCUT_DVDMSELECT
  )
),
('OSD', None, 
  (
    (MsgAction, 'OsdUp', 'OSD Up', None, 2399142389), #SHORTCUT_OSDUP
    (MsgAction, 'OsdDown', 'OSD Down', None, 2399142390), #SHORTCUT_OSDDN
    (MsgAction, 'OsdLeft', 'OSD Left', None, 2399142391), #SHORTCUT_OSDLEFT
    (MsgAction, 'OsdRight', 'OSD Right', None, 2399142392), #SHORTCUT_OSDRIGHT
    (MsgAction, 'OsdPageCategoryUp', 'OSD Page/Category Up', None, 2399142393), #SHORTCUT_CATUP
    (MsgAction, 'OsdPageCategoryDown', 'OSD Page/Category Down', None, 2399142394), #SHORTCUT_CATDN
    (MsgAction, 'Select', 'Select', None, 2399142395), #SHORTCUT_SELECT
    (MsgAction, 'EventInfo', 'Event Info', None, 2399142397), #SHORTCUT_EVINFO
  )
),
('Side Channel/File List Functions', None, 
  (
    (MsgAction, 'SideChannelFileUp', 'Side Channel File Up', None, 2399142489), #SHORTCUT_SCFUP
    (MsgAction, 'SideChannelFileDown', 'Side Channel File Down', None, 2399142490), #SHORTCUT_SCFDN
    (MsgAction, 'SideChannelFileSelect', 'Side Channel File Select', None, 2399142491), #SHORTCUT_SCFSELECT
    (MsgAction, 'SideChannelFileDelete', 'Side Channel File Delete', None, 2399142492), #SHORTCUT_SCFDELETE
    (MsgAction, 'SideChannelFileSatellit', 'Side Channel File Satellit', None, 2399142493), #SHORTCUT_SCFSAT
    (MsgAction, 'SideChannelFileProvider', 'Side Channel File Provider', None, 2399142494), #SHORTCUT_SCFPROV
    (MsgAction, 'SideChannelFileNetid', 'Side Channel File NetID', None, 2399142495), #SHORTCUT_SCFPROVID
    (MsgAction, 'SideChannelFileTransponder', 'Side Channel File Transponder', None, 2399142496), #SHORTCUT_
    (MsgAction, 'SideChannelFileFavorit', 'Side Channel File Favorit', None, 2399142497), #SHORTCUT_SCFTRANSP
    (MsgAction, 'SideChannelFileAll', 'Side Channel File All', None, 2399142498), #SHORTCUT_SCFALL 
  )
),
('EPG Window Mode', None, 
  (
    (MsgAction, 'EpgWindowUp', 'EPG Window Up', None, 2399142589), #SHORTCUT_EPGWUP
    (MsgAction, 'EpgWindowDown', 'EPG Window Down', None, 2399142590), #SHORTCUT_EPGWDN
    (MsgAction, 'EpgWindowPageUp', 'EPG Window Page Up', None, 2399142591), #SHORTCUT_EPGWPGUP
    (MsgAction, 'EpgWindowPageDown', 'EPG Window Page Down', None, 2399142592), #SHORTCUT_EPGWPGDN
    (MsgAction, 'EpgWindowChannelUp', 'EPG Window Channel Up', None, 2399142593), #SHORTCUT_EPGWCHUP
    (MsgAction, 'EpgWindowChannelDown', 'EPG Window Channel Down', None, 2399142594), #SHORTCUT_EPGWCHDN
    (MsgAction, 'EpgWindowSelect', 'EPG Window Select', None, 2399142595), #SHORTCUT_EPGWSEL
    (MsgAction, 'EpgWindowShedule', 'EPG Window Shedule', None, 2399142596), #SHORTCUT_EPGWSHED
    (MsgAction, 'EpgWindowAllNowNext', 'EPG Window All/Now/Next', None, 2399142597), #SHORTCUT_EPGWANN 
  )
),
('Presets', None, 
  (
    (MsgAction, 'Preset1', 'Preset 1', None, 2399142689), #SHORTCUT_PRESET1
    (MsgAction, 'Preset2', 'Preset 2', None, 2399142690), #SHORTCUT_PRESET2
    (MsgAction, 'Preset3', 'Preset 3', None, 2399142691), #SHORTCUT_PRESET3
    (MsgAction, 'Preset4', 'Preset 4', None, 2399142692), #SHORTCUT_PRESET4
    (MsgAction, 'Preset5', 'Preset 5', None, 2399142693), #SHORTCUT_PRESET5
    (MsgAction, 'Preset6', 'Preset 6', None, 2399142694), #SHORTCUT_PRESET6
  )
),
('Plugin controls', None, 
  (
    (MsgAction, 'PluginUp', 'Plugin Up', None, 2399142789), #SHORTCUT_PLGUP
    (MsgAction, 'PluginDown', 'Plugin Down', None, 2399142790), #SHORTCUT_PLGDN
    (MsgAction, 'PluginLeft', 'Plugin Left', None, 2399142791), #SHORTCUT_PLGLEFT
    (MsgAction, 'PluginRight', 'Plugin Right', None, 2399142792), #SHORTCUT_PLGRIGHT
    (MsgAction, 'PluginPageUp', 'Plugin Page Up', None, 2399142793), #SHORTCUT_PLGPGUP
    (MsgAction, 'PluginPageDown', 'Plugin Page Down', None, 2399142794), #SHORTCUT_PLGPGDN
    (MsgAction, 'PluginSelect', 'Plugin Select', None, 2399142795), #SHORTCUT_PLGSEL
    (MsgAction, 'PluginAlternateSelect', 'Plugin Alternate Select', None, 2399142796), #SHORTCUT_PLGALTSEL
    (MsgAction, 'PluginCancel', 'Plugin Cancel', None, 2399142797), #SHORTCUT_PLGCANCEL
    (MsgAction, 'PluginTab', 'Plugin Tab', None, 2399142798), #SHORTCUT_PLGTAB
  )
),
('Start MyTheatre', None, 
  (
    (ExeAction, 'StartLiveMode', 'Start in Live Mode', None, '/toggle'),
    (ExeAction, 'StartDvdMode', 'Start in DVD Mode', None, '/dvd'),
    (ExeAction, 'StartFileMode', 'Start in File Mode', None, '/remote F10'),
  )
),
)



def ScanListRecursive(theList, group):
    for part in theList:
        if len(part) == 3:
            # this is a new sub-group
            groupName, groupDescription, groupList = part
            newGroup = group.AddGroup(groupName, groupDescription)
            ScanListRecursive(groupList, newGroup)
        else:
            # this is a new action
            classType, className, actionName, actionDescription, actionValue = part
            class tmpAction(classType):
                name = actionName
                description = actionDescription
                value = actionValue
            tmpAction.__name__ = className
            group.AddAction(tmpAction)



class MyTheatre(eg.PluginClass):

    def __init__(self):
        ScanListRecursive(MyActionList, self)

        try:
            key = _winreg.OpenKey(
                _winreg.HKEY_LOCAL_MACHINE, 
                "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MyTheatre"
            )
            self.myTheatrePath, dummy = _winreg.QueryValueEx(key, "InstallLocation")
        except WindowsError:
            self.PrintError("MyTheatre installation path not found!")
            self.myTheatrePath = ""
Ich habe den Code auch noch von PostMessage auf SendMessageTimeout umgestellt, weil dieses in der Regel der bessere Weg ist. Musst du mal ausprobieren, ob es wirklich soweit funktioniert.
Last edited by Bitmonster on Mon Aug 14, 2006 1:14 pm, edited 1 time in total.
Milbrot
Plugin Developer
Posts: 79
Joined: Wed Mar 29, 2006 11:07 am

Post by Milbrot »

Bei SendMessageTimeout bekomme ich folgende Error Meldung:

Fehler in Befehl: "MyTheatre: Volume Up"
Traceback (most recent call last):
File "D:\Programme\EventGhost\eg\TreeItems\ActionItem.py", line 300, in Execute
File "plugins/MyTheatre/__init__.py", line 38, in __call__
TypeError: Must be aString, int, or buffer object

Die Execute Funktion läuft soweit ich das gesehen habe. Wenn ich es auf
PostMessage ändere läuft auch die andere Funktion.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

Ach, immer der gleiche Fehler. Ich habe den Source oben mal aktualisiert. Das Problem ist immer wieder, dass die wParam-Werte nicht mehr in den Bereich eines Python-Integers passen und daher zu einem Python-Long-Integer konvertiert werden. Die win32api-Funktionen wollen aber ein Python-Integer haben. Deshalb muss man eine etwas ungew├Âhnliche Konvertierung vornehmen.
Milbrot
Plugin Developer
Posts: 79
Joined: Wed Mar 29, 2006 11:07 am

Post by Milbrot »

Soweit scheint nun alles zu laufen es gab nur ein kleinen Problem mit
einer Zeit├╝berschreitung bei der Funktion DVD/File to Live. Das war
durch das ändern der timeoutzeit auf 2000 zu beheben.

Fehler in Befehl: "MyTheatre: DVD/File to Live"
Traceback (most recent call last):
File "C:\Programme\EventGhost\eg\TreeItems\ActionItem.py", line 300, in Execute
File "plugins/MyTheatre/__init__.py", line 40, in __call__
error: (1460, 'SendMessageTimeout', 'Dieser Vorgang wurde wegen Zeit\xfcberschreitung zur\xfcckgegeben.')

Die Frage ist aber ob es notwendig ist die SendMessageTimeout Funktion
zu verwenden. Der Author von MyTheatre verwendet in der Beschreibung zur Steuerung nähmlich extra die PostMessage Funktion.

Da ich noch 3 falsche Zahlen im Code entdeckt habe schaut er nun so aus:

Code: Select all





















import eg 
from win32gui import FindWindow, SendMessageTimeout 
from win32con import SMTO_ABORTIFHUNG, SMTO_NORMAL 
import _winreg 
from win32api import ShellExecute 
import sys 

WORD = (sys.maxint + 1) * 2 

class MsgAction(eg.ActionClass): 
    def __call__(self): 
        try: 
            hWnd = FindWindow("TDVBMainForm", "MyTheatre") 
            _, result = SendMessageTimeout( 
                hWnd, 
                3025, 
                int(self.value - (self.value > sys.maxint) * WORD), 
                0, 
                SMTO_ABORTIFHUNG|SMTO_NORMAL, 
                2000 
            ) 
            return result 
        except: 
            eg.PrintError("MyTheatre is not running!") 
            return None 



class ExeAction(eg.ActionClass): 
    def __call__(self): 
        try: 
            ShellExecute(0, None, "MTStart.exe", self.value, self.plugin.myTheatrePath, 0) 
            return True 
        except: 
            eg.PrintError("MyTheatre not found!") 
            return None 


MyActionList = ( 
('Common Functions', None, 
  ( 
    (MsgAction, 'Number0', 'Number 0', None, 2399142008), #SHORTCUT_0 
    (MsgAction, 'Number1', 'Number 1', None, 2399142009), #SHORTCUT_1 
    (MsgAction, 'Number2', 'Number 2', None, 2399142010), #SHORTCUT_2 
    (MsgAction, 'Number3', 'Number 3', None, 2399142011), #SHORTCUT_3 
    (MsgAction, 'Number4', 'Number 4', None, 2399142012), #SHORTCUT_4 
    (MsgAction, 'Number5', 'Number 5', None, 2399142013), #SHORTCUT_5 
    (MsgAction, 'Number6', 'Number 6', None, 2399142014), #SHORTCUT_6 
    (MsgAction, 'Number7', 'Number 7', None, 2399142015), #SHORTCUT_7 
    (MsgAction, 'Number8', 'Number 8', None, 2399142016), #SHORTCUT_8 
    (MsgAction, 'Number9', 'Number 9', None, 2399142017), #SHORTCUT_9 
    (MsgAction, 'Pause', 'Pause', None, 2399141991), #SHORTCUT_PAUSE 
    (MsgAction, 'Forward', 'Forward', None, 2399141990), #SHORTCUT_FF 
    (MsgAction, 'Rewind', 'Rewind', None, 2399141989), #SHORTCUT_RW 
    (MsgAction, 'VolumeUp', 'Volume Up', None, 2399141993), #SHORTCUT_VOLUP 
    (MsgAction, 'VolumeDown', 'Volume Down', None, 2399141992), #SHORTCUT_VOLDN 
    (MsgAction, 'Mute', 'Mute', None, 2399141994), #SHORTCUT_MUTE 
    (MsgAction, 'SleepTimer', 'Sleep Timer', None, 2399142001), #SHORTCUT_SLEEP 
    (MsgAction, 'Fullscreen', 'Fullscreen', None, 2399141995), #SHORTCUT_FS 
    (MsgAction, 'OSDInfo', 'OSD Info', None, 2399141996), #SHORTCUT_INFO 
    (MsgAction, 'DvdFileToLive', 'DVD/File to Live', None, 2399141997), #SHORTCUT_TOLIVE 
    (MsgAction, 'LiveToDvdFile', 'Live to DVD/File', None, 2399141998), #SHORTCUT_TOPLAY 
    (MsgAction, 'OsdMenu', 'OSD Menu', None, 2399142000), #SHORTCUT_OSD 
    (MsgAction, 'OptimizeForWidescreen', 'Optimize for Widescreen', None, 2399142022), #SHORTCUT_OPTWS 
    (MsgAction, 'Cancel', 'Cancel', None, 2399142087), #SHORTCUT_CANCEL 
    (MsgAction, 'ExitProgram', 'Exit Program', None, 2399141999), #SHORTCUT_EXIT 
    (MsgAction, 'Favorit1', 'Favorit 1', None, 2399142019), #SHORTCUT_FAV1 
    (MsgAction, 'Favorit2', 'Favorit 2', None, 2399142020), #SHORTCUT_FAV2 
    (MsgAction, 'Favorit3', 'Favorit 3', None, 2399142021), #SHORTCUT_FAV3 
    (MsgAction, 'OpenFile', 'Open File', None, 2399142023), #SHORTCUT_OPENFILE 
    (MsgAction, 'SleepTimerSetup', 'Sleep Timer Setup', None, 2399142024), #SHORTCUT_SLTIMERSET 
    (MsgAction, 'BestFit', 'Best Fit', None, 2399142025), #SHORTCUT_BESTFIT 
    (MsgAction, 'StayOnTop', 'Stay on Top', None, 2399142026), #SHORTCUT_STAYONTOP 
    (MsgAction, 'ShowOnPrimaryMonitor', 'Show on Primary Monitor', None, 2399142027), #SHORTCUT_MAKEVISIBLE 
    (MsgAction, 'Settings', 'Settings', None, 2399142028), #SHORTCUT_SETTINGS 
    (MsgAction, 'BackgroundMode', 'Background Mode', None, 2399142029), #SHORTCUT_BKGMODE 
  ) 
), 
('Live Mode Functions', None, 
  ( 
    (MsgAction, 'SideChannelList', 'Side Channel List', None, 2399142089), #SHORTCUT_SIDECLIST 
    (MsgAction, 'OsdFavoritChannelList', 'OSD Favorit Channel List', None, 2399142090), #SHORTCUT_OSDCHLIST 
    (MsgAction, 'Last', 'Last', None, 2399142091), #SHORTCUT_LAST 
    (MsgAction, 'Record', 'Record', None, 2399142092), #SHORTCUT_RECORD 
    (MsgAction, 'GotoRecordPosition', 'Goto Record Position', None, 2399142098), #SHORTCUT_RECPOS 
    (MsgAction, 'IncreaseSpeed', 'Increase Speed', None, 2399142101), #SHORTCUT_INCSPEED 
    (MsgAction, 'DecreaseSpeed', 'Decrease Speed', None, 2399142102), #SHORTCUT_DECSPEED 
    (MsgAction, 'EpgWindow', 'EPG Window', None, 2399142093), #SHORTCUT_EPGWIN 
    (MsgAction, 'EpgOsd', 'EPG OSD', None, 2399142099), #SHORTCUT_EPGOSD 
    (MsgAction, 'NextFavoritChannel', 'Next Favorit Channel', None, 2399142095), #SHORTCUT_NEXTFAV 
    (MsgAction, 'PreviousFavoritChannel', 'Previous Favorit Channel', None, 2399142094), #SHORTCUT_PREVFAV 
    (MsgAction, 'NextEnumerateChannel', 'Next Enumerate Channel', None, 2399141997), #SHORTCUT_NEXTENUM 
    (MsgAction, 'PreviousEnumerateChannel', 'Previous Enumerate Channel', None, 2399141996), #SHORTCUT_PREVENUM 
    (MsgAction, 'ShowStreamInfo', 'Show Stream Info', None, 2399142100), #SHORTCUT_STREAMINF 
    (MsgAction, 'Video', 'Video', None, 2399142103), #SHORTCUT_VIDEO 
    (MsgAction, 'IvrGeneric', 'IVR/Generic', None, 2399142104), #SHORTCUT_IVRGEN 
    (MsgAction, 'AutoPid', 'Auto Pid', None, 2399142105), #SHORTCUT_APID 
    (MsgAction, 'AudioAb', 'Audio AB/A+B', None, 2399142106), #SHORTCUT_AB 
    (MsgAction, 'Subtitles', 'Subtitles', None, 2399142107), #SHORTCUT_SUBS 
    (MsgAction, 'RecordTimerWindow', 'Record Timer Window', None, 2399142108), #SHORTCUT_RECTIMERWND 
    (MsgAction, 'OpenScheduler', 'Open Scheduler', None, 2399142109), #SHORTCUT_OPENSCHED 
    (MsgAction, 'PidGrabber', 'Pid Grabber', None, 2399142111), #SHORTCUT_PIDGRABBER 
    (MsgAction, 'PidList', 'Pid List', None, 2399142112), #SHORTCUT_PIDLIST 
    (MsgAction, 'PidStatistic', 'Pid Statistic', None, 2399142113), #SHORTCUT_PIDSTAT 
    (MsgAction, 'LnbSettings', 'LNB Settings', None, 2399142114), #SHORTCUT_LNBSETTINGS 
    (MsgAction, 'PositionerConsole', 'Positioner Console', None, 2399142115), #SHORTCUT_POSCONSOLE 
    (MsgAction, 'CiConsole', 'CI Console', None, 2399142116), #SHORTCUT_CICONSOLE 
  ) 
), 
('File Mode', None, 
  ( 
    (MsgAction, 'SideFileList', 'Side File List', None, 2399142189), #SHORTCUT_SIDEFILST 
    (MsgAction, 'OsdFileList', 'OSD File List', None, 2399142190), #SHORTCUT_OSDFLIST 
    (MsgAction, 'NextFile', 'Next File', None, 2399142192), #SHORTCUT_NEXTFILE 
    (MsgAction, 'PreviousFile', 'Previous File', None, 2399142191), #SHORTCUT_PREVFILE 
  ) 
), 
('DVD Mode', None, 
  ( 
    (MsgAction, 'DvdSubtitles', 'DVD Subtitles', None, 2399142291), #SHORTCUT_DVDSUBS 
    (MsgAction, 'NextChapter', 'Next Chapter', None, 2399142293), #SHORTCUT_NEXTCHAP 
    (MsgAction, 'PreviousChapter', 'Previous Chapter', None, 2399142292), #SHORTCUT_PREVCHAP 
    (MsgAction, 'OsdChapterList', 'OSD Chapter List', None, 2399142294), #SHORTCUT_OSDCHPLIST 
    (MsgAction, 'ChapterList', 'Chapter List', None, 2399142290), #SHORTCUT_CHAPLIST 
    (MsgAction, 'DvdMenu', 'DVD Menu', None, 2399142289), #SHORTCUT_DVDMENU 
    (MsgAction, 'DvdMoveUp', 'DVD Move Up', None, 2399142295), #SHORTCUT_DVDMUP 
    (MsgAction, 'DvdMoveDown', 'DVD Move Down', None, 2399142296), #SHORTCUT_DVDMDN 
    (MsgAction, 'DvdMoveLeft', 'DVD Move Left', None, 2399142297), #SHORTCUT_DVDMLEFT 
    (MsgAction, 'DvdMoveRight', 'DVD Move Right', None, 2399142298), #SHORTCUT_DVDMRIGHT 
    (MsgAction, 'DvdSelect', 'DVD Select', None, 2399142299), #SHORTCUT_DVDMSELECT 
  ) 
), 
('OSD', None, 
  ( 
    (MsgAction, 'OsdUp', 'OSD Up', None, 2399142389), #SHORTCUT_OSDUP 
    (MsgAction, 'OsdDown', 'OSD Down', None, 2399142390), #SHORTCUT_OSDDN 
    (MsgAction, 'OsdLeft', 'OSD Left', None, 2399142391), #SHORTCUT_OSDLEFT 
    (MsgAction, 'OsdRight', 'OSD Right', None, 2399142392), #SHORTCUT_OSDRIGHT 
    (MsgAction, 'OsdPageCategoryUp', 'OSD Page/Category Up', None, 2399142393), #SHORTCUT_CATUP 
    (MsgAction, 'OsdPageCategoryDown', 'OSD Page/Category Down', None, 2399142394), #SHORTCUT_CATDN 
    (MsgAction, 'Select', 'Select', None, 2399142395), #SHORTCUT_SELECT 
    (MsgAction, 'EventInfo', 'Event Info', None, 2399142397), #SHORTCUT_EVINFO 
  ) 
), 
('Side Channel/File List Functions', None, 
  ( 
    (MsgAction, 'SideChannelFileUp', 'Side Channel File Up', None, 2399142489), #SHORTCUT_SCFUP 
    (MsgAction, 'SideChannelFileDown', 'Side Channel File Down', None, 2399142490), #SHORTCUT_SCFDN 
    (MsgAction, 'SideChannelFileSelect', 'Side Channel File Select', None, 2399142491), #SHORTCUT_SCFSELECT 
    (MsgAction, 'SideChannelFileDelete', 'Side Channel File Delete', None, 2399142492), #SHORTCUT_SCFDELETE 
    (MsgAction, 'SideChannelFileSatellit', 'Side Channel File Satellit', None, 2399142493), #SHORTCUT_SCFSAT 
    (MsgAction, 'SideChannelFileProvider', 'Side Channel File Provider', None, 2399142494), #SHORTCUT_SCFPROV 
    (MsgAction, 'SideChannelFileNetid', 'Side Channel File NetID', None, 2399142495), #SHORTCUT_SCFPROVID 
    (MsgAction, 'SideChannelFileTransponder', 'Side Channel File Transponder', None, 2399142496), #SHORTCUT_ 
    (MsgAction, 'SideChannelFileFavorit', 'Side Channel File Favorit', None, 2399142497), #SHORTCUT_SCFTRANSP 
    (MsgAction, 'SideChannelFileAll', 'Side Channel File All', None, 2399142498), #SHORTCUT_SCFALL 
  ) 
), 
('EPG Window Mode', None, 
  ( 
    (MsgAction, 'EpgWindowUp', 'EPG Window Up', None, 2399142589), #SHORTCUT_EPGWUP 
    (MsgAction, 'EpgWindowDown', 'EPG Window Down', None, 2399142590), #SHORTCUT_EPGWDN 
    (MsgAction, 'EpgWindowPageUp', 'EPG Window Page Up', None, 2399142591), #SHORTCUT_EPGWPGUP 
    (MsgAction, 'EpgWindowPageDown', 'EPG Window Page Down', None, 2399142592), #SHORTCUT_EPGWPGDN 
    (MsgAction, 'EpgWindowChannelUp', 'EPG Window Channel Up', None, 2399142593), #SHORTCUT_EPGWCHUP 
    (MsgAction, 'EpgWindowChannelDown', 'EPG Window Channel Down', None, 2399142594), #SHORTCUT_EPGWCHDN 
    (MsgAction, 'EpgWindowSelect', 'EPG Window Select', None, 2399142595), #SHORTCUT_EPGWSEL 
    (MsgAction, 'EpgWindowShedule', 'EPG Window Shedule', None, 2399142596), #SHORTCUT_EPGWSHED 
    (MsgAction, 'EpgWindowAllNowNext', 'EPG Window All/Now/Next', None, 2399142597), #SHORTCUT_EPGWANN 
  ) 
), 
('Presets', None, 
  ( 
    (MsgAction, 'Preset1', 'Preset 1', None, 2399142689), #SHORTCUT_PRESET1 
    (MsgAction, 'Preset2', 'Preset 2', None, 2399142690), #SHORTCUT_PRESET2 
    (MsgAction, 'Preset3', 'Preset 3', None, 2399142691), #SHORTCUT_PRESET3 
    (MsgAction, 'Preset4', 'Preset 4', None, 2399142692), #SHORTCUT_PRESET4 
    (MsgAction, 'Preset5', 'Preset 5', None, 2399142693), #SHORTCUT_PRESET5 
    (MsgAction, 'Preset6', 'Preset 6', None, 2399142694), #SHORTCUT_PRESET6 
  ) 
), 
('Plugin controls', None, 
  ( 
    (MsgAction, 'PluginUp', 'Plugin Up', None, 2399142789), #SHORTCUT_PLGUP 
    (MsgAction, 'PluginDown', 'Plugin Down', None, 2399142790), #SHORTCUT_PLGDN 
    (MsgAction, 'PluginLeft', 'Plugin Left', None, 2399142791), #SHORTCUT_PLGLEFT 
    (MsgAction, 'PluginRight', 'Plugin Right', None, 2399142792), #SHORTCUT_PLGRIGHT 
    (MsgAction, 'PluginPageUp', 'Plugin Page Up', None, 2399142793), #SHORTCUT_PLGPGUP 
    (MsgAction, 'PluginPageDown', 'Plugin Page Down', None, 2399142794), #SHORTCUT_PLGPGDN 
    (MsgAction, 'PluginSelect', 'Plugin Select', None, 2399142795), #SHORTCUT_PLGSEL 
    (MsgAction, 'PluginAlternateSelect', 'Plugin Alternate Select', None, 2399142796), #SHORTCUT_PLGALTSEL 
    (MsgAction, 'PluginCancel', 'Plugin Cancel', None, 2399142797), #SHORTCUT_PLGCANCEL 
    (MsgAction, 'PluginTab', 'Plugin Tab', None, 2399142798), #SHORTCUT_PLGTAB 
  ) 
), 
('Start MyTheatre', None, 
  ( 
    (ExeAction, 'StartLiveMode', 'Start in Live Mode', None, '/toggle'), 
    (ExeAction, 'StartDvdMode', 'Start in DVD Mode', None, '/dvd'), 
    (ExeAction, 'StartFileMode', 'Start in File Mode', None, '/remote F10'), 
  ) 
), 
) 



def ScanListRecursive(theList, group): 
    for part in theList: 
        if len(part) == 3: 
            # this is a new sub-group 
            groupName, groupDescription, groupList = part 
            newGroup = group.AddGroup(groupName, groupDescription) 
            ScanListRecursive(groupList, newGroup) 
        else: 
            # this is a new action 
            classType, className, actionName, actionDescription, actionValue = part 
            class tmpAction(classType): 
                name = actionName 
                description = actionDescription 
                value = actionValue 
            tmpAction.__name__ = className 
            group.AddAction(tmpAction) 



class MyTheatre(eg.PluginClass): 

    def __init__(self): 
        ScanListRecursive(MyActionList, self) 

        try: 
            key = _winreg.OpenKey( 
                _winreg.HKEY_LOCAL_MACHINE, 
                "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MyTheatre" 
            ) 
            self.myTheatrePath, dummy = _winreg.QueryValueEx(key, "InstallLocation") 
        except WindowsError: 
            self.PrintError("MyTheatre installation path not found!") 
            self.myTheatrePath = ""
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

Wenn ein Programm die Unterstützung für Messages richtig implementiert hat, dann liegt der Vorteil von SendMessage darin, dass es erst zurückkommt, wenn der Empfänger die Message bearbeitet hat. Das hat Vorteile, wenn man z.B. mit AutoRepeat arbeitet. Denn sonst (bei PostMessage) weiss EG nicht, wielange der Befehl zu seiner Ausführung brauchte und schickt u.U. gleich eine ganze Reihe Befehle hinterher, die dann erst viel später vom Empfänger bearbeitet werden, wenn der User die FB-Taste schon längst losgelassen hat.

Das reine SendMessage hat aber den Nachteil, dass es beim Hängen des Empfänger-Programmes auch EG zum Hängen bringen würde. Deshalb SendMessageTimeout.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

So, ich hab das Plugin mal in der letzten hochgeladenen Beta (684) mit eingebunden.
Milbrot
Plugin Developer
Posts: 79
Joined: Wed Mar 29, 2006 11:07 am

Post by Milbrot »

Gut muß man einfach sehen wie es im Betrieb läuft.

Besteht eigentlich die M├Âglichkeit gleich mehrere Befehle in EG
in einem Rutsch zu importieren? Bei so vielen ist es etwas m├╝hsam
jede Funktion einzeln zu importieren. Fein w├ñre auch noch die L├Âschen
Funktion als Shortcut zu haben so das man Funktionen z.B. mit DEL
entfernen kann ohne die Maus zu verwenden.
Aber ev. ist es mir nur durch das Testen des Plugs so vorgekommen ;)
Post Reply