1

I'm looking to create an AppleScript which helps me open VSCode in a specific folder (in order to be able to use it in the toolbar in Finder). I've written the following code:

tell application "Finder"
    if exists Finder window 1 then
        set currentFolder to target of Finder window 1 as alias
    else
        return
    end if
end tell
tell application "Visual Studio Code" to open quoted form of POSIX path of currentFolder

However, this isn't working. I've never used AppleScript before, so I'm unaware of what I'm doing wrong.

How could I achieve this?

Thanks in advance for your answer.

1 Answer 1

0

You've almost got it, just one small bug:

tell application "Visual Studio Code" to open quoted form of POSIX path of currentFolder

open is part of the Standard Suite and opens files and folders directly.

tell application "Visual Studio Code" to open currentFolder

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .