Skip to content

Instantly share code, notes, and snippets.

@TitusRobyK
Last active August 25, 2024 22:23
Show Gist options
  • Select an option

  • Save TitusRobyK/cdaa1cea63154ad1d72c1a4085b05822 to your computer and use it in GitHub Desktop.

Select an option

Save TitusRobyK/cdaa1cea63154ad1d72c1a4085b05822 to your computer and use it in GitHub Desktop.

Revisions

  1. TitusRobyK revised this gist Aug 25, 2024. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Open In VSCode.txt
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,7 @@ on run {input, parameters}
    do shell script "/usr/local/bin/code " & quoted form of folderPath
    end repeat
    end run

    6) Save the workflow and test it by selecting a folder in Finder and using your Quick Action.


  2. TitusRobyK created this gist Aug 25, 2024.
    20 changes: 20 additions & 0 deletions Open In VSCode.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    1) Open the Automator app on your Mac.
    2) Choose New Document and select Quick Action
    3) In the top section of the Automator window, ensure the following settings:
    Workflow receives current: files or folders
    in: Finder
    4) In the search bar, type "Run AppleScript" and drag the action to the workflow area.
    5) Use the following AppleScript code:

    on run {input, parameters}
    repeat with i in input
    set folderPath to POSIX path of i
    do shell script "/usr/local/bin/code " & quoted form of folderPath
    end repeat
    end run
    6) Save the workflow and test it by selecting a folder in Finder and using your Quick Action.


    Explanation:
    This AppleScript iterates over the selected items (input) and converts each item to a POSIX path (a format that shell scripts can understand).
    The do shell script command then calls the code command with the folder path.