Zeroun_Scripts

Print all widgets of a UI window by title name

Apr 8th, 2026 (edited)
139
0
Never
12
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.03 KB | Gaming | 0 0
  1. hotkey("F4", "Inspect Windows", function()
  2.     local WINDOW_TITLE = "Manage Container"
  3.     local root = g_ui.getRootWidget()
  4.                                          
  5.     local function findByTitle(widget, title)
  6.       local txt = widget.getText and widget:getText() or ''
  7.       if txt:lower():find(title:lower(), 1, true) then
  8.         return widget
  9.       end
  10.       for _, child in ipairs(widget:getChildren()) do
  11.         local found = findByTitle(child, title)
  12.         if found then return found end
  13.       end
  14.     end
  15.  
  16.     local function dumpWidget(w, indent)
  17.       indent = indent or ""
  18.       local id  = w.getId and w:getId() or "?"
  19.       local cls = w.getClassName and w:getClassName() or "?"
  20.       local txt = w.getText and w:getText() or ""
  21.       local chk = w.isChecked and tostring(w:isChecked()) or "n/a"
  22.       print(indent .. "[" .. cls .. "] id=" .. id .. " text='" .. txt .. "' checked=" .. chk
  23.         .. " size=" .. w:getWidth() .. "x" .. w:getHeight()
  24.         .. " childCount=" .. #w:getChildren())
  25.  
  26.       -- For UIScrollArea, also try to access its inner content panel
  27.       if cls == "UIScrollArea" then
  28.         local content = w.getContentWidget and w:getContentWidget()
  29.         if content then
  30.           print(indent .. "  [ScrollArea content panel]")
  31.           for _, child in ipairs(content:getChildren()) do
  32.             dumpWidget(child, indent .. "    ")
  33.           end
  34.         end
  35.       end
  36.  
  37.       for _, child in ipairs(w:getChildren()) do
  38.         dumpWidget(child, indent .. "  ")
  39.       end
  40.     end
  41.  
  42.     local win = findByTitle(root, WINDOW_TITLE)
  43.     if win then
  44.       print("=== Found: '" .. win:getText() .. "' [" .. win:getClassName() .. "] ===")
  45.       dumpWidget(win)
  46.     else
  47.       print("=== Window '" .. WINDOW_TITLE .. "' not found. Root children: ===")
  48.       for _, child in ipairs(root:getChildren()) do
  49.         local txt = child.getText and child:getText() or ''
  50.         print("  [" .. child:getClassName() .. "] id=" .. child:getId() .. " text='" .. txt .. "'")
  51.       end
  52.     end
  53.   end)
Tags: OTCv8
Advertisement
Comments
  • Vormitor
    225 days
    Comment was deleted
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment