make a reaimgui script that searches all my directories for files named "olá"
- User
make a reaimgui script that searches all my directories for files named "olá"
- Assistant
ReaImGui is a module for ReaScript (Reaper's scripting environment) that provides ImGui (Immediate Mode GUI) functions. To achieve your goal using ReaImGui, we need to create a script that searches through directories on your system for files named "olá" and displays the results in a user-friendly interface.
Assuming you have ReaImGui installed and set up, we can write a script in ReaScript (using Lua) that utilizes the
os.executeto search directories and displays the found files in the ImGui window.Here's a basic example of how you might achieve this:
1. Install ReaImGui: Make sure you have the ReaImGui extension installed. You can find more about it on the ReaTeam's GitHub page or in ReaPack.
2. Create the Script:
lua-- @description ReaImGui Script to Search for Files Named "olá" -- @version 1.0 -- @author -- @requires ReaImGui -- @noindex reaper.ClearConsole() local reaper_imgui = reaper.Require("ReaImGui") -- Load the ReaImGui module if not reaper_imgui then reaper.ShowMessageBox("ReaImGui not found!", "Error", 0) return end local ctx = reaper_imgui.CreateContext("File Searcher") local search_dir = "C:\\" -- Change this to your starting directory or prompt user for input local search_term = "olá" local search_results = {} function performFileSearch(dir, term) local command = "dir /s /b \"" .. dir .. "\\" .. term .. "\"" local pipe = io.popen(command) -- Windows specific if pipe then for file in pipe:lines() do table.insert(search_results, file) end pipe:close() else reaper.ShowConsoleMsg("Failed to execute search.") end end function showResults() for _, file in ipairs(search_results) do reaper_imgui.Text(ctx, file) end end function main() reaper_imgui.Text(ctx, "Searching for files named 'olá' in "..search_dir) if reaper_imgui.Button(ctx, "Perform Search") then search_results = {} performFileSearch(search_dir, search_term) end reaper_imgui.Separator(ctx) if #search_results > 0 then reaper_imgui.Text(ctx, "Search Results:") showResults() else reaper_imgui.Text(ctx, "No results found. Click 'Perform Search' to start.") end reaper_imgui.Separator(ctx) if reaper_imgui.Button(ctx, "Close") then reaper_imgui.DestroyContext(ctx) else reaper.defer(main) end end reaper.defer(main) - User
what about files with mp3 and wav extensions
- Assistant
- User
%.wav$
- Assistant
- User
get window focus gets me 00000000016007A2. which window is this
- Assistant