I have an AppleScript that copies selected records from the frontmost library to another open library. After the copy completes, the script opens the destination folder in the target library.
That part works fine, but I then need to bring the correct browser window for the target library to the front.
The complication is that EagleFiler allows multiple browser windows for the same library (e.g. Snippets Library and Snippets Library (4)). The AppleScript dictionary exposes library documents and browser windows, but there’s no direct way to say “bring the window for this library document to the front”.
Calling:
tell application "EagleFiler"
open (file of tgtLib)
end tell
does bring the library forward, but if multiple windows are open for that library it can raise the wrong one (e.g. the (4) window).
After a lot of experimentation I ended up using a routine that:
Uses the short library name (e.g. Snippets Library)
Iterates through browser windows
Finds the window whose title matches that name (preferring the unnumbered one)
Sets its index to 1 to bring it to the front
In simple terms, the routine just searches the open browser windows and raises the one whose title matches the target library.
This works reliably, but it feels a bit indirect.
So my question is:
Is there a more direct AppleScript way to bring the browser window for a specific library document to the front?
For example something like:
tell library document "Snippets Library.eflibrary"
make its browser window frontmost
end tell
For future users: Quick way to see the difference between application-level and library-level browser windows
While debugging a script that needed to bring the correct EagleFiler window to the front, I discovered a useful diagnostic snippet that makes the two window contexts visible.
EagleFiler exposes browser windows in two scopes:
Application level → all open browser windows
Library document level → only the windows belonging to that library
This short script shows both lists:
tell application "EagleFiler"
log "---- Application level windows ----"
repeat with i from 1 to count of browser windows
log ("App window " & i & ": " & name of browser window i)
end repeat
log "---- Library level windows ----"
repeat with L in library documents
log ("Library: " & name of L)
tell L
repeat with j from 1 to count of browser windows
log (" Lib window " & j & ": " & name of browser window j)
end repeat
end tell
end repeat
end tell