I found it. Here's how you can get the text of the minibuffer's line editor. What I don't know is whether it will still be there once your command starts executing. You can try that for yourself.
# type some text into the minibuffer before executing the following le = c.frame.top.lineEdit g.es(le.text()) On Monday, December 9, 2024 at 6:02:21 PM UTC-5 Thomas Passin wrote: > If you use Find/Replace, it picks up the arguments from the minibuffer the > same way. There's nothing to stop you from asking for an argument, > inputting all of them, and having your command extract them all. > > Hmm, I tried a command and added some text after its name in the > minibuffer after the command's name (I used vr3-show). The command > executed. Maybe your script could read the contents of the minibuffer, > move past the its own name, and get the args from the rest of the input. > You would have to find the widget name of the minibuffer single line edit. > I don't happen to know it. > > On Monday, December 9, 2024 at 5:38:01 PM UTC-5 jkn wrote: > >> Thanks for the pointer Thomas. >> >> That looks like not exactly what I am thinking of - it seems to be >> oriented towards "command<return>argument1<return>argument2<return>" in the >> minibuffer. I confess I have never used a Leo command that operates in that >> way! my loss, I am sure. >> >> I am thinking more of "command arg1 arg2 arg3<return>" - so >> 'non-interactive', perhaps. But perhaps the available mechanisms will >> provide that, Ii will have a read. >> >> Regards >> J^n >> >> >> On Monday, December 9, 2024 at 9:58:06 PM UTC [email protected] wrote: >> >>> There's a node in LeoDocs about getting arguments. Look for the >>> headline "Getting interactive input in scripts and commands". >>> >>> sys.argv will give you the arguments that the Python interpreter >>> received at startup. >>> >>> Another way I've passed arguments to a script is via the clipboard, but >>> of course you have to get them into the clipboard first. >>> >>> On Monday, December 9, 2024 at 4:36:37 PM UTC-5 jkn wrote: >>> >>>> I've been meaning to ask this for ever...Is there a way to pass >>>> argument(s) to leo @command-s? >>>> >>>> If I have a node like >>>> >>>> @command test_args >>>> import sys >>>> g.es(sys.argv)) >>>> >>>> and run "test_args 1 2 abcd" >>>> >>>> none of "1 2 abcd" get printed - only sys.argv from the initial >>>> invocation of Leo. >>>> >>>> is there a way for something like this to work? Apologies if it is >>>> already documented, I cannot find it. >>>> >>>> Thanks >>>> Jon N >>>> >>>> -- 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 view this discussion visit https://groups.google.com/d/msgid/leo-editor/806c8f95-0bed-42d6-bf3b-ca8ceb916f26n%40googlegroups.com.
