write text at the cursor location in any program

Write an Applescript to enter specific text anywhere, for instance enter my email address anywhere, especially in Safari forms. Want to be able enter text anywhere using a hot key.

Thanks
:slight_smile:

how about setting the variable to the clip board and pasting it in place.

set myName to "My name."

set the clipboard to myName



tell application "System Events" to keystroke "v" using command down

Hi,

try this, you need a third party tool like QuickSilver, Butler, QuicKeys or FastScripts to assign a shortcut to the script


set theString to "John Doe"

tell application "System Events"
	tell (1st process whose frontmost is true) to keystroke theString
end tell

TextExpander from http://www.smileonmymac.com/ Smile On My Mac software

Cheers,

Craig

You can trigger a “text macro” using applescript and Spotlight, no extra program required. Try one of the scripts above, or one of the scripts I uploaded in my description of how to use Spotlight in this manner at the link below. This works best with Leopard as Spotlight is greatly improved in 10.5. There is an Applescript macro there for inserting your address that might suit your needs also.
http://bbs.macscripter.net/viewtopic.php?id=25706

vince