Re: using a shell variable in an osascript line?
Re: using a shell variable in an osascript line?
- Subject: Re: using a shell variable in an osascript line?
- From: Doug McNutt <email@hidden>
- Date: Fri, 27 Feb 2009 15:14:28 -0700
At 23:43 -0700 2/26/09, LuKreme wrote, and I snipped.:
I have a shell variable that I set to the output of a shell command
VAR1=`tail -1 /var/log/maillog`
and then I use VAR1 in the shell script for various things.
Then, at some point, I want to use that VAR1 in an osascript line,
maybe something like:
osascript -e "display dialog $VAR1"
this doesn't work, however. the variable is transient in nature, so
I can't simply redo the assignment as a do shell script.
Some things that I do have not been mentioned in this thread.
osascript << ENDSCRIPT
line1
do something with $VAR1
line3
ENDSCRIPT
# Is a decent way to answer some, but not all of the quoting problems.
It's also possible to script Terminal.app. I often just open a
terminal window and name it so I can display dialogs and watch stderr
using Terminal as the GUI application rather than something that
doesn't like not having a GUI window available.
setenv FUN "funny"
tViewInit -n $FUN
osascript << ENDSCRIPT
tell application "Terminal"
do script "curl -o $destination $theURL" in window "$FUN"
end tell
ENDSCRIPT
<ftp://ftp.macnauchtan.com/Software/Progress/tViewCmd>
<ftp://ftp.macnauchtan.com/Software/Progress/tViewInit>
Are some examples in which the quoting problem actually worked out.
(The stuff above is from memory and just might need a \" or two.)
--
--> A fair tax is one that you pay but I don't <--
_______________________________________________
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