[SVN] Passing variables to osascript, or other workaround?
Charilaos Skiadas
cskiadas at uchicago.edu
Wed May 11 20:58:53 UTC 2005
For the LaTeX bundle, I am trying all morning to write a script that
would go create a list of all the "\label" entries in the current
document, have the user choose one of them, and then insert it, a very
useful command for me. I've been trying to follow the script for
BibDesk.
My problem basically is: how can I pass a list of strings to osascript,
so that it can perceive them as a list, and so that "choose from list"
would work as expected. I am clearly misundestanding something. The
script I was trying is:
list=`grep '\\label{.*}' $TM_FILEPATH | sed
's/.*\\label{\([^}]*\)}\(.*\)$/\\\"\1 : \2\\\",/g'`
candidates={${list:0:${#list}-1}}
res=`osascript <<EOF
tell application "System Events"
activate
choose from list $candidates
end tell
EOF`
res=`awk <<<$res '{ printf("%s", $1) }'`
echo -n $res
My main problem is that $candidates does not seem to create a list, and
the applescript complains. I've tried all the escaping I could think
of, but I could not make it work. My escaping powers are not great
though, so I was hoping some kind soul might have some idea how to fix
this.
Haris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1153 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate-dev/attachments/20050511/0f0593b9/attachment.bin>
More information about the textmate-dev
mailing list