Type text command

Hi people

I need to perform a Copy command in AS.
simple? - not so if it is for Freehand, there the simple “copy” will couse an error if i try to copy fue text boxes.
so I need an edition so I can make it do the “c”+Command key combination ander OS X.

thank you all

Hi Yarnin,

All my OS9 scripts broke that used Typetext too - here is what you need to do to invoke shortcuts for FreeHand, (or any other frontmost application for that matter)…

tell application "System Events"
	keystroke "c" using command down
end tell

And, here’s a simple handler I wrote for using the keystroke command with or without modifiers. Enjoy!

my typeset("c", command down)
--possible modifiers
--->option down
--->control down
--->shift down
--->command down
(*the syntax for using more than one modifier took some work to figure out - for me anyway - Here that is:

keystroke "c" using shift down & command down
*)

on typeset(strPayload, strModifier)
	set intCharCount to count characters of strPayload
	tell application "System Events"
		repeat with q from 1 to intCharCount
			if strModifier != "" then --hold down a modifiers?
				keystroke ((item q of strPayload) as string) using strModifier
			else --or just type something?
				keystroke ((item q of strPayload) as string)
			end if
		end repeat
	end tell
end typeset

Hope this helps