Faking keypresses on Mac OS X

Ben Rubinstein benr_mc at cogapp.com
Wed Feb 27 14:59:19 EST 2008

On 27/2/08 18:42, Ian Wood wrote:
> On 27 Feb 2008, at 18:39, Ben Rubinstein wrote:
>> On 27/2/08 18:32, Jim Sims wrote:
>>> Might this work?
>>> Put the chars you want onto clipboard in Rev - use a suitable time 
>>> delay (send in...)
>>> the use an applescript which pastes into the topmost application.
>> An ingenious suggestion, which might indeed work for some apps; but 
>> not for a browser instance inside Rev.  Your suggestion did make me 
>> test what happened if my Rev app executed 'paste' while the focus was 
>> on a text field in the web page in the browser instance in the stack: 
>> the result was can't "paste (empty clipboard or locked destination)".
> He didn't mean use Rev's internal paste command, but to use AppleScript 
> to make the frontmost application (in this case Rev) paste.

Sadly, Rev doesn't actually honor the 'paste' applescript event - you can only 
have it execute a script, hence perform it's own paste command - which gets 
back to the problem noted before.

But, Jim Sim's suggestion of AppleScripting the "System Events" utility, which 
I didn't know about, works a treat - no need in fact for the clipboard at all, 
just use "key code X" directly for the character to be inserted.  Superb, 
thanks very much!

- Ben

More information about the Use-livecode mailing list