Probably because you aren't opening more Finder windows, instead you are changing the target of -- what is shown in -- a single window.
Have a look at the Finder's AppleScript dictionary, particularly the make verb (command) and the Finder window class and see if you can open three Finder windows, each showing the appropriate directory.
Since you're wanting to use AppleScript anyway, you might as well consolidate everything.
Note that I've made the convertPosixPathToAlias() handler use the expandTildePath() handler, so you only have to call the former to do both jobs.
Now you don't have to fool around with pauses.
You'll have to change the path strings and bounds as needed for your system.
-Chris
--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2023/01/23 20:19
# dMod: 2023/01/23 20:19
# Appl: Finder, System Events
# Task: Open the designated Finder windows and resize them.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @ASObjC, @Finder, @System_Events, @Open, @Windows, @Resize
--------------------------------------------------------
set savedSearchRef to convertPosixPathToAlias("~/Library/Saved Searches/Tag âą Working.savedSearch")
set autoconvertedPicsRef to convertPosixPathToAlias("~/LC3b-wout-Movies/_Pictures-LC3/_autoconverted pics")
set autoconvertRef to convertPosixPathToAlias("~/Desktop/_Autoconvert")
tell application "Finder"
activate
open savedSearchRef
set savedSearchWindowName to savedSearchRef's name
set bounds of window savedSearchWindowName to {0, 23, 534, 900}
open autoconvertedPicsRef
set autoconvertedPicsName to autoconvertedPicsRef's name
set bounds of window autoconvertedPicsName to {453, 23, 987, 900}
open autoconvertRef
set autoconvertName to autoconvertRef's name
set bounds of window autoconvertName to {906, 23, 1440, 900}
end tell
--------------------------------------------------------
--» HANDLERS
--------------------------------------------------------
# Automatically uses expandTildePath() if needed.
on convertPosixPathToAlias(posixPath)
set posixPath to expandTildePath(posixPath)
return alias POSIX file posixPath
end convertPosixPathToAlias
--------------------------------------------------------
on expandTildePath(tildePath)
tell application "System Events"
return POSIX path of disk item tildePath
end tell
end expandTildePath
--------------------------------------------------------
This row set bounds of window autoconvertName to {906, 23, 1440, 900}
has W = 1440, but on my machine both windows (the 2nd and the 3rd) have the same width 535 (should have been 987 and 1440.)
I assume that the 4 values for bounds are L Top W Height.
When I changed the bounds
like this
set bounds of window savedSearchWindowName to {71, 47, 1209, 1159}
set bounds of window autoconvertedPicsName to {1279, 23, 916, 308}
set bounds of window autoconvertName to {1279, 333, 916, 308}
The 1st savedSearchWindow
has correct Left & Top margins, almost correct Width and Height
The 2nd and 3rd windows move down to the bottom - left of the screen.
I leave it to you Chris if you want to delve into/ continue with it, other forum members probably have more pressing issues than this one, and there is always KM pure
You know how to get window bounds yourself by now â yes?
--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2023/01/24 15:56
# dMod: 2023/01/24 15:56
# Appl: Finder
# Task: Copy the AppleScript Bounds Property of the Front Window to the Clipboard.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Finder
--------------------------------------------------------
tell application "Finder"
set winBounds to bounds of front window
end tell
try
winBounds / 0
on error winBoundsText
set AppleScript's text item delimiters to {"{", "}"}
set winBoundsText to "{" & (text item 2 of winBoundsText) & "}"
set the clipboard to winBoundsText
return winBoundsText
end try
--------------------------------------------------------
If you want to get all window bounds at once you can run this from Script Debugger or Apple's decrepit Script Editor:
--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2023/01/24 15:56
# dMod: 2023/01/24 16:06
# Appl: Finder
# Task: Copy the AppleScript Bounds Property of Every Window to the Clipboard.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Finder
--------------------------------------------------------
tell application "Finder"
set winNameList to name of windows
set boundsList to bounds of windows
end tell
set collatorList to {}
set _cntr to 0
repeat with i in winNameList
set _cntr to _cntr + 1
set (contents of i) to {(contents of i), (item _cntr of boundsList)}
end repeat
return winNameList
--------------------------------------------------------
But the output will be normal AppleScript output â I'm not going to take the time to convert this one into text right now.
The reason why there was some confusion about the Finder bounds on my side is because of the different ways of AppleScript and KM measure the Right Edge and Bottom of a Window.
KM uses Width and Height whereas AS uses Distance from the Left and Distance from the top.
# Auth: Christopher Stone
# dCre: 2023/01/24 15:56
# dMod: 2023/01/24 16:06
# Appl: Finder, AppleScriptObjC
# Task: Display the Name and Bounds of Every Finder Window.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Finder, @ASObjC
--------------------------------------------------------
use AppleScript version "2.4" --» Yosemite or later
use framework "Foundation"
use scripting additions
--------------------------------------------------------
tell application "Finder"
set winNameList to name of windows
set boundsList to bounds of windows
end tell
set _cntr to 0
repeat with i in winNameList
set _cntr to _cntr + 1
set (contents of i) to {(contents of i), (item _cntr of boundsList)}
end repeat
set theJSON to its convertASToJSON:winNameList saveTo:(missing value)
--------------------------------------------------------
--» HANDLERS
--------------------------------------------------------
on convertASToJSON:someASThing saveTo:posixPath
--convert to JSON data
set {theData, theError} to current application's NSJSONSerialization's dataWithJSONObject:someASThing options:0 |error|:(reference)
if theData is missing value then error (theError's localizedDescription() as text) number -10000
if posixPath is missing value then -- return string
-- convert data to a UTF8 string
set someString to current application's NSString's alloc()'s initWithData:theData encoding:(current application's NSUTF8StringEncoding)
return someString as text
else
-- write data to file
theData's writeToFile:posixPath atomically:true
return result as boolean -- returns false if save failed
end if
end convertASToJSON:saveTo:
--------------------------------------------------------
I sent it to you in a private email night before last:
From: Christopher Stone <****@****>
Subject: Keyboard Maestro 10.2 âAppleScript â Get Bounds of all Finder Windows v1.00â Macro
Date: Tue, 24 Jan 2023 20:13:07 -0600
To: Omar ****** <****@****>
Then the Window Discovery Tool, would be for someone who needs the window dimensions of the Finder or any other app together with KM Window measurement (height , width).
We have the older macro ( 2023/01/23) : Task: Open the designated Finder windows and resize them.
(My name: Open 3 Finder windows for âŠ_AS)
Which opens 3 Finder windows and lays them out at their dedicated positions.
/okn
(Iâll wait with uploading to the Macro library.)