Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open new Finder window using AppleScript

Tags:

applescript

How can I open a new window of Finder in AppleScript? I am using an if else statement to open a window. I tried an Osascript command but it gave me a syntax error. The code is below:

if the button returned of the result is "Sleep" then
    tell app "Finder" to go to sleep
if the button returned of the result is "Open Finder" then
    osascript -e 'tell application "Finder" to open new window'
else
    display dialog current time
end if
like image 738
ThatCrazyCow Avatar asked Jan 17 '14 14:01

ThatCrazyCow


People also ask

How do I open a new Finder window on a Mac?

To open a new Finder window without opening a specific folder, click the Finder icon in the Dock, then choose File > New Finder Window or press Command-N.

What is tell in AppleScript?

The tell compound statement identifies the target of an AppleScript command or Apple event (as in tell app "Photoshop 5.5" ) followed by other AppleScript statements and an end tell .


1 Answers

Try:

tell application "Finder" to make new Finder window
like image 179
adayzdone Avatar answered Sep 18 '22 14:09

adayzdone