• 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: using a shell variable in an osascript line?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using a shell variable in an osascript line?


  • Subject: Re: using a shell variable in an osascript line?
  • From: LuKreme <email@hidden>
  • Date: Fri, 27 Feb 2009 18:12:34 -0700

On 27-Feb-2009, at 02:40, Axel Luttgens wrote:
If I understood you correctly, you have a single shell script with multiple statements; among those statements, two are of interest here:

	[...]
	VAR1=`tail -1 /var/log/mail.log`
	[...]
	osascript -e "display dialog $VAR1"
	[...]


OK,not exactly. I have a variable that I use in the shell script portion of my script and I then want to use it in an osascript statement. Nothing quite works. I'm not talking about secifically a display dialog, but perhaps, for example:

osascript -e 'tell application "myapp" to set "theSelection" to $VAR1'

I ended up doing this:

VAR1=`<whatever>`
echo $VAR1 > /tmp/osacript.tmp
osascript -e "set myVAR1 to (do shell script \"cat tmp/osacript.tmp \") as text"


It's fugly.  It works. Not done extensive testing though.

--
"Back off, man. I'm a scientist."

_______________________________________________
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
  • Follow-Ups:
    • Re: using a shell variable in an osascript line?
      • From: Axel Luttgens <email@hidden>
References: 
 >using a shell variable in an osascript line? (From: LuKreme <email@hidden>)
 >Re: using a shell variable in an osascript line? (From: Axel Luttgens <email@hidden>)

  • Prev by Date: Re: using a shell variable in an osascript line?
  • Next by Date: Re: using a shell variable in an osascript line?
  • Previous by thread: Re: using a shell variable in an osascript line?
  • Next by thread: Re: using a shell variable in an osascript line?
  • Index(es):
    • Date
    • Thread