06-30-2021 10:38 AM
Hi All,
I've been enjoying learning about VI scripting and have a found some ways to automate some tedious tasks with it. One thing I would like to do with the VI scripts I have created, is to run them on the VI that I'm currently editing.
For instance I have this script that wires multiple outputs from one node to multiple inputs of another node.
It currently works by first selecting the two nodes on the VI I want to edit, then opening up the VI script, selecting the file path to the VI I want to edit, then running the VI script.
Ideally I would like to just stay in the window of the VI I'm editing, select the two nodes, hit a button or shortcut, and have the script do its job on the VI that I'm editing.
Does anyone know if this is possible somehow?
FYI here's a snippet of my script code just for reference.
Thank you,
John
06-30-2021 10:51 AM
I'd suggest implementing your scripting as a Quick Drop Keyboard Shortcut or Right-Click Menu Plugin.
Here's a presentation I frequently give on all the ways to hook into the LabVIEW editor for your own features. There are links to pages that can explain how to implement a Quick Drop Keyboard Shortcut, Right-Click Plugin, or any other hook you decide to use for your scripting.
Good luck!
06-30-2021 10:53 AM
Place your tool in
C:\ ... \LabVIEW xxxx\project\
or
C:\ ... \LabVIEW xxxx\project\<my menu name>\
in your tool use this to open a reference to the active VI.
Invoke your tool from the LabVIEW menu:
Tools → my tool name
or
Tools → <my menu name> → my tool name
06-30-2021 11:58 AM
Paul,
I tried setting this up following your advice, however when I select my tool from the menu, it just opens the front panel to my tool and does nothing. It doesn't attempt to run my script VI.
Any idea what I'm doing wrong?
06-30-2021 12:00 PM
Forgive me if I'm telling you something you already know, but from what you've described, just highlighting the nodes and doing CTRL+Space, CTRL+W does exactly that. If you have a setup like shown, that's all you have to do to quickly wire every output to every input. It also works if your highlighted output nodes are tunnels from a structure, but unfortunately it looks pretty funky.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
06-30-2021 12:23 PM
@JohnMaldonado wrote:
...when I select my tool from the menu, it just opens the front panel to my tool and does nothing. It doesn't attempt to run my script VI.
I think you need to set the VI that you launch from the Tools menu to 'Run When Opened' in VI Properties > Execution.
06-30-2021 12:24 PM
@FireFist-Redhawk wrote:
It also works if your highlighted output nodes are tunnels from a structure, but unfortunately it looks pretty funky.
I'm guessing you're using an older LabVIEW version. In a recent release (2019? 2020?) we updated the Ctrl-Space, Ctrl-W shortcut to perform a cleanup on all scripted wires.