Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
25 changes: 15 additions & 10 deletions main.scpt
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
set numbers_key_codes to {82, 83, 84, 85, 86, 87, 88, 89, 91, 92}
set numbers_key_codes to {49, 50, 51, 52, 53, 54, 55, 56, 57, 48}

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
end tell
tell application "System Events"
repeat with char in the characters of input
set charIndex to offset of char in "0123456789 " -- Get index within number string
if charIndex is not 0 then -- Check if it's a number or space
try
key code numbers_key_codes's item charIndex -- Use correct index for key code
on error
keystroke char -- Fallback to keystroke for non-numbers
end try
else
keystroke space -- Handle space explicitly
end if
end repeat
end tell
end if