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 isn't a complete answer because this won't open the *iCloud* folder in the current tab, but it *does* open the *iCloud* folder rather than the `"Mobile Documents"` folder:

```
tell application "System Events" to open folder "~/Library/Mobile Documents"

```

I'm not familiar with any method that will give you the best of both worlds. It seems that you either must settle for the `"Mobile Documents"` folder opening in the tab you want; or a new tab being created to open the folder you want.