Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Paste clipboard contents to secure Safari pages Web Browsers
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.
    •    
  • Currently 2.00 / 5
  You rated: 2 / 5 (4 votes cast)
 
[18,750 views]  

Paste clipboard contents to secure Safari pages | 2 comments | Create New Account
Click here to return to the 'Paste clipboard contents to secure Safari pages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Paste clipboard contents to secure Safari pages
Authored by: richard2 on Jan 26, '08 05:58:37AM

I think I've improved it: :)

delay 3

try
	tell application "System Events" to keystroke (the clipboard)
on error errorDescription number errorIdentifier
	set theMessage to (errorNumber & ": " & errorDescription) as string
	
	display alert "The attempt to paste the contents of the clipboard failed." message theMessage as warning
end try

The delay statement delays execution of a script for a specified number of seconds.

I deleted the statement which clears the contents of the clipboard because it's likely that the user will encounter situations in which he or she needs to paste the passtext more than once.



[ Reply to This | # ]
Paste clipboard contents to secure Safari pages
Authored by: richard2 on Jan 26, '08 06:12:28AM

Oh, I forgot to mention that I changed the purpose of your script.

I intend it to be used to overcome a flaw in Leopard (which Apple claim isn't a flaw) which prevents you from pasting into most secret text fields.



[ Reply to This | # ]