Some web pages, such as login pages, do not permit one to paste a password into the password field. While Safari offers AutoFill, I still occasionally find myself looking up a password in Web Confidential, which allows one to copy a password. I wrote the following script to 'type' the clipboard contents into the active text field in Safari's frontmost window.
The script uses GUI scripting to do it's thing. GUI scripting is available by default in Panther. Jaguar users can use the script if they have installed the beta version of System Events (download). I haven't done extensive testing (the script relies on common sense) but it appears to overcome this issue satisfactorily.
try
set clip to the clipboard
tell application "Safari" to activate
tell application "System Events" to keystroke clip
set the clipboard to ""
on error e
display dialog e buttons {"OK"} default button 1 with icon 0
end try
I'm sure that the script can be improved, and easily changed to work with other browsers, but it can serve as a starting point.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20040120184422156