I’m sorry if this question has been asked before, but I have not been able to find anything related.
I want to port a script used under OS8/9 to OSX. Unfortunately, my script relies on typetext from Sani’s additions. Is something similar available under OS X? I looked at the GUI scripting but that looks a bit elaborate/complicated for my purposes, as all I need to do is type some text into the active window.
Thanks,
Daniel
Edit: to elaborate on this slightly. I am trying to script a window of a command line driven application. Trying to script the GUI of the application isn’t feasible, as the runtime of the application is highly variable,and I need to save the application once it is done running. If I can just type text into the command line (which is the active window), I’m ok…
There is a product called Extra Suites (http://www.kanzu.com/) that has a command called “type string”, which works just like TypeText. Extra Suites is somewhat donationware. It has a floating window that shows up until you register. Rather than being a scripting addition its actually implemented as an application. The one annoying thing (whether registered or not) is that there doesn’t seem to be a way to quit the app. So I usually end up killing it through the terminal when I’m done with it. Well worth the $10 registration, by the way!
Ok, I checked out extra suites, and it appears to do what I want, except I haven’t figured out how to make it type ‘inverted commas’ (“). 'Type string “””’ doesn’t work, nor does ‘type string (ASCII character 34)’. I’m sure there must be a way, but I can’t figure out how to do it (and unfortunately, there is little documentation…)
There seems to be a bug concerning the " character.
set string_ to """
--> "
tell application "TextEdit" to activate
tell application "Extra Suites" to type string string_
--> Extra Suites got an error: """ doesn't understand the type string message.
But the command does work with other text.
set string_ to "It worked!"
tell application "TextEdit" to activate
tell application "Extra Suites" to type string string_
If you have Apple’s UI scripting software installed, this appears to work.
tell application "TextEdit" to activate
tell application "System Events" to keystroke """