Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hotkey("F4", "Inspect Windows", function()
- local WINDOW_TITLE = "Manage Container"
- local root = g_ui.getRootWidget()
- local function findByTitle(widget, title)
- local txt = widget.getText and widget:getText() or ''
- if txt:lower():find(title:lower(), 1, true) then
- return widget
- end
- for _, child in ipairs(widget:getChildren()) do
- local found = findByTitle(child, title)
- if found then return found end
- end
- end
- local function dumpWidget(w, indent)
- indent = indent or ""
- local id = w.getId and w:getId() or "?"
- local cls = w.getClassName and w:getClassName() or "?"
- local txt = w.getText and w:getText() or ""
- local chk = w.isChecked and tostring(w:isChecked()) or "n/a"
- print(indent .. "[" .. cls .. "] id=" .. id .. " text='" .. txt .. "' checked=" .. chk
- .. " size=" .. w:getWidth() .. "x" .. w:getHeight()
- .. " childCount=" .. #w:getChildren())
- -- For UIScrollArea, also try to access its inner content panel
- if cls == "UIScrollArea" then
- local content = w.getContentWidget and w:getContentWidget()
- if content then
- print(indent .. " [ScrollArea content panel]")
- for _, child in ipairs(content:getChildren()) do
- dumpWidget(child, indent .. " ")
- end
- end
- end
- for _, child in ipairs(w:getChildren()) do
- dumpWidget(child, indent .. " ")
- end
- end
- local win = findByTitle(root, WINDOW_TITLE)
- if win then
- print("=== Found: '" .. win:getText() .. "' [" .. win:getClassName() .. "] ===")
- dumpWidget(win)
- else
- print("=== Window '" .. WINDOW_TITLE .. "' not found. Root children: ===")
- for _, child in ipairs(root:getChildren()) do
- local txt = child.getText and child:getText() or ''
- print(" [" .. child:getClassName() .. "] id=" .. child:getId() .. " text='" .. txt .. "'")
- end
- end
- end)
Advertisement