maxedison maxedison - 3 months ago 27
AppleScript Question

Applescript for copying the current line of text?

I'd like to create an applescript that will copy the entire line that the carat is currently on. After doing a fair amount of googling, however, I have come up empty. Any ideas?

Answer
(*
Save this as an application
Right click the application and select "Show Package Contents"
Add this to Info.plist between <dict> and </dict>

<key>LSBackgroundOnly</key>
    <true/>

launch the application with spotlight (command space)
*)

tell application "System Events"
    key code 123 using {command down, shift down}
    key code 124 using {command down, shift down}
    keystroke "c" using {command down}
end tell