Jump to content
Developer Wiki and Function Reference Links ×

External Python Scripts


Gonda

Recommended Posts

Hi All,

So, I know it's possible to run external Python Scripts via the "Run Script..." menu item, but I was wondering if there is any way to add a menu item to a menu that is linked to an external script (ie, not having to manually select the script to run everytime). This is mostly a function of that fact that the built in editor in VW is pretty crap for Python and it's frustrating to be trying to write/debug a script and the have to constantly be going through a number of windows just to get to the editor and then backing out of said windows to run the script...

Thanks,

-j

Link to comment

I could be misunderstanding the sample, but it sounds like the plug-in is locked in to running only a file called '_main.py' and since it says to just dump it in the Plug-in's folder, this effectively means that there can only be one copy of it so it wouldn't really work for managing multiple added commands. I figured there would be an easy solution to this since VW seems to already be able to run scripts located anywhere on the HD from the 'Run Script...' command....

-g

Link to comment
Guest Jim Kelly

Well you can call any other python from _main.py, although I do think you can also modify what gets called, based on my reading of the xml and other included files.

It's not really clear to me how it is you are supposed to make multiple menu commands, or even your own from this example. I guess it would involve making your own vsm file.

I'd probably resolve this by creating a dialog from this plug-in that allows for quick selection of some subset of available scripts either defined by a search or being in a special folder or something.

Link to comment

I can, but it still seems that I would need a different _main.py for each script/command I would want since I would have to alter _main.py for each. I could do the dialog thing, but I was really hoping to be able to build a bunch of scripts that could be activated via key commands...

Guess I'll just have to get back to trying some way to hack around the system...

Thanks

Link to comment
Guest Jim Kelly

You wouldn't necessarily need a different main for each - just import your script based on a variable that is from the selection in the dialog.

If you really wanted to do the one plug-in per script, I suppose that might be possible, but you'd have to figure out how the vsm file is differentiated. Unfortunately I don't know much about how that end of things works at the moment, although I'll probably be learning more in the near future for a project. If I remember, I'll try to come back here and update with anything I find out.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...