Getting the selected text in the frontmost application?

Hi

How would I do that?

I’m launching my script using an iKey shortcut, if that makes any difference.

Thanks!

Hi,

try this


try
	tell application "System Events"
		tell process (get 1st process whose frontmost is true)
			keystroke "c" using command down
		end tell
	end tell
	delay 0.5
	set t to (Unicode text of (get the clipboard as record))
end try