image
image

|


Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
Thread Tools
  #1  
Old June 3rd, 2004, 12:00 AM
Registered User
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
patniemeyer is on a distinguished road
Associate shell script as "Open With" application?

I'd like ".txt" files on my desktop to open in vim in a new window in iTerm by default.

So I figured out how to create a shell script with the appropriate osascript embedded in it to take an argument and do just that... tell iTerm to open a new window and load the file into vim.

However when I go to try to make the file type association using "open with" from the finder, OSX won't let me choose my executable shell script (#!/bin/sh) as the application. Even if I check the "all applications" it is still grayed out.

Does anyone have any idea of how OSX chooses which apps are "valid" for opening files and which are not?

Or can someone tell me the correct way to do this? I'm gussing there is some way with folder actions...


Thanks,
Pat Niemeyer,
Author of Learning Java, O'Reilly & Associates
Reply With Quote
  #2  
Old June 3rd, 2004, 09:49 AM
NSCoder
 
Join Date: Oct 2002
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
anarchie is on a distinguished road
The app has to be in a valid .app bundle. It is possible to embed that shell script into an app bundle so it appears as an application, but you won't be able to have it open files, since the open-file mechanism involves Apple Events.

Try making an Applescript application instead. Make sure it has the 'on open' handler.
Reply With Quote
  #3  
Old June 4th, 2004, 11:48 AM
Registered User
 
Join Date: Jun 2003
Posts: 700
Thanks: 0
Thanked 0 Times in 0 Posts
Lycander is on a distinguished road
Did you chmod +x on the script?
__________________
vacant lot
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 09:55 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.