mirror of
https://github.com/PurpleComputing/helpful-scripts.git
synced 2026-02-03 13:53:24 +00:00
Create macos-type-clipboard.md
This commit is contained in:
35
macos-type-clipboard.md
Normal file
35
macos-type-clipboard.md
Normal 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
|
||||
```
|
||||
Reference in New Issue
Block a user