On Wed, 25 Jun 2014 12:17:40 -0700 (PDT)
Fidel N <[email protected]> wrote:
> Haha thanks for the suggestion Terry.
>
> Yes, AHK stands for AutoHotkey, a windows automation system.
>
> And the main thing is its the other way around. AHK sniffs around my
> actions, then points to Leo commands to complete them.
> So if I want to add my selected text (outside Leo) as a child of
> currently Leo selected node, AHK helps me call a command in Leo.
Hmm, I'd probably use a Leo button,
import time
from PyQt4 import QtGui
cb = QtGui.QApplication.clipboard()
text = cb.text(mode=cb.Selection)
nd = p.insertAfter()
nd.h = text[:12]
nd.b = "{text}\n\n# copied {time}".format(text=text, time=time.asctime())
c.redraw()
Put that on a button and it will suck in the text selected in another
app. as long as Qt and the other app. are doing things the same way,
OpenOffice with it's java world view etc. might not cooperate, haven't
tried.
Use `mode=cb.Clipboard` to get text actually copied in the other app.
and not just selected.
Apologies to Edward for making it qt4 specific, I think his recent work
makes it easy to write code that works with qt4 and qt5.
If your use case means you don't want to find and click on the Leo
window, I'd either use leoserver or mod_http (plugins), both of which
allow you to communicate remotely with a running Leo, but you'd have to
do something to invoke a command to send the data.
Cheers -Terry
> Therefore, I still must find a way of
>
> If there is no way of calling scripts in Leo in a 'command line'
> fashion, I guess I will do this through clipboard... hell actually im
> going to do it that way:
>
> AHK will send to clipboard the following:
>
> Leo Command
> g.es('hello')
>
> Then I will have a command in Leo that will be:
>
> #ahk-run-clipboard
> commands = c.gui.getTextFromClipboard()
>
> commands_list = commands.splitlines()
> commands_list.pop(0)
> commands = commands_list.join('\n')
> exec(commands)
>
> Not very computer-literate but will do the job, unless anyone points
> out any other way hehe.
>
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.