wiki:CopyPageName
# -*- coding: utf-8 -*-

# copyPageName.py
# Copies the name of the current page to the clipboard.
# The keybindung as it is now in code (Ctrl-t) will only work if you put
# ShowTreeControl=""
# into your KeyBindings.py, because otherwise ShowTreeControls lives on that key. 
# Or change the "Ctrl-t" in the code.

import re

WIKIDPAD_PLUGIN = (("MenuFunctions",1),)

def describeMenuItems(wiki):
	global nextNumber
	return ((copyPageName, "copyPageName\tCtrl-t", "copyPageName"),)

def copyPageName(wiki, evt):
	editor=wiki.getActiveEditor()
	beginSel=editor.GetSelectionStart()
	endSel=editor.GetSelectionEnd()

	#select nothing:
	editor.SetSelectionStart(endSel)

	editor.AddText(wiki.getCurrentWikiWord())
	editor.SetSelectionStart(endSel)
	editor.Cut()

	editor.SetSelectionStart(beginSel)
	editor.SetSelectionEnd(endSel)

Last modified 5 years ago Last modified on May 18, 2012 4:38:42 PM