• 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: Exporting shell variables to AppleScripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exporting shell variables to AppleScripts


  • Subject: Re: Exporting shell variables to AppleScripts
  • From: Doug McNutt <email@hidden>
  • Date: Wed, 19 Sep 2007 04:37:59 -0600

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

References: 
 >Exporting shell variables to AppleScripts (From: Mike <email@hidden>)
 >Re: Exporting shell variables to AppleScripts (From: Brian Johnson <email@hidden>)

  • Prev by Date: Re: Exporting shell variables to AppleScripts
  • Next by Date: Re: iTunes' sluggish import
  • Previous by thread: Re: Exporting shell variables to AppleScripts
  • Next by thread: Re: Exporting shell variables to AppleScripts
  • Index(es):
    • Date
    • Thread