Create macos-type-clipboard.md

This commit is contained in:
Michael
2022-09-20 16:50:55 +01:00
committed by GitHub
parent d68fd88f5d
commit 4c1cdd9075

35
macos-type-clipboard.md Normal file
View File

@@ -0,0 +1,35 @@
# MOSYLE BASIC ENROLLMENT SCRIPT
##### LINK TO SHORTCUT FOR MONTEREY
[https://github.com/PurpleComputing/mdmscripts/raw/main/Helpers/Type%20Clipboard.shortcut](https://github.com/PurpleComputing/mdmscripts/raw/main/Helpers/Type%20Clipboard.shortcut)
##### PPPC Permissions
The below permissions should be requested on first use, head to System Preferences > Security & Privacy > Privacy > Accessibility and tick the boxes to grant permissions.
Accessibility > Shortcuts
Accessibility > siriactionsd
### SCRIPT
```
on run
tell application "System Events"
delay 2 # DELAY BEFORE BEGINNING KEYPRESSES IN SECONDS
repeat with char in (the clipboard)
set cID to id of char
if ((cID ≥ 48) and (cID ≤ 57)) then
# Converts numbers to ANSI_# characters rather than ANSI_Keypad# characters
# https://apple.stackexchange.com/a/227940
key code {item (cID - 47) of {29, 18, 19, 20, 21, 23, 22, 26, 28, 25}}
else if (cID = 46) then
# Fix VMware Fusion period bug
# https://apple.stackexchange.com/a/331574
key code 47
else
keystroke char
end if
delay 0.5 # DELAY BETWEEEN EACH KEYPRESS IN SECONDS
end repeat
end tell
```