Created
February 19, 2024 01:06
-
-
Save hohonuuli/70f741184c131ebed4f0c44eb03e0a3c to your computer and use it in GitHub Desktop.
AppleScript to open a Warp tab at the current location in the finder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
WarpHere by Brian Schlining | |
2024-02-18 | |
*) | |
-- when the toolbar script icon is clicked | |
-- | |
on run | |
tell application "Finder" | |
try | |
set this_folder to (the target of the front window) as alias | |
on error | |
set this_folder to startup disk | |
end try | |
my process_item(this_folder) | |
end tell | |
end run | |
-- this subroutine processes does the actual work | |
-- this version can handle this weirdo case: a folder named "te'st"ö te%s`t" | |
on process_item(this_item) | |
set thePath to quoted form of POSIX path of this_item | |
set theCmd to "cd " & thePath & ";clear;" | |
tell application "Warp" | |
activate | |
-- just open Warp and cd to thePath | |
tell application "System Events" to tell process "Warp" | |
click menu item "New Tab" of menu "File" of menu bar 1 | |
-- click menu item "New Window" of menu "File" of menu bar 1 | |
set frontmost to true | |
end tell | |
delay 0.5 | |
tell application "System Events" | |
tell application process "Warp" | |
keystroke theCmd | |
keystroke return | |
end tell | |
end tell | |
end tell | |
end process_item |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment