Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Action menu entry 'Run selected lines'?
-
How would one code a script that would work like the menu entry 'Run selected lines' in IEP when called as an action menu entry from the editor? All definitions made in the snippet should be referable in the console afterwards.
-
That's currently not possible because the console runs in a separate interpreter that isn't accessible from scripts that are run from the editor or action menu. That might change in a future release though.
-
Thanks for changing this in 1.4. The following simple action does now the trick:
# run selected lines import editor import console text = editor.get_text() selection = editor.get_line_selection() selected_text = text[selection[0]:selection[1]] exec selected_text in globals(), locals() console.hud_alert('finished','success',0.5)
-
Thanks, that script will be really useful for me!