[wingide-users] Filenames to clipboard

Mitchell L Model dev at software-concepts.org
Fri Sep 16 15:23:02 MDT 2011


> 
> Wing 4.0.4 will have a command copy-filename-to-clipboard.  Here is the 
> implementation which can be dropped into a script in earlier versions of 
> Wing:
> 
> import wingapi
> def copy_filename_to_clipboard(fn=wingapi.kArgFilename):
>  if fn:
>    wingapi.gApplication.SetClipboard(fn[0])
> 

Here's another version, which I think I've posted before:

def file_paths_to_clipboard():
   wingapi.gApplication.fSingletons.fGuiMgr.fClipboard\
       .set_text('\n'.join(wingapi.gApplication.GetCurrentFiles()))
file_paths_to_clipboard.contexts = [wingapi.kContextProject(), wingapi.kContextEditor(),]

This adds it to the contextual menu of editors and the project tool. In an editor, it will give you the full path to the file in the editor. In the project tool, it will give you the full paths of all selected files.



More information about the wingide-users mailing list