Skip to content

Instantly share code, notes, and snippets.

@jiyeonseo
Created December 29, 2019 04:55
Show Gist options
  • Save jiyeonseo/895023ea4ac94ed64c9359bdd2fd76b7 to your computer and use it in GitHub Desktop.
Save jiyeonseo/895023ea4ac94ed64c9359bdd2fd76b7 to your computer and use it in GitHub Desktop.
set srcFile to ((path to desktop) as text) & "dialog.txt"
set lns to paragraphs of (read file srcFile as «class utf8»)
repeat with ln in lns
my stringToClipboard(ln)
tell application "KakaoTalk" to activate
tell application "System Events"
keystroke "v" using command down
key code 36
delay 1.5
end tell
end repeat
on stringToClipboard(t1)
do shell script "/usr/bin/python -c 'import sys;from AppKit import NSPasteboard, NSPasteboardTypeString; cb=NSPasteboard.generalPasteboard();cb.declareTypes_owner_([NSPasteboardTypeString], None);cb.setString_forType_(sys.argv[1].decode(\"utf8\"), NSPasteboardTypeString)' " & quoted form of t1
end stringToClipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment