• 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: Axel Luttgens <email@hidden>
  • Date: Sat, 28 Feb 2009 02:32:07 +0100

Le 28 févr. 09 à 02:12, LuKreme a écrit :

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.

Hello again ;-)

I tried in my very first post to understand your context, and to explain what could fail in my understanding of your context (hence, for example, sentences such as "Assuming the string in VAR1 will never contain double quotes,...").
But it seems I failed at circumventing that context, as it could well be a mix of "do shell script" statements and, say, regular Applescript statements.
Could you give us a full (yet simplified) example of the kind of workflow you are considering?


TIA,
Axel _______________________________________________
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: LuKreme <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>)
 >Re: using a shell variable in an osascript line? (From: LuKreme <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