• 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: tell darwin
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tell darwin


  • Subject: Re: tell darwin
  • From: Philip Aker <email@hidden>
  • Date: Sat, 04 May 2002 14:50:21 -0700

Hi Jeff,

I appreciate a good sense of humor. In fact though, if I separate that which is whimsical from that which is possible, you have illustrated a part of what I would see as an easier to use method than 'do shell script'.

Below are some excerpts from an offlist reply to the initial post and my comments:


tell darwin
...
...
...
end tell

What would replace the dots? You couldn't do e.g.:

tell darwin
ls -la
end tell

because applescript would think you're trying to subtract an undefined variable la from an undefined variable ls. There's a formidable syntax clash between AS and sh (or tcsh or bash or any other *NIX shell).

Amongst other things, I was thinking about how JavaScript sneaks into HTML.

<SCRIPT language="JavaScript">
<!--
function update( theInfo, theTitle ) {
top.DETAILS.location = theInfo;
top.TITLE.location = theTitle;
}
//-->
</SCRIPT>

The HTML comment delimiters shield the HTML parser from the JavaScript calls. But we'd probably want to have things a bit more elegant in AppleScript. 'tell darwin' would (at the level of the AppleScript compiler) shield us from stuff like that.

So:

tell darwin
cd ~
ls -la
pwd
du > ./Desktop/du.txt
exit -- implicit if not present
end tell

would theoretically invoke the users default shell and proceed to execute the commands putting their results (if any) into what is returned. Like 'do shell script' does now but taking care of quoting etc.

At one level then, it would appear as if the body of the 'tell darwin' block is commented out:

tell darwin
(*
...
*)
end tell



And what sort of thing would darwin be? Currently you can only tell stuff to applications and script objects.

'darwin' would be the lowest possible level of Darwin (i.e. MacOS) AppleScript could reasonably address and present to scripters.


Let me try to take it one step further. These are probably not technically correct illustrations but:

-- AppleScript variables
set msg to "Kilroy was here!"
set really to "Really?"

tell darwin using zsh with arguments msg really
echo $1
echo $2
end tell

tell darwin using perl with arguments msg really
... -- whatever perl can do with 'msg' and 'really'
end tell


Philip



On Saturday, May 4, 2002, at 10:30 AM, email@hidden wrote:

You got me thinking. Here are some sample scripts I could then perhaps write:

Example of recursion

to evolve
tell Darwin
create life from null
create animals from life
create mammals from animals
create humans from mammals
create SteveJobs from humans
create {Macintosh,NeXT} from SteveJobs
create self from {Macintosh,NeXT}
end tell
end evolve

Example of coercion

to devolve
global fair play
considering Macintosh
create Win31 from DOS
create Win95 from Win31
end considering
considering OS2
create WinNT
end considering
create Win98 from Win95
considering market domination and ignoring fair play
create {WinME,Win2000} from {Win98,WinNT}
considering {Darwin,MacOSX}
create WinXP from Win2000
end considering
continue market domination
-- note state of fair play at this point
end devolve

Jeff Baumann
email@hidden
www.linkedresources.com


In a message dated 5/4/02 12:05:41 AM, Philip Aker wrote:

Greetings designers,

'do shell script' is a real spark in Macintosh scripting. This
chat about "~/" and Jon Pugh's remark:

Unix can do anything. ;)

got me thinking about a slightly different approach:

tell darwin
...
...
...
end tell

What is your opinion? Would this kind of implementation be
feasible? Practical?


Philip Aker
http://www.aker.ca
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: tell darwin (From: email@hidden)

  • Prev by Date: Re: offset with spaces confusion
  • Next by Date: What happened to "file"?
  • Previous by thread: Re: tell darwin
  • Next by thread: What happened to "file"?
  • Index(es):
    • Date
    • Thread