Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.6: Open generic files in a preferred app via Services System 10.6
Snow Leopard only hintOften I need to edit text files that don't have any associated application. This usually occurs when I'm changing system configuration files. My original process was to Control-click on a file and then select Open with and then Other, and then search through the application folder for my text editor program. From another site, I learned that it is very easy to create Services with Automator in 10.6. So now I have a one-click process to open any file in my text favorite text editor.

Run Automator and choose the Service template. At the top right, change the drop-downs to read Service receives selected files or folders in any application. On the left, click Files & Folders in the Library column, then drag Open Finder Items (in the next column) into the work area on the right.

Change the Open With drop-down to your favorite text editor; you may have to click Other to find it. I use TextWrangler, which can open many types of files and also works well when passed a folder. Choose File » Save As from the menu, and give the Service a name. In my case, I called it Open with TextWrangler. The service will be saved in your user's /Library/Services folder.

Now you can Control-click (or right-click) on any file or folder, and at the bottom of the contextual menu, you can choose your new service.

[robg adds: This worked as described in my testing.]
    •    
  • Currently 3.38 / 5
  You rated: 3 / 5 (29 votes cast)
 
[6,115 views]  

10.6: Open generic files in a preferred app via Services | 2 comments | Create New Account
Click here to return to the '10.6: Open generic files in a preferred app via Services' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Open generic files in a preferred app via Services
Authored by: frgough on Feb 09, '10 08:34:36AM

You can also place the app in your dock or in the toolbar of your finder window and just drag and drop your generic files onto it.



[ Reply to This | # ]
10.6: Open generic files in a preferred app via Services
Authored by: jc_helary on Feb 10, '10 07:47:41AM

I use a similar approach but the automation is not handled by Automator but by the command line.

1) Get Dterm here: http://www.decimus.net/dterm.php and set its trigger key (I use Option+Space)
2) open (or create) a file named ".bash_profile" at the root of your home directory
3) create command aliases for all the applications that you frequently use. For ex:

alias neo='open -a NeoOffice'
alias emacs='open -a Emacs'
alias tw='open -a TextWrangler'
alias edit='open -a TextEdit'
alias word='open -a Microsoft\ Word'

4) save the file and from Dterm type "source .bash_profile" so that Dterm can access all the newly defined aliases right away.

Now, when you have files you want to quickly open in a specific application, trigger Dterm and type the name of the alias you want and the name of the files that need to be open.

Since Dterm has full access to your shell, you can use all sort of wildcards/regexps/filters to select the files to process.

It could be for ex:

"neo *.doc" to open all the .doc files in the current directory with NeoOffice.

The biggest advantage Dterm has over Terminal is that Dterm automatically works on the current directory. For Terminal, you need to use things like "cd to…" (found here http://code.google.com/p/cdto/) first (launched from Spotlight eventually) and then you can do your things.




[ Reply to This | # ]