father of monstermagnet
April 19th, 2005, 09:05 AM
@Mike C
I'm playing with the IEOSD script you send me. Thanks :lol:
(very cool, particularly the timers)
The following functions are not available here (and not shown in Inspector).
win.HideWindowFromTaskbar
win.RemoveWindowFrame
win.SetWindowOnTop
win.FadeWindow
Will this be implemented or i'm missing something ?
Promixis
April 19th, 2005, 09:26 AM
You need an update...
.dll into the main G dir.
.lua into the luascript dir.
Promixis
April 19th, 2005, 09:32 AM
some updated code...
ieOSD = {
New = function (self,o)
o = o or {}
setmetatable (o,self)
self.__index = self
return o
end,
Initialize = function (self)
self.Transparency = self.Transparency or 200 -- set default if needed
self.RemoveFrame = self.RemoveFrame or false -- remove frame
self.oIE = luacom.CreateObject("InternetExplorer.Application")
self.oIE:Navigate ("about:blank - Microsoft Internet Explorer")
if not self.oIE then
gir.LogMessage ("OSD","Failed to create IE.Application",1)
return
end
--[[ -- use this is you need... for some reason the .screen object is very sensitive
if not self.oIE.Document.parentWindow.screen then -- this kludge will kill iexplore when this problems occurs
win.TerminateProcess (win.FindProcess ("iexplore.exe")) -- this happens when the quit methood of ie.app is not called..
self.oIE = luacom.CreateObject("InternetExplorer.Application")
print ("killed")
self.oIE:Navigate ("about:blank - Microsoft Internet Explorer")
return
end
--]]
return true
end,
StartTimer = function (self)
if self.Timeout then
self.Timer = gir.CreateTimer (nil,function () gir.RunCodeOnMainThread (function (...) return self:Cancel (unpack (arg)) end)end,nil,0) -- this trickery used to get back on the same thread...
self.Timer:Arm (self.Timeout)
end
end,
SetupDefaultEventHandlers = function (self)
self.oDocEvents = {
parent = self,
onmouseover = function (self)
win.SetWindowLayeredAttributesOff (self.parent.oIE.HWND)
end,
onmouseout = function (self)
win.SetWindowTransparency (self.parent.oIE.HWND,self.parent.Transparency)
end,
oncontextmenu = function (self) -- note the parentwindow fails if an ie object is not released with a :Quit () method. You have to kill the iexplorer.exe task to reset it.
self.parent.oDoc.parentWindow.event.returnValue = 0
end,
onmousedown = function (self)
win.HideWindowFromTaskbar (WeatherOSD.oIE.HWND)
end,
ondblclick = function (self)
self.parent:Cancel ()
end
}
self.oDoc = self.oIE.Document
luacom.Connect (self.oDoc,self.oDocEvents)
end,
Cancel = function (self)
_ = self.Timer and self.Timer:Destroy ()
self.oIE:Quit ()
self.oDoc= nil
self.oIE = nil
collectgarbage ()
end,
}
ieTextOSD = ieOSD:New ({
New = function (self,o)
o = o or {}
setmetatable (o,self)
self.__index = self
return o
end,
Show = function (self,text,timeout)
self:Initialize ()
local frame = 4 -- size of frame.
if not self.oIE then
return
end
-- self.oIE:Navigate ("about:blank - Microsoft Internet Explorer")
self.oIE.Document:WriteLn ("<body scroll='no' bgcolor='black'>")
self.oIE.Document:WriteLn ("<font size='9' color='green'>")
self.oIE.Document:WriteLn (text)
self.oIE.Document:WriteLn ("</font>")
self.oIE.Fullscreen = 1
while self.oIE.Busy == 1 do --? use READYSTATE_COMPLETE
win.Sleep (50)
end
self.oIE.document.body.style.margin = 1
self.tr = self.oIE.document.body:createTextRange ()
self.oIE.Height = (self.tr:boundingHeight()+self.tr:offsetTop()*2 )
self.oIE.Width = (self.tr:boundingWidth()+self.tr:offsetLeft()*2 )
self.oIE.Left = win.GetSystemMetrics (win.SM_CXSCREEN) - self.oIE.Width + frame
-- self.oIE.Left = self.oIE.Document.parentWindow.screen.width - self.oIE.Width+ frame-- win.GetSystemMetrics (win.SM_CXSCREEN) - self.oIE.Width
self.oIE.Top = 0 - frame
local h = self.oIE.HWND
win.HideWindowFromTaskbar (h)
win.SetWindowTransparency (h,self.Transparency)
win.RemoveWindowFrame (h,frame)
self.oIE.Visible = 1
win.SetWindowOnTop (h) -- must call after window visible...
ieOSD.StartTimer (self)
ieOSD.SetupDefaultEventHandlers (self)
end,
Cancel = function (self)
-- win.FadeWindow (self.oIE.HWND,0,1000,nil)
ieOSD.Cancel (self)
end,
})
ieOSDClock = ieTextOSD:New (
{
New = function (self,o)
o = o or {}
setmetatable (o,self)
self.__index = self
return o
end,
Start = function (self)
self.ClockTimer = gir.CreateTimer (nil,function () gir.RunCodeOnMainThread (function (...) return self:Update (unpack (arg)) end)end,nil,1) -- this trickery used to get back on the same thread...
self.ClockTimer:Arm (1000)
end,
Update = function (self)
self.tr:moveStart ("textedit",-1)
self.tr.text = os.date ("%H")..":"..os.date ("%M")..":"..os.date("%S")
end,
Cancel = function (self)
_ = self.ClockTimer and self.ClockTimer:Destroy ()
ieTextOSD.Cancel (self)
end
})
ieImageOSD = ieOSD:New ({ --HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Play Animations
New = function (self,o)
o = o or {}
setmetatable (o,self)
self.__index = self
return o
end,
Show = function (self,imagefilename)
self:Initialize ()
local frame = 4 -- size of frame.
local margin = 1
if not self.oIE then
return
end
-- self.oIE:Navigate ("about:blank - Microsoft Internet Explorer")
self.oIE.Document:WriteLn ("<body scroll='no' bgcolor='black'>")
self.oIE.Document:WriteLn ("</font>")
self.oIE.Fullscreen = true
self.image = self.oIE.Document:createElement("img")
self.image.src = imagefilename
self.oIE.Document.Body:appendChild (self.image)
while self.oIE.Busy == 1 do --? use READYSTATE_COMPLETE
win.Sleep (50)
end
self.oIE.document.body.style.margin = margin
self.oIE.Height = self.image.Height + frame +margin
self.oIE.Width = self.image.Width + frame+margin
local l,t,r,b = monitor.GetMonitorWorkAreaRect (1)
self.oIE.Left = r - self.oIE.Width
self.oIE.Top = b - self.oIE.Height
local h = self.oIE.HWND
win.HideWindowFromTaskbar (h)
win.SetWindowTransparency (h,230)
self.oIE.Visible = 1
-- win.SetWindowOnTop (h) -- must call after window visible...
ieOSD.SetupDefaultEventHandlers (self)
end,
UpdateImage = function (self,imagefilename)
if self.image then
self.image:removeNode (true)
end
self.image = self.oIE.Document:createElement("img")
self.image.src = imagefilename
self.oIE.Document.Body:appendChild (self.image)
end,
Cancel = function (self)
ieOSD.Cancel (self)
end,
})
--[[
OSD = ieTextOSD:New ({Timeout = 15000})
OSD:Show ("test ie osd.....")
--]]
-- [[
OSDClock = ieOSDClock:New ()
OSDClock:Show ("00:00:00")
OSDClock:Start ()
--]]
-- [[
WeatherOSD = ieImageOSD:New ()
WeatherOSD:Show ("C:\\DOCUME~1\\mike\\LOCALS~1\\Temp\\satmap Minneapolis.gif")
--]]
father of monstermagnet
April 19th, 2005, 10:08 AM
COOOOOOOOOOL 8)
Thanks !
quixote
April 19th, 2005, 10:19 AM
Any chance we can get some screenshots? You've always got something cool in the lab. :D
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.