I wrote a tiny AppleScript application which pastes text into fields which do not allow Cmd+V pasting (like password prompts). This may come in handy when working through VNC/remote desktop or virtualization software (such as Apple Screen Sharing, Parallels Desktop etc). Personally I use it to type in my password into the login screen of the Windows virtual machine.
To put it in simple terms: the app uses the virtual keyboard to type in the text from your clipboard. It tricks the program that asks for your input into thinking that you’re actually typing on your keyboard.
The downside of the app is that it occupies space in the Dock.
Download Force Paste.app (~15KB). Don’t forget to drag it into your Dock!
(Advanced users may want to use it from the Script menu rather than the Dock. Download main.scpt and put it to ~/Library/Scripts/ directory).
GitHub repository: https://github.com/EugeneDae/Force-Paste
Important note to macOS Mojave users: if you’re getting a “not allowed to send keystrokes” error, simply add Force Paste.app to System Preferences > Security & Privacy > Accessibility. See issue #7.
how do you actually use this little app?
Click on the app when you want to paste something. That’s it.
Thank you so much Dae, this is a genius script. I just got a new external drive and was horrified I couldn’t paste my randomly generated 50 character/digit/symbol/upper-case/lower-case password! You have just saved me at least half-an-hour!
kudos!
Thank you so much for creating this and making it freely available. Now I can keep using long random passwords without going insane. A lifesaver.
This little app is awesome! The perfect companion to 1Password!
Thanks a lot!
Hi!
Do you have the entire project pushed up to github anywhere?
Thanks,
-Brian
Hi! Please check: https://github.com/EugeneDae/Force-Paste
Fantastic tool Dae.
I really hate it how we can’t copy paste into the text field whenever we are asked for a password, like when working with certificates or encrypting disk images.
I will try to fork the project to do it a little bit more friendly. Thanks a lot for the tool and for releasing the source code.
Thanks! Forks are welcome.
Thank you thank you thank you thank you! from a 1Password user.
Great script Dae! thanks a lot
is there anyway to use an app to map the trigger to a function key (or any other key for that matter)?
Yes, BetterTouchTool (free) or ControllerMate (shareware) would allow you to map a keyboard key to the app.
I love you for this!
First I didn’t realise that the script has to be dragged to dock. After doing that – it just works.
Passwords copied to clipboard from password manager are getting pasted to pass field for encrypted images without any problem.
The easiest and the most elegant solution that I could find by far.
Thanks a lot Dae:)
Hi,
Great tool but it did not work for me on my MacBook Pro with the latest OS X.
I figured out that I have to type at least one character in password field and then delete it before Force Paste will paste into the field. Now Force Paste saves me a lot of time.
Thanks!
Hi Gene, I also use MacBook Pro with the latest OS X 10.10.3 and Force Paste works straight away for me. I wonder why it doesn’t in your case?
If you could record a small screencast using LICEcap or a similar app, possibly it’d give me a hint.
THANK YOU!
Pingback: » Apple:Why can't I paste into the password dialog when mounting an encrypted disk image?
Thanks! Super cool. I will treasure this always.
You are absolutely a divine send!!! Thank you soooo much!!!
Doe this also work in El Capitan?
Of course.
Works very nicely in Citrix where they have the copy/paste disabled and you really don’t want to type that whole stinking URL into MS Explorer just to use some web site that is non-standard.
Used this app and it typed directly to my Citrix window from the clipboard. Sweet!
Used LastPass this weekend to create really complex passwords for all my internet accounts, including Google Apps.
After restarting my computer, my local Google Drive.app asked for the new password.
Of course, I wasn’t able to just cut and paste this new incredibly complex password into the field in Google Drive.app.
I went on a hunt and found Force Paste:
https://dae.me/blog/1741/paste-text-even-when-prohibited-in-os-x-password-dialogs-etc/
It solved my problem immediately.
This is a fabulous little app. Thank you so much!
This is a very helpful and awesome tool.
I’m trying to paste a complex password that uses ‘ü’, but when I copy it and ForcePaste does its thing, it’s change to a regular ‘a’
Is there a work around for this?
Thanks, but I’m afraid this can’t be fixed easily. The problem lies in AppleScript’s “keystroke”, which only outputs characters immediately available on a typical English keyboard. It won’t type Russian letters either. I’m afraid I can’t do anything about that :/
Thank you so much. A great tool and saved me hours of work. Truly appreciated !
Dae
Love the App. I have a dialog that comes up every hour.. ask for my credentials, name & password… royal pain in the ass.
Anyway, is there a script/app to use a keyboard short cut that enters the cursor in the userName field, paste in the name, then goes on to the password field.. and past in the password from your script…then hits return…boy would that be nice!
Amazing app! Drag the Force Paste.app into your desktop dock and remember to use the shortcut: press command + V together, at the same time, to force paste to a secure login box. Highly recommended app for Mac OS X users!
Thank you so much for this! I need to work with a website of which the makers are under the illusion that pasting is “insecure” so they prefer the user to manually enter all info. This is a life saver.
Does not work osx 10.6.8
I don’t have any 10.6.8 systems at my disposal anymore, but I think it should work. What happens exactly when you click the app, it doesn’t start or it just doesn’t do anything? Can you open AppleScript Editor, copy/paste this code and click run?
I am not sure this is a place for all I know is the app crashes with the following report which I hope may help
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xfffffffffffffff8
Crashed Thread: Unknown
(remaining lines stripped by dae)
Thanks, Steve. I think if you manage compile it yourself on your system, it will work. Here’s how you can do this:
Step 1. Download the code and extract the contents of the archive into a folder on your Desktop called “Force-Paste-master”.
Step 2. Click the magnifying glass icon at the top-right corner of the screen to open spotlight search and use it to open Terminal.
Step 3. In Terminal, run the following command one after another:
cd ~/Desktop/Force-Paste-master/
chmod +x build.sh
./build.sh
If everything goes well, you’ll find the app in that directory on your Desktop.
I have been problems with OS X sierra crashing my copy and paste between apps. It only pastes in the same app it copied from. I thought I would give this a shot, and low and behold, when Sierra fails to paste, force paste actually works!~
Thanks.
Trying to change my remote management password but can’t get to paste. Just keeps the same old password no matter what. I moved to dock, tried script. Same result. Am I doing something wrong or is it still working for everyone?
OS Sierra, latest.
Thanks,
Chris
need it to paste the windows 8 password running in a virtual machine but isn’t working
Hi Dae,
Thank you very much for this tool which is currently a lifesaver for me and speeds up a very repetitive workflow.
I was wondering if it would be possible for me to add some basic text replacement functionality to the script?
The tool I use does not support OS X’s native text replacement, and I would like to accomplish something like that.
Example: copied text contains “cuz”, Force Paste corrects that and pastes “cause”.
It would be great if you could provide some insight on that.
Thanks in advance!
Hi Daniel – yes, of course. Clone the repo, open main.scpt in your favorite code editor, grab the code of findAndReplaceInText() function from here and use it on
input
variable, for example:In Terminal, cd to the working directory and run ./build.sh to build the app with your changes.
Perfect, thank you very much, I will play around with that!
Fantastic. I tried to add a delay of 50ms between each stroke (doing this over a VDI connection which misses key strokes if they’re too fast…) and save it as a .app, but this does not work. I suppose it’s not that simple to add 50ms to the .app version?
Use the build script from the GitHub repo to build an app.
Thanks Dae. I can’t edit main.scpt though (just wanted to add a single “delay 0.03” line), it throws “Error -1,752” when I try to save it, which seems to be related to this post:
https://apple.stackexchange.com/questions/215488/why-am-i-getting-error-1-752-when-trying-to-save-in-script-editor
I compiled in AppleScript first (clicking on the hammer), but that does not help either. I must be missing something basic…
Solved. It was staring me in the face. I save the main.scpt as main.applescript, then edited build.sh to use main.applescript rather than main.scpt and compiled. Thanks!
Nice! Did the delay solve the initial problem?
Yes, problem solved =)
Awesome little app! Thank you.
I’m trying to run this script on 10.12.6, and while I can build it, when I try to run it from the Finder I never see a dock icon. I can run it from the terminal (open “Force Paste.app”) but it only pastes into the terminal there, not into the password dialog I need it to paste into.
It won’t work from Finder because that would make your input field lose focus. Put it in the Dock or the Scripts menu and use it from there.
Oh, I see! Thanks, sorry, I’m kind of a Mac noob :). (I just started having to use it for work.)
No probs, good luck!
Thanks for this awesome tool…really saved lot of time for me and my team.
In the applescript you had provided, you had used set numbers_key_codes to {82, 83, 84, 85, 86, 87, 88, 89, 91, 92}
What is the logic behind using “key code” in the script, trying to understand…
These are the internal macOS key codes for numpad keys 0-9, see this.
It still works, and it works great! A real time and frustration saver! Thank you!
Wow thanks… works perfectly
Hi Dae. Can’t seem to get ForcePaste to work on Mojave. Getting this error even after dragging into to Privacy/Accessibility:
Force Paste is not allowed to send keystrokes.
System Events got an error: Force Paste is not allowed to send keystrokes. (1002)
I’m not advanced with script etc so that probably doesn’t help. Any fix would be much appreciated.
I have same issue. Any help? THX
I was experiencing the same issue after updating to the latest version of macOS Catalina (10.15.7). Force Paste had been working on my Catalina system previously.
The advice given on the bottom of the GitHub page regarding this issue is good, but I had to UNCHECK the box next to Force Paste.app in Privacy > Accessibility and CHECK it again.
If you insert
key code 36
as line 3 from bottom, the script will hit the enter button for you as well.
That is:
set numbers_key_codes to {82, 83, 84, 85, 86, 87, 88, 89, 91, 92}
set input to do shell script “pbpaste”
if (input is not missing value and length of input is less than 250) then
tell application “System Events”
repeat with char in the characters of input
try
key code numbers_key_codes’s item (char + 1)
on error
keystroke char
end try
end repeat
key code 36
end tell
end if
Force paste works about 99% of the time for me, but everyone once and awhile it will not paste the correct characters in. So for example if the password has an @ it will paste a 2, or if the password has a ! in it, it will put a 1. It also is not honoring capitalized letters either when it doesn’t honor the @ or !, any ideas as to what could be causing this?
Hi,
This little app is awesome but I’d like to ask is it possible to adjust the script that way that the app will paste every time the same key string (e.g. my very long password) whenever I press the app icon? At my work I’m using many applications and I have to type my password every time I’m logging in which is very time consuming. Now before I use Force Paste I have to copy my password from text file using CMD+C. I’d like Force Paste to remember my password all the time.
Thank you very much in advance for your help and feedback.
Hi Adam, here you go:
Change
mylongpassword
to whatever you want.Fork the repo from GitHub, replace the contents of main.scpt with the code above and run the build script.
Hi Dae,
thank you very much for your help. The script you’ve written above works fine and thanks to it I’m saving a lot of time now.
I tested another script which is working the same way:
on run {input, parameters}
tell application “System Events” to keystroke “mylongpassword”
return input
end run
I’ve used this app for a while, and really liked it. Thanks for writing it! I makes me feel like I’m doing my part to stick it to websites that think they know better than me. Petty of me! I digress…
So now I found a website that somehow in Safari has managed to block force paste! I am dismayed! Am I supposed to type gibberish characters in one by one? What are we, animals? :P
I’d forward the page, but it’s behind a pre-registration step and I can’t share the pre-registration details. Have you encountered anything like this in Safari before?
Note: I was able to force-paste in Chrome instead.
you think you can hack me wrong apple script editor virus are just a secret i’m from the B.EI
Thank-you so much!
Great tool, thank you!
sadly this wouldn’t work on big sur.. kept getting an error that said it wasn’t allowed to paste
Works fine in Big Sur if you follow the instructions:
https://github.com/EugeneDae/Force-Paste/issues/12#issuecomment-853273492
Thank you so much for creating this tiny bit of code.
I got it to run on macOS Mojave simply by hitting the + button in System Preferences – Accessibility and adding Force Paste to the list.
Very Grateful
John Martin
This was the first thing I read today in the morning. Thank you for your kind words.
thanks for this great script!
I have a problem with Hebrew , its paste “??????”
any chance to fix it?
Emailed you another version a few days ago.
Thanks. It works well but if I copy text with new lines, when I paste it ‘presses enter’ for each of those spots where the text ends before the new line. I want to just copy everything and paste everything without it pressing enter or thinking it needs to capture the enter key at all. How do I do this?
anyone else having problems pasting tabs?
up until right before i updated the macos on my mac with M1 chip to sonoma (14.1.1), force-paste was able to paste tabs. now that no longer works. the script seems to paste each character up until the first tab it encounters and then it aborts
I’m having this issue with tabs and spaces. It has rendered it unusable for me.
Dae, can you review my question?
I wanted to use Forcee Paste but my corporate settings on Sonoma are blocking it because it’s not signed.