Clip2Button

Title Clip2Button
File Name Clip2Button.txt
Description Paste the button image from the clipboard to the button edit dialog
Author Vochomurka
Parameters -
Plugins Called unicode, win, vec
Icon %WINDIR%\system32\shell32.dll, 261
Version 1.0
Updated on 20.08.17
local Buf = unicode.to_ascii(unicode.clip_get())

if(line(Buf, 1) != "TOTALCMD#BAR#DATA") do
	messagebox("ok error", "Clipboard does not contain the TC button bar image")
	quit
endif

local i, Field
local TBCD = win.handle("c=*BUTTONCHANGEDLG")
local Children = win.childhandlelist(TBCD, "c=TAltEdit")
local TAE = vec.createfromwords(Children)
local TBD = vec.createfromwords("5 4 6 3 2")

for(i = 0; i < TAE.length; i++)
	Field = line(Buf, TBD[i])
	win.settext(TAE[i], Field)
endfor

Comments

Script works (and has sense) only at meeting the following requirements:

  1. Button editing dialog is open. It can be done by executing the cm_ButtonConfig or cm_ButtonConfig2 commands (button bar editing), or by right-clicking the button bar and picking "Change..." (single button editing). Dialogs are different though very similar;

  2. The clipboard contais the button image got by right-clicking a button and picking "Copy".

It is easy to import the following command list into PowerPro. After that, if both requirements are met, in the right side of the dialog caption a small button appears. Its tooltip reminds about the button image in the clipboard. Pressing this button replaces the active button with that in the clipboard.


Main Page Total Commander PowerPro