Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
restore finder tabs after close
tell application "Finder"
activate
-- Get current user's name
tell application "System Events"
set currentUser to (name of current user)
end tell
-- for cleanliness
close every window
-- open a Finder window that we will place the tabs in
open folder "Documents" of home
delay 0.25
-- begin command group to open a new tab and set its location
tell application "System Events" to keystroke "t" using command down
delay 0.25
set target of front window to folder "Downloads" of home
delay 0.25
-- end command group
-- begin command group to open a new tab and set its location
tell application "System Events" to keystroke "t" using command down
delay 0.25
set target of front window to folder "Applications" of the startup disk
delay 0.25
-- end command group
-- begin command group to open a new tab and set its location, in this case, the current user's home folder
tell application "System Events" to keystroke "t" using command down
delay 0.25
set target of front window to folder currentUser of folder "Users" of the startup disk
delay 0.25
-- end command group
-- TEMPLATE for folder on an external disk; modify or delete this group; begin command group to open a new tab and set its location
tell application "System Events" to keystroke "t" using command down
delay 0.25
set target of front window to folder "child_foldername" of folder "parent_folder_name" of disk "attached_disk_name"
delay 0.25
-- end command group
-- make the Finder toolbar visible, set to False if you don't want it
set toolbar visible of the front Finder window to true
-- set how wide you want the Sidebar or delete if you don't care
set the sidebar width of the front Finder window to 162
-- set the current view; I prefer column view but you can replace the word "column" in the line below with "list" or "icon"
set the current view of the front Finder window to column view
-- set whether you want the status bar at the bottom of the window
set statusbar visible of Finder window 1 to true
-- set the bounds of the window; these numbers affect both size and placement
set the bounds of the front Finder window to {8, 589, 1462, 1582}
-- this line returns us to the very first tab that was opened
tell application "System Events" to key code 124 using control down
end tell
@bitinn

This comment has been minimized.

Copy link
Owner Author

@bitinn bitinn commented Jan 2, 2019

Taken from this thread, by user "sjmagy"

https://discussions.apple.com/thread/8564513?page=4

Use this script at your own risk.

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