This is a very simple request.
JabRef 1.5 works wonderfully on Mac Os X. It would be extremely
simple to add the possibility to push citations into any application
via AppleScript. Let me explain.
I already checked (by changing the Winedt.exe path to an
AppleScript on my disk) that JabRef can correctly run an
AppleScript. Now the only missing bit is: how can JabRef pass the
information to the script. The rest is easy (two lines of code). This
must be quite easy to answer, since it already works for Winedt
and Kile.
So my question is: can you please explain how to transfer the
selected record? In other words, what is the name of the variable
(accessible to AppleScript!) where it is stored? With this info it
would be trivial to add an essential feature for Mac OS X users (I
would write a script immediately and send you for distribution).
Thanks
Piero
Logged In: YES
user_id=704995
The functions for Winedt and Kile are different. With Kile, we write a string
containing the BibTeX keys to a file (the lyx-pipe) which is monitored by Kile
or LyX, and Kile/Lyx handles the rest.
With Winedt, we call the Winedt executable with an argument containing a
Winedt-specific "insert text" command, telling Winedt to insert the "\cite{....}".
Again, Winedt handles the rest.
Now, I don't know how AppleScript works, but I suppose you can call a script
with a set of arguments? The arguments would contain the citations to insert,
and other information if any, and would be implemented similarly to the Winedt
function.
Am I understanding this correctly?
Logged In: NO
I see. I have a complete solution, not 100% satisfying since it requires to
install a very simple new command. In Mac OS X the command to launch
AppleScripts is "osascript", but it does not allow to pass arguments (yet;
maybe with Tiger). A nice substitute is "osasubr", available at
http://www.turbozen.com/mac/osasubr/
I did not check the source code to see if it's clean, but indeed it works.
Do you have a Mac to check the following procedure? If not let me know and
I'll try to help.By the way, my e-mail address is
danconaERASECAPITALLETTERS at mat dot uniroma1 dot it
and my name is Piero D'Ancona, please address future communications
there!
So the steps on Mac a are the following:
1) Install osasubr e.g. in /usr/bin or somewhere in the path and make it
executable.
2) With Script Editor, Save as an application the following script (it contains
only a subroutine). For instance I save it on the Desktop. I hope you can
adjust newlines correctly:
on do_insertion(LabelToInsert, TypeOfCitation, AppName)
set CompleteTextToInsert to "\\" & TypeOfCitation & "{" &
LabelToInsert & "}"
try
if AppName = "iTeXMac" then
tell application "iTeXMac" to insert CompleteTextToInsert in
the text of the front document
else
if AppName = "TeXshop" then
tell application "TeXShop" to set the selection of the front
document to CompleteTextToInsert
end if
end if
end try
end do_insertion
3) Now JabRef can call the command
osasubr ~/Desktop/InsertionScript.app do_insertion "Pieruzzo99" "cite"
"iTeXMac"
to insert \cite{Pieruzzo99} in the front window of iTeXMac,
or alternatively, for TeXshop,
osasubr ~/Desktop/InsertionScript.app do_insertion "Pieruzzo99" "cite"
"TeXshop"
That's it. I hope everything is clear, but please ask any questions (or
collaboration). I was really waiting for this feature on my Mac!
Piero
Logged In: NO
I see. I have a complete solution, not 100% satisfying since it requires to
install a very simple new command. In Mac OS X the command to launch
AppleScripts is "osascript", but it does not allow to pass arguments (yet;
maybe with Tiger). A nice substitute is "osasubr", available at
http://www.turbozen.com/mac/osasubr/
I did not check the source code to see if it's clean, but indeed it works.
Do you have a Mac to check the following procedure? If not let me know and
I'll try to help.By the way, my e-mail address is
danconaERASECAPITALLETTERS at mat dot uniroma1 dot it
and my name is Piero D'Ancona, please address future communications
there!
So the steps on Mac a are the following:
1) Install osasubr e.g. in /usr/bin or somewhere in the path and make it
executable.
2) With Script Editor, Save as an application the following script (it contains
only a subroutine). For instance I save it on the Desktop. I hope you can
adjust newlines correctly:
on do_insertion(LabelToInsert, TypeOfCitation, AppName)
set CompleteTextToInsert to "\\" & TypeOfCitation & "{" &
LabelToInsert & "}"
try
if AppName = "iTeXMac" then
tell application "iTeXMac" to insert CompleteTextToInsert in
the text of the front document
else
if AppName = "TeXshop" then
tell application "TeXShop" to set the selection of the front
document to CompleteTextToInsert
end if
end if
end try
end do_insertion
3) Now JabRef can call the command
osasubr ~/Desktop/InsertionScript.app do_insertion "Pieruzzo99" "cite"
"iTeXMac"
to insert \cite{Pieruzzo99} in the front window of iTeXMac,
or alternatively, for TeXshop,
osasubr ~/Desktop/InsertionScript.app do_insertion "Pieruzzo99" "cite"
"TeXshop"
That's it. I hope everything is clear, but please ask any questions (or
collaboration). I was really waiting for this feature on my Mac!
Piero
Logged In: NO
I see. I have a complete solution, not 100% satisfying since it requires to
install a very simple new command. In Mac OS X the command to launch
AppleScripts is "osascript", but it does not allow to pass arguments (yet;
maybe with Tiger). A nice substitute is "osasubr", available at
http://www.turbozen.com/mac/osasubr/
I did not check the source code to see if it's clean, but indeed it works.
Do you have a Mac to check the following procedure? If not let me know and
I'll try to help.By the way, my e-mail address is
danconaERASECAPITALLETTERS at mat dot uniroma1 dot it
and my name is Piero D'Ancona, please address future communications
there!
So the steps on Mac a are the following:
1) Install osasubr e.g. in /usr/bin or somewhere in the path and make it
executable.
2) With Script Editor, Save as an application the following script (it contains
only a subroutine). For instance I save it on the Desktop. I hope you can
adjust newlines correctly:
on do_insertion(LabelToInsert, TypeOfCitation, AppName)
set CompleteTextToInsert to "\\" & TypeOfCitation & "{" &
LabelToInsert & "}"
try
if AppName = "iTeXMac" then
tell application "iTeXMac" to insert CompleteTextToInsert in
the text of the front document
else
if AppName = "TeXshop" then
tell application "TeXShop" to set the selection of the front
document to CompleteTextToInsert
end if
end if
end try
end do_insertion
3) Now JabRef can call the command
osasubr ~/Desktop/InsertionScript.app do_insertion "Pieruzzo99" "cite"
"iTeXMac"
to insert \cite{Pieruzzo99} in the front window of iTeXMac,
or alternatively, for TeXshop,
osasubr ~/Desktop/InsertionScript.app do_insertion "Pieruzzo99" "cite"
"TeXshop"
That's it. I hope everything is clear, but please ask any questions (or
collaboration). I was really waiting for this feature on my Mac!
Piero
Logged In: NO
I see. I have a complete solution, not 100% satisfying since it requires to
install a very simple new command. In Mac OS X the command to launch
AppleScripts is "osascript", but it does not allow to pass arguments (yet;
maybe with Tiger). A nice substitute is "osasubr", available at
http://www.turbozen.com/mac/osasubr/
I did not check the source code to see if it's clean, but indeed it works.
Do you have a Mac to check the following procedure? If not let me know and
I'll try to help.By the way, my e-mail address is
danconaERASECAPITALLETTERS at mat dot uniroma1 dot it
and my name is Piero D'Ancona, please address future communications
there!
So the steps on Mac a are the following:
1) Install osasubr e.g. in /usr/bin or somewhere in the path and make it
executable.
2) With Script Editor, Save as an application the following script (it contains
only a subroutine). For instance I save it on the Desktop. I hope you can
adjust newlines correctly:
on do_insertion(LabelToInsert, TypeOfCitation, AppName)
set CompleteTextToInsert to "\\" & TypeOfCitation & "{" &
LabelToInsert & "}"
try
if AppName = "iTeXMac" then
tell application "iTeXMac" to insert CompleteTextToInsert in
the text of the front document
else
if AppName = "TeXshop" then
tell application "TeXShop" to set the selection of the front
document to CompleteTextToInsert
end if
end if
end try
end do_insertion
3) Now JabRef can call the command
osasubr ~/Desktop/InsertionScript.app do_insertion "Pieruzzo99" "cite"
"iTeXMac"
to insert \cite{Pieruzzo99} in the front window of iTeXMac,
or alternatively, for TeXshop,
osasubr ~/Desktop/InsertionScript.app do_insertion "Pieruzzo99" "cite"
"TeXshop"
That's it. I hope everything is clear, but please ask any questions (or
collaboration). I was really waiting for this feature on my Mac!
Piero
Logged In: NO
Wow, I was looking for that feature too. Thanks for pointing out this
AppleScript solution. Unfortunately it does not work on my machine (OS X
10.3.8 and JabRef 1.7beta2).
I'm a complete newbee to scripting but with your AppleScript to start with, I
changed some lines and came up with this one:
on do_insertion(Insertion)
set TypeOfCitation to "footcite"
set CiteKey to word -1 of Insertion
set CompleteTextToInsert to "\\" & TypeOfCitation & "{" & CiteKey &
"}"
try
tell application "TeXShop" to set the selection of the front
document to CompleteTextToInsert
end do_insertion
I m trying to figure out how to check for running applications and inserting
the Citation accordingly into TexShop or any other running Editor.
It would also be possible to have a little message box to choose between
the type of citation (I m using jurabib, hence the "footcite")
Logged In: NO
Wow, I was looking for that feature too. Thanks for pointing out this
AppleScript solution. Unfortunately it does not work on my machine (OS X
10.3.8 and JabRef 1.7beta2).
I'm a complete newbee to scripting but with your AppleScript to start with, I
changed some lines and came up with this one:
on do_insertion(Insertion)
set TypeOfCitation to "footcite"
set CiteKey to word -1 of Insertion
set CompleteTextToInsert to "\\" & TypeOfCitation & "{" & CiteKey &
"}"
try
tell application "TeXShop" to set the selection of the front
document to CompleteTextToInsert
end do_insertion
I m trying to figure out how to check for running applications and inserting
the Citation accordingly into TexShop or any other running Editor.
It would also be possible to have a little message box to choose between
the type of citation (I m using jurabib, hence the "footcite")
Thank You
Alex