> On Aug 05, 2021, at 05:15, Rainer Krug <[email protected]> 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.
Hey Rainer,
You can do something like this.
--
Best Regards,
Chris
tell application "BBEdit"
set startLineNum to startLine of selection
set selectedText to selection's contents
if selectedText is "" then
try
set selectedText to contents of line startLineNum of front document
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 "BBEdit"
activate
tell front document
try
select insertion point before line (startLineNum + 1)
on error
select insertion point after line startLineNum
end try
end tell
end tell
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" rather than
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/2396E259-9608-4CEA-B626-EC8E0FAB4E88%40gmail.com.