Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Open in iTerm 3" icon in Finder menubar #13

Open
cardoni opened this issue Sep 29, 2017 · 1 comment
Open

"Open in iTerm 3" icon in Finder menubar #13

cardoni opened this issue Sep 29, 2017 · 1 comment
Assignees
Labels

Comments

@cardoni
Copy link
Owner

cardoni commented Sep 29, 2017

A Quick Tutorial:

"Open in iTerm 3" icon in Finder menubar.

Souces

(*  "Open Terminal Here"
    A toolbar script for Mac OS X 10.3/10.4
    (Originally) Written by Brian Schlining
    (Soon to be) Tweaked by Greg Cardoni      *)


property debug : false

-- 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 handler processes folders dropped onto the toolbar script icon 
-- 
on open these_items
 repeat with i from 1 to the count of these_items
  set this_item to item i of these_items
  my process_item(this_item)
 end repeat
end open


-- 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 "iTerm"
  activate
  -- just open a terminal and cd to thePath
  --set newWindow to (create window with default profile)
  
  set aWindow to current window
  
  if aWindow is equal to missing value then
   set aWindow to (create window with default profile)
  else
   tell aWindow
    set t to (create tab with default profile)
   end tell
  end if
  
  
  tell current session of aWindow
   write text "cd " & thePath & ";clear;"
  end tell
  
 end tell
 
 
end process_item
@cardoni cardoni added the topics label Sep 29, 2017
@cardoni cardoni added this to the Ten More Articles! milestone Sep 29, 2017
@cardoni cardoni self-assigned this Sep 29, 2017
@cardoni
Copy link
Owner Author

cardoni commented Sep 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant