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?
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
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.
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
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