[R] R-/Text-editor for Windows?

Jonathan P Daily jdaily at usgs.gov
Mon Jan 31 14:59:29 CET 2011


Well, AutoHotKey [1] is a free program/scripting language that runs 
scripts to perform basic window handling, file I/O, and program execution. 
It also allows you to bind the running of these scripts to keys or 
mouse-strokes with the option of making each window-specific. NppToR is 
actually a compiled AutoHotKey script designed to do Notepad++ specific 
things. For example, one of my generic, slower, user-unfriendly scripts 
is:

TestConsole()
{
        IfWinNotExist, ahk_class Console_2_Main,
        {
                Run, C:\Documents and Settings\jdaily\Console2\Console.exe 
-t R
                WinWait, ahk_class Console_2_Main,
        }
}

ActivateConsole()
{
        TestConsole()
        WinActivate, ahk_class Console_2_Main,
        WinWaitActive, ahk_class Console_2_Main,
}

#1::
WinGetActiveTitle, editor
old_clipboard = %clipboard%
Send, {CTRLDOWN}c{CTRLUP}
ActivateConsole()
Send, {CTRLDOWN}{END}{CTRLUP}{RETURN}
WinActivate, %editor%,
clipboard = %old_clipboard%
return

What it does when I press the Super+1 is assign the current window to a 
variable "editor", backup my current clipboard, and copy my highlighted 
text. Then it checks to see if Console [2] is active and opens console 
with R if not open. It pastes the copied text and reactivates "editor", 
restoring my old clipboard. Its nice because it works whether I'm in 
Geany, Notepad, MSword, etc., but I didn't bother doing any checking to 
make sure console's active tab is R. This could easily be solved if you 
just use RTerm/RGui by replacing all the instances of Console with the 
appropriate R executable.

[1]www.autohotkey.com
[2]sourceforge.net/projects/console
--------------------------------------
Jonathan P. Daily
Technician - USGS Leetown Science Center
11649 Leetown Road
Kearneysville WV, 25430
(304) 724-4480
"Is the room still a room when its empty? Does the room,
 the thing itself have purpose? Or do we, what's the word... imbue it."
     - Jubal Early, Firefly

Liviu Andronic <landronimirc at gmail.com> wrote on 01/29/2011 04:08:46 AM:

> [image removed] 
> 
> Re: [R] R-/Text-editor for Windows?
> 
> Liviu Andronic 
> 
> to:
> 
> Jonathan P Daily
> 
> 01/29/2011 04:09 AM
> 
> Cc:
> 
> Sascha Vieweg, r-help, r-help-bounces
> 
> Hello
> 
> On Fri, Jan 28, 2011 at 8:03 PM, Jonathan P Daily <jdaily at usgs.gov> 
wrote:
> > Geany also handles a ton of filetypes, but lacks a direct interface to 
R
> > in the windows version - I wrote an AutoHotKey script that did this 
for me
> > in about 5 minutes.
> >
> Could you please expand on that? I prefer to use Geany when working on
> Linux, but I always found it annoying the Windows limitation.
> 
> Thank you
> Liviu



More information about the R-help mailing list