Reagiert auf onmouseover, onmousewheel, onkeydown. (Fernbedienung mit "Emuliere Tastatureingabe")
Als
Code: Select all
EGOSD.htaCode: Select all
<HTML>
<HEAD>
<TITLE>EG Menu</TITLE>
<HTA:APPLICATION ID="EGMenu"
APPLICATIONNAME="EGMenu"
navigable="no"
SYSMENU="no"
CONTEXTMENU="no"
SCROLL = "no"
WINDOWSTATE="normal"
BORDER="none"
INNERBORDER="no"
CAPTION="no"
SELECTION="no"
SHOWINTASKBAR="no"
>
<STYLE>
body
{
background-image:
url("your_image.png");
background-attachment:fixed;
background-repeat: no-repeat;
background-color:black;
text-decoration:none;
color:white;
font-size:18px;
font-family: arial;
margin:0px;
border:0;
padding:0px;
}
{
table-layout:fixed;
}
{
position:absolute;
top:0px;
left:0px;
width:140px;
height:210px;
overflow:auto;
overflow:hidden;
}
.abcbutton_blur
{
width:140px;
height:40px;
text-align:center;
color:white;
font-size:18px;
font-family:arial;
cursor:pointer;
background:
url('your_image.gif');
background-color:red;
}
.abcbutton_focus
{
width:140px;
height:40px;
text-align:center;
color:blue;
font-size:18px;
font-family:arial;
cursor:pointer;
background:
url('your_image.gif');
background-color:yellow;
}
</STYLE>
<SCRIPT>
//Define table row/cells count
var g = 0; //table cells
//var gmax = 3; //max table cells(left/right)
var h = 0; //table rows
var hmax = 10; //max table rows(up/down)
var EventGhost = new ActiveXObject("EventGhost");
//Don't loose menu focus (useful for large menus with 2 or more tables)
document.oncontextmenu = mousehandle;
document.onclick = mousehandle;
function mousehandle() {
if (window.event.srcElement.tagName != "TD" ) lfocus.focus();
}
//Set window position and transparency
function onInit(){
Menu.rows[h].cells[g].className = "abcbutton_focus";
Menu.rows[h].cells[g].focus();
lfocus = Menu.rows[h].cells[g];
window.resizeTo (150,220);
window.moveTo (600,100);
trigger('HTA_Opaque');
}
function trigger(event){
EventGhost.TriggerEvent(event);
}
//Keyboard navigation
function Menu_Key(){
switch (event.keyCode){
case 40: // down
if (h==hmax) break;
Menu.rows[h].cells[g].className = "abcbutton_blur";
h++;
Menu.rows[h].cells[g].className = "abcbutton_focus";
Menu.rows[h].cells[g].focus();
lfocus = Menu.rows[h].cells[g];
break;
case 38: // up
if (h==0) break;
Menu.rows[h].cells[g].className = "abcbutton_blur";
h--;
Menu.rows[h].cells[g].className = "abcbutton_focus";
Menu.rows[h].cells[g].focus();
lfocus = Menu.rows[h].cells[g];
break;
/* case 37: // left
if (g==0) break;
Menu.rows[h].cells[g].className = "abcbutton_blur";
g--;
Menu.rows[h].cells[g].className = "abcbutton_focus";
Menu.rows[h].cells[g].focus();
lfocus = Menu.rows[h].cells[g];
break;
case 39:// rigth
if (g==gmax) break;
Menu.rows[h].cells[g].className = "abcbutton_blur";
g++;
Menu.rows[h].cells[g].className = "abcbutton_focus";
Menu.rows[h].cells[g].focus();
lfocus = Menu.rows[h].cells[g];
break;
*/
case 32:// space
Menu.rows[h].cells[g].click();
}
}
function mousewheel(){
var nWert = event.wheelDelta;
if (nWert==120) EGDiv.scrollTop-= 42;
if (nWert==-120) EGDiv.scrollTop+= 42;
}
function Menu_Mouse(){
if (window.event.srcElement.tagName == "TD"){
Menu.rows[h].cells[g].className = "abcbutton_blur";
g = window.event.srcElement.cellIndex
h = window.event.srcElement.parentElement.rowIndex;
Menu.rows[h].cells[g].className = "abcbutton_focus";
Menu.rows[h].cells[g].focus();
lfocus = Menu.rows[h].cells[g];
trigger('HTA_Focus');
}
}
</script>
</HEAD>
<BODY ONLOAD="onInit()">
<DIV ID="EGDiv" ONMOUSEWHEEL="mousewheel()">
<TABLE ID="Menu" ONKEYDOWN="Menu_Key()" ONMOUSEOVER="Menu_Mouse()">
<TBODY>
<TR>
<TD CLASS="abcbutton_blur" ONCLICK="trigger('MyAction')">On/Off</TD>
</TR>
<TR>
<TD CLASS="abcbutton_blur" ONCLICK="trigger('MyAction')">TV/Radio</TD>
</TR>
<TR>
<TD CLASS="abcbutton_blur" ONCLICK=" trigger('MyAction')">Hottest Hits</TD>
</TR>
<TR>
<TD CLASS="abcbutton_blur" ONCLICK=" trigger('MyAction')">German Hits</TD>
</TR>
<TR>
<TD CLASS="abcbutton_blur" ONCLICK=" trigger('MyAction')">Metal</TD>
</TR>
<TR>
<TD CLASS="abcbutton_blur" ONCLICK=" trigger('MyAction')">German Rock</TD>
</TR>
<TR>
<TD CLASS="abcbutton_blur" ONCLICK=" trigger('MyAction')">UK Hits</TD>
</TR>
<TR>
<TD CLASS="abcbutton_blur" ONCLICK=" trigger('MyAction')">80's Hits</TD>
</TR>
<TR>
<TD CLASS="abcbutton_blur" ONCLICK=" trigger('MyAction')">90's Hits</TD>
</TR>
<TR>
<TD CLASS="abcbutton_blur" ONCLICK=" trigger('MyAction')">Classic Rock</TD>
</TR>
<TR>
<TD CLASS="abcbutton_blur" ONCLICK=" trigger('MyAction')">Dance</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
</BODY>
</HTML>Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="620">
<Folder Name="EG OSRemote">
<Macro Name="MyAction">
<Event Name="MyAction">
</Event>
<Action>
System.Execute(u'notepad.exe', u'', 0, False, 2)
</Action>
</Macro>
<Macro Name="SetWindowOpaque">
<Event Name="HTA_Opaque">
</Event>
<Action>
EventGhost.PythonScript(u'import win32gui\nfrom win32con import *\nimport ctypes\n\nSetLayeredWindowAttributes = ctypes.windll.user32.SetLayeredWindowAttributes\nSetWindowLongA = ctypes.windll.user32.SetWindowLongA\n\ntry:\n hwnd = win32gui.FindWindow(\'HTML Application Host Window Class\',None)\n SetWindowLongA(hwnd, GWL_EXSTYLE, WS_EX_LAYERED)\n SetLayeredWindowAttributes(hwnd, 0, 0, LWA_COLORKEY) #entweder schwarz durchsichtig\n #SetLayeredWindowAttributes(hwnd, 0, 127, LWA_ALPHA) #oder transparent \n #win32gui.SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE)#Immer im Vordergrund\nexcept:\n print "Error"')
</Action>
</Macro>
<Macro Name="GetWindowFocus">
<Event Name="HTA_Focus">
</Event>
<Action>
EventGhost.PythonScript(u"import win32gui\n\nhwnd = win32gui.FindWindow('HTML Application Host Window Class',None)\nfwnd = win32gui.GetForegroundWindow()\nif hwnd != fwnd:\n eg.result = 1\n")
</Action>
<Action>
EventGhost.NewJumpIf(XmlIdLink(152), 0, False)
</Action>
</Macro>
<Macro Name="SetWindowFocus" id="152">
<Action>
Window.FindWindow(u'mshta.exe', u'EG Menu', u'HTML Application Host Window Class', u'', u'Internet Explorer_Server', 1, False, 0.0, 0)
</Action>
<Action>
Window.BringToFront()
</Action>
</Macro>
</Folder>
</EventGhost>Falls jemand einen Verbesserungsvorschlag hat, immer her damit...