Welcome to the private homepage of Stephan Klimek. Mainly this a place to publish articles of my current interests, to host some of my software projects in development and to provide some personal stuff. This site was developed using the excellent dokuwiki framework. For further info you can have a look at the Inprint page and use this Contact form for any feedback or requests.

Wiki Index

Automator

Open current folder in Terminal

Original sources of information Want an Automator plug-in to cause Terminal to cd into the selected folder (or the containg folder, if you have a file selected). It's a pretty simple thing to do, with only two elements. Launch Automator and add these two steps to the workflow area via drag and drop:

  • In the Library column, select Finder, then drag the Action named Get Selected Finder Items into the right-side work area.
  • Click the Automator entry in the Library column, then drag the Run AppleScript action to the work area. The contents of the script should be:
on run {input, parameters}
tell application "Terminal"
  activate
  if (the (count of the window) = 0) or (the busy of window 1  = true) then
    do script "cd \"" & (POSIX path of (input as string)) & "\""
  else
    do script "cd \"" & (POSIX path of (input as string)) & "\"" in window 1
  end if
end tell
return input
end run

Next, select File→Save as Plug-in, give your new command a name like Change to selected folder in Terminal, and make sure the pop-up shows that it will be a Finder plug-in.

Edit any file type as text

Original sources of information If you download a text file from the internet, like a ReadMe or a .nfo file, it usually doesn't open in TextEdit unless you explicitly tell the Finder to do so for each and every file you download. You can use the 'Open With' contextual menu, of course, but this menu usually includes a lot of options for generic text files – so it takes a while to display, and then to scroll through to find TextEdit. You can also, of course, help the Finder learn about each type of generic text file you may download (by using Get Info and changing the default application), but this can be tedious and you may not actually wish to change the default application.

The solution is to create a simple Automator action to open the currently selected file(s) in TextEdit, and install it as a Finder plug-in:

  1. Launch Automator and click on Finder in the Library column.
  2. In the Action column, drag Open Finder Items to the empty area on the right-hand side.
  3. In the Action itself, click the Open with pop-up and set it to TextEdit (or the text editor of your choice).
  4. Select File→Save as Plug-in.
  5. In the dialog that appears, enter the name you want to give to the plugin (eg. View in TextEdit) in the Save Plug-in As field, and set the Plug-in for pop-up to Finder.
  6. Click the Save button.

From now on, you can select any file or files you want to view, control-click on one of them, and select the option View in TextEdit (or whatever name you used) from the Automator sub-menu. This is much quicker than using the Finder's huge Open With menu.

wiki/osx/automator.txt · Last modified: 2006-11-21 17:54 by admin
init24.de = chi`s home Mac OS X Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Valid CSS Valid XHTML 1.0 Recent changes RSS feed