Smitis
Silver Member | Ðåäàêòèðîâàòü | Ïðîôèëü | Ñîîáùåíèå | ICQ | Öèòèðîâàòü | Ñîîáùèòü ìîäåðàòîðó
Êîä: ------------------------------------------------------------------------------------------------------------------------ -- CtrlAltShiftQ - ïîëåçíàÿ èíôîðìàöèÿ î òåêóùåì ýëåìåíòå (ïàíåëè, äèàëîãè, ìåíþ, ïð.) -- CtrlAltShiftA - âñå ýëåìåíòû äèàëîãà ------------------------------------------------------------------------------------------------------------------------ local F = far.Flags local MaxLen = 80 -- ìàêñèìàëüíàÿ äëèíà äëÿ îáðåçêè äëèííûõ çíà÷åíèé ------------------------------------------------------------------------------------------------------------------------ -- Ïîèñê ãóèäà â òàáëèöå far.Guids local function FindGuid(guid) if guid and guid:len()==16 then guid=win.Uuid(guid) end guid = guid and guid:upper() or "" for n,v in pairs(far.Guids) do if v == guid then return n end end return nil end -- Ïîèñê ôëàãà â far.Flags local function FindFlag(flag,prefix) prefix = prefix and ("^"..prefix.."_"):gsub("_+$","_") or "." -- åñëè íå çàäàí, áóäåò èñêàòüñÿ ïåðâûé ïîïàâøèéñÿ ôëàã for n,v in pairs(far.Flags) do if flag==v and n:find(prefix) then return n end end return nil end ------------------------------------------------------------------------------------------------------------------------ Macro { description="Info"; area="Common"; key="CtrlAltShiftQ"; action=function() local a = Area.Current local t = "Area: " .. Area.Current local info = far.AdvControl(F.ACTL_GETWINDOWINFO) local object_id, owner_id if Area.Menu then a = "Menu" local menu_id = Menu.Id local menu_guid = FindGuid(menu_id) menu_guid = menu_guid and (" ("..menu_guid..")") or "" t = "Area: " .. Area.Current .."\n".."ID: " .. menu_id .."\n".."Title: " .. (Object.Title or ""):sub(1,MaxLen) .."\n".."ItemStatus: " .. (Menu.ItemStatus() or "") .."\n".."Value: " .. (Menu.Value or ""):sub(1,MaxLen) .."\n".."Type: " .. info.TypeName .."\n".."Name: " .. info.Name elseif Area.MainMenu then a = "Menu" local guid = Menu.Id local guid_name = FindGuid(guid) guid_name = guid_name and (" ("..guid_name..")") or "" t = "Area: " .. Area.Current .."\n".."ID: " .. (guid or "") .."\n".."Title: " .. (Object.Title or ""):sub(1,MaxLen) .."\n".."ItemStatus: " .. (Menu.ItemStatus() or "") .."\n".."Value: " .. (Menu.Value or ""):sub(1,MaxLen) .."\n".."Type: " .. info.TypeName .."\n".."Name: " .. info.Name elseif Area.UserMenu then a = "UserMenu" local guid = Menu.Id local guid_name = FindGuid(guid) guid_name = guid_name and (" ("..guid_name..")") or "" t = "Area: " .. Area.Current .."\n".."ID: " .. guid .."\n".."Title: " .. (Object.Title or ""):sub(1,MaxLen) .."\n".."ItemStatus: " .. (Menu.ItemStatus() or "") .."\n".."Value: " .. (Menu.Value or ""):sub(1,MaxLen) elseif Area.Dialog then a = "Dialog" local dlg_h = info.Id local coord = dlg_h:send(F.DM_GETDLGRECT,0,0) local focus = dlg_h:send(F.DM_GETFOCUS) local item = dlg_h:send(F.DM_GETDLGITEM,focus) local item_type = FindFlag(item[1],"DI") local dlg_guid = Dlg.Id local dlg_owner = Dlg.Owner local dlg_guid_name = FindGuid(dlg_guid) local dlg_owner_name = FindGuid(dlg_owner) local dlg_title = Object.Title t = "Area: " .. Area.Current .."\n".."ID: " .. dlg_guid .. (dlg_guid_name and (" ("..dlg_guid_name..")") or "") .."\n".."Owner: " .. dlg_owner .. (dlg_owner_name and (" ("..dlg_owner_name..")") or "") .."\n".."Title: " .. (dlg_title or ""):sub(1,MaxLen) .."\n".."Coord: " .. ("X1=%i Y1=%i X2=%i Y2=%i"):format(coord.Left,coord.Top,coord.Right,coord.Bottom) .."\n".."Size: " .. ("Width=%i Height=%i"):format(coord.Right-coord.Left+1,coord.Bottom-coord.Top+1) .."\n".."Type: " .. info.TypeName .."\n".."Name: " .. info.Name .."\n" .."\n".."Focus: " .. focus .."\n".."ItemType: " .. item[1] .. (item_type and " ("..item_type..")" or "") .."\n".."Value: " .. item[10]:sub(1,MaxLen) .."\n".."Coord: " .. ("X1=%i Y1=%i X2=%i Y2=%i"):format(item[2],item[3],item[4],item[5]) .."\n".."Size: " .. ("Width=%i Height=%i"):format(item[4]-item[2]+1,item[5]-item[3]+1) elseif Area.Search then a = "Search" t = "Area: " .. Area.Current .."\n".."Title: " .. (Object.Title or "") .."\n".."Focus: " .. Dlg.SetFocus() .."\n".."Value: " .. Dlg.GetValue(-1,0):sub(1,MaxLen) .."\n".."ItemType: " .. Dlg.ItemType --.."\n"..win.Uuid(id) elseif Area.Shell then local dir = panel.GetPanelDirectory(nil,1) local ainfo = panel.GetPanelInfo(nil,1) local pinfo = panel.GetPanelInfo(nil,0) a = "Shell" t = "Area: " .. Area.Current .."\n".."Dir: " .. dir.Name .."\n".."Param: " .. dir.Param .."\n".."PluginId: " .. win.Uuid(dir.PluginId):upper() .."\n".."File: " .. dir.File .."\n".."Type: " .. info.TypeName --.."\n".."Name: " .. info.Name .."\n".."Height: " .. tostring(ainfo.PanelRect.bottom-ainfo.PanelRect.top+1) .."\n".."Wigth: " .. tostring(ainfo.PanelRect.right-ainfo.PanelRect.left+1).." (" .. tostring(pinfo.PanelRect.right-pinfo.PanelRect.left+1)..")" elseif Area.Disks then a = "Disks" t = "Area: " .. Area.Current .."\n".."Title: " .. (Object.Title or ""):sub(1,MaxLen) .."\n".."Type: " .. info.TypeName .."\n".."Name: " .. info.Name .."\n" .."\n".."Value: " .. (Menu.Value or ""):sub(1,MaxLen) else a = "Unknown" t = "Area: " .. Area.Current .."\n".."Title: " .. (Object.Title or ""):sub(1,MaxLen) .."\n".."ID: " .. Dlg.Id .."\n".."ID: " .. Menu.Id .."\n".."Type: " .. info.TypeName .."\n".."Name: " .. info.Name end msgbox(a.." info", t, 8) end; } ------------------------------------------------------------------------------------------------------------------------ local AllItemsListId = "6FC32E48-2857-4487-8B46-B658C1C8B585" local AllItemsViewId = "98B202E2-EB02-4B42-8375-59876F2A5367" Macro { description="Info: All dialog items"; area="Dialog"; key="CtrlAltShiftA"; action=function() local t = "" local info = far.AdvControl(F.ACTL_GETWINDOWINFO,nil) local dlg = info.Id local focus = dlg:send("DM_GETFOCUS") local item, itemtype local items = {} local hotkeys = { {BreakKey="F3"} } local current = 0 local itemnum = 0 while true do itemnum = itemnum+1 item = dlg:send(F.DM_GETDLGITEM,itemnum) if item==nil then break end itemtype = FindFlag(item[1],"DI_") items[#items+1] = { text="Item "..tostring(itemnum).."; Type: "..tostring(item[1])..(itemtype and " ("..itemtype..")" or ""), } if itemnum == focus then current = #items items[#items].checked = true end items[#items+1] = { text=" "..item[10], grayed=true, } items[#items+1] = { text=" "..("X1=%i Y1=%i X2=%i Y2=%i W=%i H=%i"):format(item[2],item[3],item[4],item[5],item[4]-item[2]+1,item[5]-item[3]+1), grayed=true, } end far.Menu( { Title="Dialog: "..info.Name, Bottom="F3: View", SelectIndex=current, Id=win.Uuid(AllItemsListId), Flags=bor(F.FMENU_SHOWAMPERSAND,F.FMENU_WRAPMODE), MaxHeight=21, }, items, hotkeys ) end; } ------------------------------------------------------------------------------------------------------------------------ |
| Âñåãî çàïèñåé: 3218 | Çàðåãèñòð. 09-02-2003 | Îòïðàâëåíî: 11:36 29-06-2019 | Èñïðàâëåíî: Smitis, 11:38 29-06-2019 |
|