tell application "BBEdit"
set the_selection to (selection of front window as string)
if (the_selection) is "" then
try
set the_selection to line (get startLine of selection) of front window as string
on error
display dialog "The active window must be an editor window, with a file opened. You want to run something in R? Well, tell me what!" with icon note buttons {"Got it!"} default button 1
error number -128
end try
end if
end tell
tell application "R"
cmd the_selection
end tell
tell application "System Events"
tell process "BBEdit"
set frontmost to true
end tell
end tell
Now I would like to set the cursor in BBEDit to the next line after the selected text ore line it is in.On Aug 05, 2021, at 05:15, Rainer Krug <Rai...@krugs.de> wrote:
I have the following AppleScript to execute het selected text in R and return the focus to BBEdit:
...
Now I would like to set the cursor in BBEDit to the next line after the selected text ore line it is in.