Sending a command to the current application

I’m not really much of a programmer, but I wanted to develop a tool that would allow me to highlight a block of text in any program and, with the push of one button, use Google’s language tools to translate it to/from portuguese. What I ended up with works for my purposes, but only for text that is highlighted within Safari, and I have to click on the script in my dock to start it. If someone has already developed this tool, please let me know! I would like to be able to get the text from another application than Safari if possible - here is what I tried (unsuccessfully) to get the text to/from another application.

set front_app to (path to frontmost application as Unicode text)
set name_ to name of (info for (path to frontmost application))
tell application front_app
tell process name_
keystroke “c” using {command down}
end tell
end tell

Does anyone know what I’m doing wrong?

My translation script is below if anyone is interested (it only works if the GUI tools are enabled in the system preferences, and will only work until Google changes the layout of their website!)

tell application “Safari”
activate
tell application “System Events”
tell process “safari”
keystroke “c” using {command down}
open location “http://translate.google.com/translate_t
delay .5
keystroke tab
delay .5
keystroke “v” using {command down}
delay 0.5
keystroke tab
delay 0.3
repeat 5 times
delay 0.2
keystroke (ASCII character 30)
end repeat
keystroke (ASCII character of 13)
–delay 0.3
keystroke (ASCII character of 13)
end tell
end tell
end tell

Seems that this works here (you may add some error-trapping):

tell application "System Events" to keystroke "c" using {command down}

delay 1 --> while thing is done

open location "http://translate.google.com/translate_t?text=" & (the clipboard) & "&langpair=en|pt"

There is too “Bellhop”, which will allow you to write a Mac OS X Service using AppleScript:
http://www.xendai.com/

That’s excellent, thanks! Much nicer than what I had. I’ll take a look at Bellhop, too