AppleScript commands don't execute until mouse over console window (PR#8405)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

AppleScript commands don't execute until mouse over console window (PR#8405)

Jonathan Paisley-2
Full_Name: Jonathan Paisley
Version: 2.2.0
OS: Mac OS X 10.4.3
Submission from: (NULL) (81.178.69.159)


I am sending commands to R via AppleScript (specifically, from SubEthaEdit to
instruct it to source the file I'm currently editing). R doesn't respond tothe
AppleScript until I move the mouse over R's console window.

The following patch to the Mac GUI (against current svn trunk) resolves the
problem, by posting a dummy event to wake up the event queue after the command
has been stuffed into the input buffer.

--- RController.m (revision 2076)
+++ RController.m (working copy)
@@ -1104,7 +1104,18 @@
 The input replaces what the user is currently typing.
 */
 - (void) sendInput: (NSString*) text {
+ NSPoint null = {0,0};
  [self consoleInput:text interactive:YES];
+     [NSApp postEvent:[NSEvent otherEventWithType: NSApplicationDefined
+                                            location: null
+                                       modifierFlags: 0
+                                           timestamp: 0
+                                        windowNumber: 0
+                                             context: NULL
+                                             subtype: 0
+                                               data1: 0
+                                               data2: 0
+            ] atStart: YES];
  /*
  unsigned textLength = [[RTextView textStorage] length];
  [RTextView setSelectedRange:NSMakeRange(textLength, 0)];

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: AppleScript commands don't execute until mouse over console window (PR#8405)

Simon Urbanek
Thanks, Jonathan! I have now committed a slight variation of your  
patch in the current Mac-GUI.

Cheers,
Simon

On Dec 16, 2005, at 7:30 AM, [hidden email] wrote:

> I am sending commands to R via AppleScript (specifically, from  
> SubEthaEdit to instruct it to source the file I'm currently  
> editing). R doesn't respond to the AppleScript until I move the  
> mouse over R's console window.
>
> The following patch to the Mac GUI (against current svn trunk)  
> resolves the problem, by posting a dummy event to wake up the event  
> queue after the command has been stuffed into the input buffer.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel