[R-SIG-Mac] Applescript window selection question
Rob Goedman
goedman at mac.com
Sun Jan 20 22:35:06 CET 2008
Hi Mandy,
It's a while since I played around with Smultron.
Command-B in Smultron opens the Commands pane. There are some examples
of commands available. If you define a new command collection, e.g. R,
a command
name, e.g. 'Source file', and place in the command window (lower half
of right side
of the Commands pane):
#!/bin/bash
osascript -e 'tell application "R.app" to activate'
osascript -e "tell application \"R.app\" to cmd \"source(file="%%p",
print.eval=TRUE)\""
R should start and the current file (%%p) passed to R.
You can select 'Inline' and define a shortcut, e.g. Command-R in
Smultron's Commands pane.
I expect someone who knows osascript well can do much better, e.g. if
the file path
contains blanks, etc. But this might get you going.
Rob
On Jan 17, 2008, at 8:25 AM, Mandy Ng wrote:
> hiya,
>
> I saw your reply from R-SIG-Mac for question of applescript window.
> You wrote:
>
> John,
>
> In textmate, below line is used:
>
> osascript -e 'tell application "R.app" to activate' -e "tell
> application \"R.app\" to cmd \"source(file='$TM_FILEPATH',
> print.eval=TRUE)\""
>
> I used similar constructs for SubEthaEdit and Smultron in AppleScript.
>
> Try using tell **application**.
>
> Rob
>
> ===========================================================
>
> Can I ask you how to redirect the R routines within smultran to run on
> R? I believe an applescript can help but I'm fairly new to
> applescript and smultran, and have no idea where to start.
>
> Thanks very much in advance.
>
> Cheers,
> Mandy
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
More information about the R-SIG-Mac
mailing list