External command with Editor content

I wonder wether it's possible to run an external command/script with the content of the current editor. Let me clarify by telling what I acutally want to do:

– I have an xml document open "page.xml"
– I want to press some shortcut, e.g. F12
– A script is started, that:
     1. reads the text of page.xml into a variable str
     2. str = escape(str)  //url escape the string
     3. call some terminal command, in my case osascript "tell document 1 of  application 'Safari' to do Javascript 'window.showPage(\'" + str + '\")'"

hope you get what i mean..

do you have any idea how this could be achieved (use it on a daily basis with textmate and a ruby script)

2 comments

Hello Severin,

You can define an external tool, pass the name of the current file to it
via the command line, and perform whatever actions you want in the external
tool script.

I wonder wether it's possible to run an external command/script with
the content of the current editor. Let me clarify by telling what I
acutally want to do:

– I have an xml document open "page.xml"
– I want to press some shortcut, e.g. F12
– A script is started, that:
1. reads the text of page.xml into a variable str
2. str = escape(str)  //url escape the string
3. call some terminal command, in my case osascript "tell
document 1 of  application 'Safari' to do Javascript
'window.showPage(\'" + str + '\")'"
hope you get what i mean..

do you have any idea how this could be achieved (use it on a daily
basis with textmate and a ruby script)

---
Original message URL:
http://www.jetbrains.net/devnet/message/5259223#5259223

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

That worked very well!

Thanks for the hint.

0

Please sign in to leave a comment.