I m trying to open a folder in Finder using AppleScript. The following is my code. I want the folder WorkSpace
to open in Finder, but it opens the Parent Folder /Volumes/MyMacDrive/Mani
and highlights the WorkSpace
folder. I want the contents of WorkSpace
folder, but all I'm getting is its Parent Folder's Contents. What am i missing here ..?
property the_path : "/Volumes/MyMacDrive/Mani/WorkSpace/"
set the_folder to (POSIX file the_path) as alias
tell application "Finder"
activate
if window 1 exists then
set target of window 1 to the_folder
else
reveal the_folder
end if
end tell
Finder window
class instead ofwindow
to not have an error if one of these windows is open (information window, preferences window, clipping window and view options window).-->if Finder window 1 exists then
. The reveal command : Bring the specified object(s) into view, use theopen
command as in adayzdone's answer. – jackjr300