Question: I'm trying to open iCloud in the current Finder window/tab. The below AppleScript works with any other folder.

How can I open iCloud in the current Finder window with AppleScript?

```
tell application "Finder"
    reopen
    activate
    set p to "~/Library/Mobile Documents/"
    set target of Finder window 1 to POSIX file p
end tell

```

Answer: 
The script doesn't work because the Finder is not able to expand the tilde in POSIX paths.

This is an alternative with a relative path.

```
set userLibraryFolder to path to library folder from user domain
tell application "Finder"
    reopen
    activate
    set iCloudDriveFolder to folder "iCloud Drive" of folder "Mobile Documents" of userLibraryFolder
    set target of Finder window 1 to iCloudDriveFolder
end tell

```
This is easy.
Create an alias of the iCloud folder and place that on the local hard drive then use Apple Script to open the alias and that opens the iCloud folder:
set itemPath to "Macintosh HD:Users:username:folder:alias\_name"
tell application "Finder"
set theItem to item itemPath
if (class of theItem) is folder then activate
open theItem
end tell