• 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
newbie question: AppleScript and hashbang
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

newbie question: AppleScript and hashbang


  • Subject: newbie question: AppleScript and hashbang
  • From: Peter Vandenberk <email@hidden>
  • Date: Mon, 24 Apr 2006 12:09:07 +0100

Hi all,

Quick question: I wrote the following AppleScript...

	#!/usr/bin/osascript
	tell application "System Events" to return name of processes

... but when executing the script (after chmod +x) I get the following error message...

	./processes.scpt:0:1:
		script error: A unknown token can't go here. (-2740)

... which I assume stems from the fact that AppleScript doesn't recognise '#' as a comment token (as it only seems to recognise the '--' token for single-line comments).

I can obviously re-write the above script as follows...

	#!/bin/sh

	/usr/bin/osascript \
	-e 'tell application "System Events" to return name of processes'

... but that just makes you go hmmmmmmmmmm.

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

Many thanks,

Peter Vandenberk

_______________________________________________
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


  • Follow-Ups:
    • Re: newbie question: AppleScript and hashbang
      • From: Peter Vandenberk <email@hidden>
    • Re: newbie question: AppleScript and hashbang
      • From: Emmanuel <email@hidden>
  • Prev by Date: Re: Why do I get this error?
  • Next by Date: Re: Swap keyboard from "belgium" layout to US
  • Previous by thread: Re:Re: [AS] Getting some Finder windows properties under 10.4.6
  • Next by thread: Re: newbie question: AppleScript and hashbang
  • Index(es):
    • Date
    • Thread