Pastes clipboard data into the current active window by emulating actual keypresses (using PyAutoGUI).
Assumes US Keyboard layout.
- Python 3 (for typepaste.py, base32e.py)
- Python 2 (for base32lcd.py -- target environment assumed to have older Python)
- pip
- virtualenv
-
Clone the repository.
-
Create a virutalenv named
venv
in the folder:virtualenv venv
-
Activate virtualenv and install dependencies:
. venv/bin/activate pip install -r requirements.txt
-
Edit
typepaste.applescript
and setLOCATION
to where the TypePaste repo was checked out:do shell script "/bin/bash -s <<'EOF' LOCATION=~/Projects/typepaste/ . ${LOCATION}/venv/bin/activate && ${LOCATION}/typepaste.py --batch-size 10 EOF"
Repeat for
*.applescript
. You can also increase the number of characters printed at once via adjusting--batch-size 10
. -
Open
typepaste.applescript
in Mac OS Script Editor and inPreferences
tickShow script menu in menu bar
. -
In Menu bar click
Open Scripts Folder
->Open User Scripts Folder
and copy*.applescript
there.
You can run TypePaste from the menu bar.
Move mouse cursor to top left corner of the screen to abort typepasting.
For larger files you might want to split the file into smaller chunks (see B. and C.).
- Open a text editor with a new empty file.
- Start the script. It opens a file selector window to pick a file. Pick a file.
- Next it displays a dialog that after clicking continue it will wait for 3 seconds, so you have time to make the window active you want to paste. Click continue.
- Make the window active you want to paste to.
- FAILSAFE: Remember, moving the mouse pointer to the upper left corner of the screen will terminate pasting.
- Save the file and quit the editor.
- Use
base32lcd.py
(or its content, main part is 2 lines, plus 2 lines of imports) to decode the file.
- Copy file contents to clipboard.
- Use the
typepaste-base32.applescript
or if you are a bit more paranoid thetypepaste-base32-lowercase.applescript
script to paste the data as base32 encoded string. - Use the provided
base32lcd.py
or any other base32 decoder to decode the contents. For other decoders make sure all characters are uppercase and remove white space.
- Create an archive (e.g., tar.gz).
- Base32 encode the archive, e.g., by using the provided
base32e.py
. - Use split to split the files, e.g.,
split -b 2000 files.tar.gz.b32
. - Copy contents to clipboard, e.g.,
cat xaa | pbcopy
. - Use
typepaste.applescript
to copy to the end of an open file at the destination. - Repeat for all parts (e.g.,
xaa
,xab
,xac
,...). - Base32 decode the resulting file (e.g., with the provided
base32lcd.py
). - Extract the archive.
-
Check target content for invalid characters:
cat files.tar.gz.b32 | sed 's/[0-9A-Z=]//g'
or if the file was created with lowercased data:
cat files.tar.gz.b32 | sed 's/[0-9a-z=]//g'