On 25 Feb 2016, at 21:19, Bill Cheeseman < email@hidden> wrote:
I’d rather keystroke the whole thing in (but it could be very big), is this a good idea?
In this connection, you should be aware that UI Browser, on the one hand, and System Events and GUI Scripting on the other, work differently with respect to the 'keystroke' command. I mention this just so you won't get confused if you try to test any of this in UI Browser.
Apple's Accessibility API contemplates that the function behind the 'keystroke' command will send one character per call. UI Browser does the same, because I wrote UI Browser primarily as a developer utility for other developers to make sure their applications comply with the Accessibility API.
However, the Apple engineer who authored the GUI Scripting aspect of System Events (the Process Suite) chose to make the GUI Scripting 'keystroke' command send multi-character text strings. I assume he simply called the function in a loop. When I was talking with him (many years ago), I neglected to ask him if there is a limit to the number of characters -- like 256, or 512, or whatever -- or if there are any performance bottlenecks with very long strings.
Perhaps Chris Nebel will spot this message and provide an answer. But, Dave, it would be easy enough to write a script to test it out.
I’ve done that already and it *seems* to work, but I’m not sure how long the field can get. I’ve added a switch to select which version to use, so its easier to switch back and forth, I as asking if it was wise to do so…. For instance the Script worked when run from the Script without the set frontmost to true, then Yvan explained why it was a good idea to include it…….
At this time we know very few details about the problem. 1 - we don't know what the clipboard may contain on entry. It's important because, if it contain text and/or pictures the scheme restoring it may work but if it contain file descriptors copied from the Finder it will not restaure the complete information.Shane Stanley explained that in details here some weeks ago.
2 - we don't know what is the target object. 3 - we don't know for sure if what is to be inserted is text only. In fact with the very late message speaking upon the use of keystroke to enter the datas it seems that it's really text.
Why use GUI Scripting to do that ? Isn't it a way to set the content of the target item with an instruction like : set contents of the target item to theDatas ?
It would be an alternative preserving the clipboard.
As I already wrote, I don't use/own Outlook so I can't make tests.
Yvan KOENIG running El Capitan 10.11.3 in French (VALLAURIS, France) vendredi 26 février 2016 12:40:34
|