Hadley,

Using AppleScript form Spark (http://shadowlab.free.fr/Creation/)  
works fine
(or from iKey previously).

I basically have 2 hot keys defined (F12/Selection2R and Shift-F12/ 
Src2R) with
below scripts:

tell application "SubEthaEdit"
     activate
end tell

tell application "System Events"
     tell process "SubEthaEdit"
         activate
         set frontmost to true
     end tell
     key down command
     keystroke "c"
     delay 1
     key up command
end tell

set y to the clipboard

tell application "R"
     cmd y
     activate
end tell

and

tell application "SubEthaEdit"
     activate
end tell
tell application "System Events"
     tell application "SubEthaEdit"
         tell window 1
             save
         end tell
         tell document 1
             set y to path
         end tell
     end tell
     tell application "R"
         cmd "source(\"" & y & "\")"
         activate
     end tell
end tell

Maybe it is the osascript side?

Rob


On Aug 20, 2005, at 9:34 AM, hadley wickham wrote:

> If you send a command to R with applescript you must move the mouse or
> push a key before command is run.
>
> To replicate:
>
>  * start with R closed
>  * on the command line, osascript -e 'tell application "R" to  
> activate'
>  * then osascript -e "tell application \"R\" to cmd \"print('hi')\""
>  * print('hi') doesn't appear until you move the mouse or press a key
>
> What should happen:
>
>  * print('hi') should appear immediately
>
> GUI version: Version 1.12 (1622)
>
> Hadley
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>


	[[alternative HTML version deleted]]

