Ask Your Question

Revision history [back]

You need to create a script in a directory called 'scripts' inside your user settings directory, which is listed 5th in Wing's About box.  Then add a *.py file there with the code, which would be something like: import wingapi def my_new_command(): # implementation here

Add this command to the editor context menu

my_new_command.contexts = [wingapi.kContextEditor()] ​ The first time it's added, you need to do Reload All Scripts in the Edit menu.  After that, Wing auto-reloads scripts if you edit them in Wing.  Output/errors are shown in the Messages tool under the Scripts channel.I'm not sure how you would implement showing the clipboard manager, but if there's a command line you can call to show it then it might be something like this in the body of the def: cmdline = 'clipman' cmd_id = wingapi.gApplication.AddOSCommand(cmdline, None, None, {}) wingapi.gApplication.ExecuteOSCommand(cmd_id)​ You can bind commands you add to Wing's command set with scripts like this by using the User Interface > Keyboard > Custom Key Bindings preference, same as for any other command.Scripting to extend Wing is documented here:  https://wingware.com/doc/scripting

click to hide/show revision 2
No.2 Revision

You need to create a script in a directory called 'scripts' inside your user settings directory, which is listed 5th in Wing's About box.  Then add a *.py file there with the code, which would be something like: like:

import wingapi
def my_new_command():
    # implementation here

here # Add this command to the editor context menu

menu my_new_command.contexts = [wingapi.kContextEditor()] ​

The first time it's added, you need to do Reload All Scripts in the Edit menu.  After that, Wing auto-reloads scripts if you edit them in Wing.  Output/errors are shown in the Messages tool under the Scripts channel.I'm not sure how you would implement showing the clipboard manager, but if there's a command line you can call to show it then it might be something like this in the body of the def: def:

cmdline = 'clipman'
cmd_id = wingapi.gApplication.AddOSCommand(cmdline, None, None, {})
wingapi.gApplication.ExecuteOSCommand(cmd_id)​
wingapi.gApplication.ExecuteOSCommand(cmd_id)

You can bind commands you add to Wing's command set with scripts like this by using the User Interface > Keyboard > Custom Key Bindings preference, same as for any other command.Scripting to extend Wing is documented here:  https://wingware.com/doc/scripting