Skip to content

Instantly share code, notes, and snippets.

@JMichaelTX
Last active February 2, 2026 19:48
Show Gist options
  • Select an option

  • Save JMichaelTX/6b2389ec8ffdba12beb6680c32ed7668 to your computer and use it in GitHub Desktop.

Select an option

Save JMichaelTX/6b2389ec8ffdba12beb6680c32ed7668 to your computer and use it in GitHub Desktop.
Here is a handler I use to reveal in Finder the item currently selected in Path Finder. Often I need to do something in the Finder window, so I have added a pause until the Finder window name is the same as the Path Finder window name. Revised to Ve
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
on revealPFItemInFinder()
--–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
(* VER: 2.1 2018-03-19
PURPOSE: Reveal Item in Finder that is Selected in Path Finder
RETURNS: alias of item selected in both Finder and Path Finder
AUTHOR: JMichaelTX
--–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
*)
local finWinName, pfWinName, fileList, itemPath, oItem
--- GET THE ITEM SELECTED IN PATH FINDER ---
tell application "Path Finder"
set fileList to (get selection)
if ((fileList is missing value) or ((count of fileList) ≠ 1)) then error ("You must select only ONE file in Path Finder.")
set oItem to item 1 of fileList
set itemPath to POSIX path of oItem
set pfWinName to name of container of oItem
end tell
set itemAlias to alias POSIX file itemPath
--- REVEAL SAME ITEM IN FINDER ---
tell application "Finder"
activate -- to make sure reveal will be in frontmost window
reveal itemAlias
--- Now Wait for New Finder Window with Same Name as Path Finder ---
set finWinName to name of window 1
set maxWaitTime to 2.0
set delayTime to 0.1
set waitTime to 0
repeat while finWinName ≠ pfWinName
delay delayTime
set finWinName to name of window 1
set waitTime to waitTime + delayTime
if (waitTime > maxWaitTime) then error "Max wait time of " & maxWaitTime & " exceeded waiting for Finder Window of " & pfWinName
end repeat
end tell
return itemAlias
end revealPFItemInFinder
@rnedel
Copy link

rnedel commented Nov 21, 2024

Hi JMichaelTX,

I have been frustrated that PathFinder fails to reveal files in Finder (instead of PathFinder) when asked via either the menu item File > Reveal in Finder or via the context menu. I'm thankful that you've provided this script as a potential solution.

I can't figure out how to assign your script as the event handler for either or both of those menus. Would you please shed some light on how to force PathFinder to execute this script when the user selects either File > Reveal in Finder and/or the associated context menu Reveal in Finder?

Thank you.

rnedel

@fsmbrad
Copy link

fsmbrad commented Feb 2, 2026

JMichaelTX, thank you for the great script. rnedel I'm not sure how this script was intended to be used (i.e., somehow integrated into Path Finder's Reveal in Finer menu action), but I was able to use the script by saving it as a AppleScript application. Copy the script above and remove the first line and the last two lines from the script. Then save script as an Application (I'm using Script Debugger for this). I called my application Reveal.app. Finally, in Path Finder, right-click on the toolbar and select Add Custom Items from the popup menu. Select the script application that you just created. This will add the app to the toolbar. You can then select any single item (file or folder) in Path Finder and click the icon for the Reveal application to have it reveal it in the Finder. Note you can rearrange the icons in your toolbar by right-clicking on the toolbar and selecting Customize Toolbar. Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment