• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: newbie question: AppleScript and hashbang
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newbie question: AppleScript and hashbang


  • Subject: Re: newbie question: AppleScript and hashbang
  • From: Christopher Nebel <email@hidden>
  • Date: Mon, 24 Apr 2006 12:24:51 -0700

On Apr 24, 2006, at 8:21 AM, Peter Vandenberk wrote:

So my newbie question is pretty straightforward: is
there a more elegant way to write hashbang-enabled
AppleScripts (or, more generally, osascripts)?

After posting my original question, I did some more googling and found the following hack:


http://www.macosxhints.com/article.php?story=20040617170055379

Anyone know of another approach? Thanks again,

Well, you could do something like this:

	#!/bin/sh
	sed -e '1,4d' $0 | osascript
	exit 0
	# Script begins after this line.
	"hello" & " " & "world"

Here-documents usually work pretty well, though.

Also, I should point out that the bit in that article about it being "difficult with osascript to pass command-line parameters to the AppleScript" is out of date as of Mac OS X 10.4 (Tiger) -- read the osascript(1) man page for instructions.



--Chris Nebel
AppleScript and Automator Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >newbie question: AppleScript and hashbang (From: Peter Vandenberk <email@hidden>)
 >Re: newbie question: AppleScript and hashbang (From: Peter Vandenberk <email@hidden>)

  • Prev by Date: [ANN] XNetwork 2.0
  • Next by Date: Plug-ins
  • Previous by thread: Re: newbie question: AppleScript and hashbang
  • Next by thread: Re: newbie question: AppleScript and hashbang
  • Index(es):
    • Date
    • Thread