Open folder in existing Finder window

I wrote the following simple script to open the Downloads folder at the root of the iClouds Drive in the Finder (the path in the code below is slightly different from the path in the actual code due to my username being different from “myusername”):

tell application "Finder"
	open POSIX file "/Users/myusername/Library/Mobile Documents/com~apple~CloudDocs/Downloads/"
end tell

I created it via Automator as a quick action and assigned a keyboard shortcut to it via ->System Settings Keyboard->Keyboard Shorcut. It all works fine except that the specified folder is always opened in a new Finder window even when I press the shortcut from within an existing active Finder window.

Is it possible to change it so that the specified folder is opened in the already existing active Finder window which the quick action is called from?

PS I have the following workaround based on keystrokes but that is not the type of solution I am looking for because it takes such code nearly a second to complete running presumably due to its being based on keystrokes.

tell application "Finder"
	delay 0.1
	tell application "System Events"
		-- Press ⌘⇧G, i.e. open the "Go to Folder" dialog
		key code 5 using {command down, shift down}
		delay 0.2
		set the clipboard to "/Users/myusername/Library/Mobile Documents/com~apple~CloudDocs/Downloads/"
		-- Press ⌘V, i.e. paste whatever in the clipboard to the dialog box
		keystroke "v" using {command down}
		delay 0.1
		keystroke return -- Press the return key to navigate to the specified path
	end tell
end tell

apaksoy. I don’t have an iCloud drive for testing, but the following works when tested on my computer as an Automator quick action with keyboard shortcut:

tell application "Finder"
	set target of Finder window 1 to POSIX file "/Users/Robert/Downloads/"
end tell

I’m following along a few of the posts here and trying different scripts. This one seemed easy enough, and works. But, I saved (exported) the script as an application, and it runs and completes, but I get a popup window every time stating “Open Downloads would like to access files in your Downloads folder” with an OK and Don’t Allow for choices.

Based on the solution @peavine provided, below is what I ended up using:

-- Opens the Downloads folder at the root of iCloud Drive in the active 
-- Finder window or a new one if there is no existing Finder window 
-- assuming the focus is on the Finder (shortcut created only for the Finder).
tell application "Finder"
	set Downloads to "Macintosh HD:Users:myusername:Library:Mobile Documents:com~apple~CloudDocs:Downloads:"
	if exists Finder window 1 then
		set target of Finder window 1 to Downloads
		open Downloads
	end if
end tell

You have to add the AppleScript app to the Privacy & Security settings. On my Ventura computer, this included adding the app to Privacy & Security > Accessibility and Privacy & Security > Full Disk Access. Also, for some reason, saving the script with Script Debugger instead of Script Editor seemed to make a difference, but I’m not sure of that.

Thank you, that worked on my Intel 2014 Mac mini running Monterey, I’ll try it later on the 2020 M1 MacBook Pro, also running Monterey. I was hoping to avoid the $99 Script Debugger purchase.

Of course, for the first few minutes, finding the AppleScript app was frustrating, but using Find Any File solved that.

Seems Script Debugger is the way to go. I had posted a couple of issues here (Script Error Issue Question) with AppleScript applications that ran fine on my 2014 Intel Mac mini but constantly thru an error when run on my 2020 M1 MacBook Pro (both machines are on Monterey 12.6.8). Downloaded Script Debugger on the MacBook Pro, copied the script I was once again having issues with, saved it as an application from within Script Debugger and it runs flawlessly each and every time. So, whatever the differences are between the two machines, the Script Debugger folks have it figured out. Purchased!