Re: Exporting shell variables to AppleScripts
Re: Exporting shell variables to AppleScripts
- Subject: Re: Exporting shell variables to AppleScripts
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 19 Sep 2007 21:45:33 -0400
I wouldn't want envariables to show up as AppleScript variables. Ugh.
Unpredictable namespace pollution = bad.
But having a single environment record whose fields are the envar
names, or even a plain list of strings where each string is
"name=value" (which is how the environment gets passed around under
the covers by the OS) would indeed be a handy thing for AS.
Meanwhile you have to make do with other ways of getting info into
your AS program. Passing arguments, writing files, modifying the code
before recompiling it, etc.
On 9/19/07, Doug McNutt <email@hidden> wrote:
> At 20:40 -0700 9/18/07, Brian Johnson wrote:
> >I would think that "osascript" might hold out some hope, but if you don't
> get anything better from others, here's how I do it now ...
> >
> >I wrote an app called peacePipe that is used to connect apache to
> applescripts. One step in the process is a shell script that talks to an app
> that builds an AppleEvent to pass to a specified applescript. By building an
> appropriate shell script & applescript pair, you should be able to pass
> about anything from the shell universe to the applescript universe. There
> must be more elegant solutions, but this does work, as I use these
> "pseudo-CGI" pairs to run things under cron (sick, but works).
> >
> >peacePipe is available at http://quicksilver.caup.washington.edu/software
>
> I once experimented with copying a process' environment variables to a
> temporary file that can be read by another process that might have been
> started with no reference to a user's current login. In perl it's pretty
> easy because there is a hash of environment variables with names immediately
> available all of the time. I haven't used the code in years because it
> requires that the original process prepare a snapshot of its environment and
> it's hard to know when it is, and is not, current.
>
> I did discover a very easy way to do it in Linux where the environment
> variables are kept as name=value pairs in files like /var/proc/pid (from
> memory) which can have permissions set for read access by any process.
> Mach/BSD, at least as used by OS neXt, keeps environment variables hidden in
> system space.
>
> I think the original question was asking for compile-time usage of
> environment variable names within AppleScripts. A recent thread talked about
> creating variable names on the fly from the likes of named columns in a text
> file. I think that has been declared an unsupported concept. (It's the *
> sigl in perl.)
>
> But it would be nice if things like $HOME, $SHELL, and $PWD could be picked
> up for use as predefined variable names within AppleScript. It would be even
> nicer if they could be changed in a way that the new contents would be used
> by a subsequent "do shell script".
>
> --
>
> --> In Christianity, man can have only one wife. This is known as monotony.
> <--
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden