PDA

View Full Version : how to add open item



37099562
July 12th, 2008, 05:42 PM
how to add line to open like when u pusinh from menu button name 'menu submenu option 1' if u put like this
win.ShellExecuteEx ('c:\\program files\\promixis\\girder\\event.exe',nil,nil,nil) it opents together with menu same
????????????
i triyed if then win.ShellExecuteEx ('c:\\program files\\promixis\\girder\\event.exe',nil,nil,nil) but doesn't work help

local SubMenu1 = {
Title='My First Submenu',
[1]='SubMenu Option 1',
[2]='SubMenu Option 2',
}

local MyMenu = {
Title='Toplevel Menu',
[1]='Menu Option 1',
[2]='Menu Option 2',
[3]=SubMenu1,
[4]={
Name='Menu Option 3 - Extended',
EventString='Nice!!',
EventDevice=100, -- Really you can add whatever you like here except for 'Title'.
},
}

table.insert(SubMenu1, MyMenu)

--[[ this one gets called when a user clicks on a menu item
the item clicked can be one of three types as defined above.
--]]
local function MyAutoCB(Number, Text, Item, Closing)

if type(Item) == 'string' then
-- a regular menu item was clicked.
gir.TriggerEvent(Text, 18,0)
end

if type(Item) == 'table' then

-- Figure out if it was a submenu or an extended item.
if not Item.Title then
-- alright this is an extended entry.
gir.TriggerEvent(Item.EventString, Item.EventDevice,0)
else
-- Sub Menu Item Clicked

end

end

end

-- Recycle the menu, do not keep creating new ones, you will run out of resources.
if not AutoMenu then

-- On the AutoMenu class DO NOT OVERRIDE THE Callback! Instead
-- Override the AutoCallback, if the AutoCallback is not overriden
-- the default is to Send the following Event:
-- EventString: "<MENU TITLE>.<MENU ITEM>"
-- EventDevice: 18
-- EventModifier: 1
-- Payload 1: <MENU ITEM>
-- Payload 2: <MENU ITEM NUMBER>

AutoMenu = osd.Classes.AutoMenu:New ({AutoCallback = MyAutoCB, Fade=true, TimeOut=5000})
--AutoMenu = osd.Classes.AutoMenu:New ({Fade=true})
AutoMenu:Initialize()

AutoMenu.MaxItems=20
end

-- Toggle visibility.
if not AutoMenu.Visible then
AutoMenu:Show (true, MyMenu)
else
AutoMenu:Hide()
end

Ron
July 14th, 2008, 10:59 AM
Use gir.TriggerEvent instead of event.exe. They serve the same purpose but one is FAST and the other (event.exe) is slow as it has to run an external program.

37099562
July 14th, 2008, 02:20 PM
gir.TriggerEvent ???

quixote
July 14th, 2008, 07:22 PM
It is a scripting command. Look it up in the help file for the syntax.