Hi Guys
I've been trying to create a button that lets me create a show the finder window if there's any open, and if not create a new window, and if there is already a finder window open / showing create a new tab.
I've got the following apple script:
tell application "Finder"
if frontmost then
set visible of process "Finder" to false
else if (count windows) is 0 then
make Finder window
activate
else if (count windows) is greater than 0 then
tell application "System Events"
tell process "Finder"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
end tell
activate
end if
end tell
This works when I run it from the script editor... and it works when I run the script from the button in the BTT editor. However, when I click the button it doesn't work; it just creates a finder window, then goes to the last frontmost window, then creates a new finder window, etc.
Any advice?