Open a finder window with tabs

I have an existing script to open a directory window called Sat

tell application "Finder"
	activate
	set startupDisk to path to startup disk as text
	
	set Sat_Folder to startupDisk & "Users:<user_acct>:Documents:Sat"
	tell application "Finder" to open Sat_Folder
	select Finder window 1


I have simplified it for discussion. Within this directory there is another directory called ABC. Is there a way of opening a tab in the window of Sat for ABC?

Running Mavericks and AS that came with it.

Hi Robert,

This is an example that seems to work:

set desktop_ref to (path to desktop)
tell application "Finder"
	activate
	set target of front window to desktop_ref
end tell

gl,
kel

Forgot the new tab. Something like this macro:

tell application "Finder"
	activate -- bring Finder to front
end tell
-- uielement scripting to make new tab
tell application "System Events"
	tell process "Finder"
		keystroke "t" using command down
	end tell
end tell

Not sure if you need to resort to that.

gl,
kel

Nothing yet :frowning:

Hi Robert,

This is the first time I’m using tabs in Finder windows also. This is what I came up with:

tell application "Finder"
	activate
	set docs_path to (path to documents folder) as string
	set Sat_folder to docs_path & "Sat:"
	set ABC_folder to (sat_folder & "ABC:") as alias
	open sat_folder
end tell
tell application "System Events" to keystroke "t" using command down
tell application "Finder"
	set target of front window to ABC_folder
end tell

Tried to put it all together. Haven’t tested it, but it look like it’ll work.

gl,
kel

Thanks, I’ll give it a try. At present I’m trying to figure out why my second HD, call it B, has 5G less space than by first drive “A”.

I installed Mavericks on A a couple of days ago. I then cloned A → B using SuperDuper. They should be identical but are not; A has 5G more space used.

When I solve that mystery I’ll works on this using your suggestion.

Got it!


tell application "Finder"
	activate
	
	set startupDisk to path to startup disk as text
	set docs_path to startupDisk & "Users:<user_acct>:Documents:" as text
	set Sat_folder to docs_path & "Sat:"
	set ABC_folder to Sat_folder & "ABC:" as alias
	open Sat_folder
end tell

tell application "System Events" to keystroke "t" using command down

tell application "Finder"
	
	set target of front window to ABC_folder
	
end tell

Hi Robert,

Glad you got it running. I should have put making the references out of the Finder tell block:

set docs_path to (path to documents folder) as string
set Sat_folder to docs_path & "Sat:"
set ABC_folder to (Sat_folder & "ABC:") as alias

tell application "Finder"
	activate
	open Sat_folder
end tell

tell application "System Events" to keystroke "t" using command down

tell application "Finder"
	set target of front window to ABC_folder
end tell

gl,
kel