Auxiliary Scripts

The peculiarity of these scripts is that they are called from other scripts rather than directly. In programming such modules are determined as "procedures", "functions", or "subroutines". Unlike usual scripts that must be stored in the scripts subfolder, auxiliary scripts can be stored anywhere, and they paths are explicitly indicated in the calling script code. I created the Subs subfolder in the scripts folder, and named all auxiliary scripts as Sub_ScriptName.txt. If you decide to change this name by some reason, do not forget to change its name in the calling script code, too.


ReadTabs

File Name Sub_ReadTabs.txt
Author Vochomurka
Plugin Called ini
Version 1.2
Updated on 24.06.2008
ReadTabs
DebugCL
ParsePath
TreeDownCmd
TreeUpCmd
LowestDirCmd
MoveFile
Descript_ion
TMTC
Progress
Spin
BarName

args Single 
static Icons = "path_to_icons\TT.icl"

local Keys, Temp, i, Values, Tube, FT, BT
local Section = Single ++ "tabs"

local Path = ini.get(Config, Single, "path")
local Number = TT.Length
local Panel = ifelse(Single == "left", 1, 2)

if(ini.check_exists(TW, "FontColor", "Target") == 3)
	FT = ini.get(TW, "FontColor", "Target")

if(ini.check_exists(TW, "BackColor", "Target") == 3)
	BT = ini.get(TW, "BackColor", "Target")

if(ini.check_exists(Config, Section) != 2) do
	TT.Insert(Number)
	TT.AddLeft(Number, 0)
	TT.AddMiddle(Number, Panel)
	TT.SetIconVisible(Number, 0)
	TT.SetLeftOnTop(Number, 1)
	TT.SetTextColor(Number, FT)
	TT.SetBackColor(Number, BT)
	TT.SetId(Number, Path)
	quit(1)
endif

Keys = ini.enum_keys(Config, Section)
Number = line(Keys, 0)

if(Number < 4 && ini.check_exists(Config, Section, "activelocked") == 3) do
	Number = TT.Length()
	TT.Insert(Number)
	TT.AddLeft(Number, 0)
	TT.AddMiddle(Number, Panel)
	TT.SetIcon(Number, Icons, ini.get(Config, Section, "activelocked"))
	if(ini.check_exists(Config, Section, "activecaption") == 3)
		TT.SetToolTip(Number, ini.get(Config, Section, "activecaption"))

	TT.SetLeftOnTop(Number, 1)
	TT.SetTextColor(Number, FT)
	TT.SetBackColor(Number, BT)
	TT.SetId(Number, Path)
	quit(1)
endif

for(i = 1; i < Number; i++)
	Temp = i ++ "_path"
	if(ini.check_exists(Config, Section, Temp) != 3) do
		Values = i + 1
		break
	endif
endfor

Number = ini.get(Config, Section, "activetab")
flag clear 1
local Start = TT.Length
local End = Values + Start

for(i = Start; i < End; i++)
	TT.Insert(i)
	TT.AddLeft(i, i - Start)
	TT.AddMiddle(i, Panel)
	if(i - Start == Number) do				;;active tab is reached
		TT.SetId(i, Path)
		flag set 1
		Temp = 0
		if(ini.check_exists(Config, Section, "activelocked") == 3)
			Temp = ini.get(Config, Section, "activelocked")

		TT.SetIcon(i, Icons, Temp)
		TT.SetLeftOnTop(i, 1)
		TT.SetTextColor(i, FT)
		TT.SetBackColor(i, BT)
		if(ini.check_exists(Config, Section, "activecaption") == 3)
			TT.SetTooltip(i, ini.get(Config, Section, "activecaption"), Number)

	else
		Key = i - pproflag(1) - Start
		Temp = Key ++ "_path"
		Temp = ini.get(Config, Section, Temp)
		TT.SetId(i, Temp)
		Temp = Key ++ "_options"
		Temp = ini.get(Config, Section, Temp)
		Tube = word(Temp, 6, "|")
		TT.SetIcon(i, Icons, Tube)
		Temp = Key ++ "_caption"
		if(ini.check_exists(Config, Section, Temp) == 3)
			TT.SetTooltip(i, ini.get(Config, Section, Temp), i - Start)

	endif
endfor
quit(Values)

DebugCL

File Name Sub_DebugCL.txt
Author Vochomurka
Plugin Called -
Version 1.2
Updated on 06.04.2006
local List = arg(1)
local CR = esc(?+\n+, ?+\+)
local Check, Temp, Cap, Mess

if(cl.Exists(List) != 1) do
	messagebox("ok", "Command List '" ++ List ++ "' does not exist", "CL error")
	quit all
endif

local Number = cl.Length(List)

Cap = "Command List '" ++ List ++ "' has " ++ Number ++ " entries"
Mess = "Command List info:" ++ CR

Temp = cl.GetBackColor(List)
if(Temp != "")
	Mess = Mess ++ CR ++ "Background color: " ++ Temp 

Temp = cl.GetBackground(List)
if(Temp != "")
	Mess = Mess ++ CR ++ "Background file: " ++ Temp 

Temp = cl.GetTextColor(List)
if(Temp != "")
	Mess = Mess ++ CR ++ "Text color: " ++ Temp

Mess = Mess ++ CR ++ "Hide interval: " ++ cl.GetHideAfter(List)
Mess = Mess ++ CR ++ "Maximum text length: " ++ cl.GetMaxtext(List)

Temp = cl.GetLastBar()
if(Temp != "") do
	Mess = Mess ++ CR ++ "Name of bar with last button pressed: '" ++ Temp ++ "'"
	Mess = Mess ++ CR ++ "Last pressed button on bar '" ++ Temp ++ "': "
	Mess = Mess ++ cl.GetLastPressed(Temp) ++ CR ++ "Last mouse button on bar '"
	Mess = Mess ++ Temp ++ "': " ++ cl.GetLastMouse (Temp)
endif

if(messagebox("okcancel information", Mess, Cap) == 0)
	quit all

Mess = ""

for(i = 0; i < Number; i = i + 1)
	for(j = 1; 1; j = j + 1)
		Check = Mess
		Cap = "Entry #" ++ i ++ " of " ++ Number - 1

		Temp = cl.GetLeftCmd(List, i, j)
		if(Temp != "")
			Mess = Mess ++ CR ++ "Left Command #" ++ j ++ ": '" ++ Temp ++ "'"

		Temp = cl.GetRightCmd(List, i, j)
		if(Temp != "")
			Mess = Mess ++ CR ++ "Right Command #" ++ j ++ ": '" ++ Temp ++ "'"

		Temp = cl.GetMiddleCmd(List, i, j)
		if(Temp != "")
			Mess = Mess ++ CR ++ "Middle Command #" ++ j ++ ": '" ++ Temp ++ "'"

		Temp = cl.GetLeftParam(List, i, j)
		if(Temp != "")
			Mess = Mess ++ CR ++ "Left Parameter #" ++ j ++ ": '" ++ Temp ++ "'"

		Temp = cl.GetRightParam(List, i, j)
		if(Temp != "")
			Mess = Mess ++ CR ++ "Right Parameter #" ++ j ++ ": '" ++ Temp ++ "'"

		Temp = cl.GetMiddleParam(List, i, j)
		if(Temp != "")
			Mess = Mess ++ CR ++ "Middle Parameter #" ++ j ++ ": '" ++ Temp ++ "'"

		Temp = cl.GetLeftWork(List, i, j)
		if(Temp != "")
			Mess = Mess ++ CR ++ "Left work dir #" ++ j ++ ": '" ++ Temp ++ "'"

		Temp = cl.GetRightWork(List, i, j)
		if(Temp != "")
			Mess = Mess ++ CR ++ "Right work dir #" ++ j ++ ": '" ++ Temp ++ "'"

		Temp = cl.GetMiddleWork(List, i, j)
		if(Temp != "")
			Mess = Mess ++ CR ++ "Middle work dir #" ++ j ++ ": '" ++ Temp ++ "'"

		Temp = cl.GetLeftHow(List, i, j)
		if(Temp != "normal")
			Mess = Mess ++ CR ++ "Left how start #" ++ j ++ ": '" ++ Temp ++ "'"

		Temp = cl.GetRightHow(List, i, j)
		if(Temp != "normal")
			Mess = Mess ++ CR ++ "Right how start #" ++ j ++ ": '" ++ Temp ++ "'"

		Temp = cl.GetMiddleHow(List, i, j)
		if(Temp != "normal")
			Mess = Mess ++ CR ++ "Middle how start #" ++ j ++ ": '" ++ Temp ++ "'"

		if(Check == Mess)
			break

	endfor

	Mess = Mess ++ CR ++ CR ++ "Left ontop checkbox is "
	Mess = Mess ++ ifelse(cl.GetLeftOnTop(List, i), "ON", "OFF")

	Mess = Mess ++ CR ++ "Right ontop checkbox is "
	Mess = Mess ++ ifelse(cl.GetRightOnTop(List, i), "ON", "OFF")

	Mess = Mess ++ CR ++ "Middle ontop checkbox is "
	Mess = Mess ++ ifelse(cl.GetMiddleOnTop(List, i), "ON", "OFF")

	Mess = Mess ++ CR ++ "Left switch to if active checkbox is "
	Mess = Mess ++ ifelse(cl.GetLeftSwitchTo(List, i), "ON", "OFF")

	Mess = Mess ++ CR ++ "Right switch to if active checkbox is "
	Mess = Mess ++ ifelse(cl.GetRightSwitchTo(List, i), "ON", "OFF")

	Mess = Mess ++ CR ++ "Middle switch to if active checkbox is "
	Mess = Mess ++ ifelse(cl.GetMiddleSwitchTo(List, i), "ON", "OFF")

	Temp = cl.GetId(List, i)
	Mess = Mess ++ ifelse(Temp, CR ++ "ID: '" ++ Temp ++ "'", "")

	Temp = cl.GetLabel(List, i)
	Mess = Mess ++ ifelse(Temp, CR ++ "Label: '" ++ Temp ++ "'", "")

	Temp = cl.GetLabelValue(List, i)
	Mess = Mess ++ ifelse(Temp, CR ++ "Label value: '" ++ Temp ++ "'", "")

	Temp = cl.GetTooltip(List, i)
	Mess = Mess ++ ifelse(Temp, CR ++ "Tooltip: '" ++ Temp ++ "'", "")

	Temp = cl.GetTooltipValue(List, i)
	Mess = Mess ++ ifelse(Temp, CR ++ "Tooltip value: '" ++ Temp ++ "'", "")

	Temp = cl.GetIconFile(List, i)
	if(Temp) do
		Mess = Mess ++ CR ++ "Icon file: '" ++ Temp ++ "'"
		Mess = Mess ++ CR ++ "Icon number: " ++ cl.GetIconNumber(List, i)
	endif

	Mess = Mess ++ CR ++ "Item is "
	Mess = Mess ++ ifelse(cl.IsVisible(List, i), "visible", "NOT visible")

	Mess = Mess ++ CR ++ "Item is "
	Mess = Mess ++ ifelse(cl.IsEnabled(List, i), "enabled", "NOT enabled")

	Mess = Mess ++ CR ++ "Icon is "
	Mess = Mess ++ ifelse(cl.IsIconVisible(List, i), "visible", "NOT visible")

	Mess = Mess ++ CR ++ "Item Width: " ++ cl.GetWidth(List, i)
	Mess = Mess ++ CR ++ "Item Height: " ++ cl.GetHeight(List, i)

	Temp = cl.GetBackColor(List, i)
	Mess = Mess ++ ifelse(Temp, CR ++ "Item Background: '" ++ Temp ++ "'", "")

	Temp = cl.GetTextColor(List, i)
	Mess = Mess ++ ifelse(Temp, CR ++ "Item Text Color: '" ++ Temp ++ "'", "")

	if(messagebox("okcancel information", Mess, Cap) == 0)
		quit all

	Mess = ""
endfor

Comments

This script is intended to the command list debugging. It is called by command

runfile.Sub_DebugCL("CL_name")


ParsePath

File Name Sub_ParsePath.txt
Author Vochomurka
Plugin Called file
Version 1.4
Updated on 13.07.2009
args FullPath, Depth
local Number, Char, i, Result
local Slash = esc(?+\\+, ?+\+)
local Name = file.nametype(FullPath)

Number = index(FullPath, "/")
if(not Number) do
	Number = index(FullPath, Slash)
	if(not Number)
		quit

	Char = Slash
else
	Char = "/"
endif

local Path = file.folder(FullPath)
Number = word(Path, 0, Slash)
if(arg(0) == 1)
	quit(Number)

if(Number < abs(Depth))
	quit(FullPath)

if(Depth > 0) do
	for(i = Number; i > Number - Depth; i--)
		Result = word(Path, i, Slash) ++ Char ++ Result
	endfor
elseif(Depth == 0) do
	quit(Name)
elseif(Depth < 0) do
	for(i = 1; i <= Number + Depth; i++)
		Result = Result ++ word(Path, i, Slash) ++ Char
	endfor
endif

quit(remove(Result, -1))

Comments

This script parses the file path and returns the specified path depth. First parameter is a path with either "/" delimiter (PowerPro syntax) or "\" (Total Commander syntax). Second parameter is a depth counting from the file name to the root. If the second parameter is negative, then the counting is reversed.

File name corresponds to the depth equal to zero. If the path ends with a delimiter, then the directory name is supposed to be given, otherwise - the file name.

If the second parameter is more than the actual depth, the script returns the first parameter. If the second parameter is zero, the file name is returned, if it is provided, and empty string otherwise.

Another function of the script is invoked by omittong the second parameter - in this case the actual path depth is returned.

For example, for the c:\One\Two\Three\Four\name.txt file the script returns the following values:
First parameter Second parameter Returned value
"c:\One\Two\Three\Four\" "3" "Two\Three\Four"
"c:\One\Two\Three\Four\name" "2" "Three\Four"
"c:\One\Two\Three\Four\name.txt" "5" "c:\One\Two\Three\Four"
"c:/One/Two/Three/Four/" "4" "One/Two/Three/Four"
"c:/One/Two/Three/Four/name.txt" "6" "c:/One/Two/Three/Four/name.txt"
"c:/One/Two/Three/Four/name.txt" "-3" "c:/One"
"c:\One\Two\Three\Four\name.txt" "-1" "c:\One\Two\Three"
"c:/One/Two/Three/Four/name.txt" 5


TreeDownCmd

File Name Sub_TreeDownCmd.txt
Author Vochomurka
Plugins Called file, miscplugin
Version 1.0
Updated on 24.06.2006
args Path, Name
local Report = miscplugin.tempfilename()
local Str = "/c dir " ++ Path ++ " /a:d /b > " ++ Report
local ExitCode = file.runwait(0, "cmd", Str, "", "hide")

if(not file.size(Report))
	quit("")

local Hand = file.open(Report, "r")
local Temp = "z;"
flag clear 2

if(Hand > 0 && not ExitCode) do
	for(not(file.eof(Hand))) 
		Str = file.readstring(Hand)
		Str = file.nametype(file.getshortpath(Path ++ "\" ++ Str))
		if(Str) do
			if(stricoll(Str, Name) == 1) do
				flag set 2
				if(stricoll(Temp, Str) == 1 || Temp == "z;")
					Temp = Str

			endif
		endif
	endfor
else
	messagebox("ok error", "File not opened", "FILE plugin error")
	quit all
endif

file.close(Hand)

if(pproflag(2)) do
	quit(Path ++ "\" ++ Temp)
else
	quit("")
endif

TreeUpCmd

File Name (*.txt) Sub_TreeUpCmd.txt
Author Vochomurka
Plugins Called file, miscplugin
Version 1.0
Updated on 24.06.2006
args Path, Name
local Report = miscplugin.tempfilename()
local Str = "/c dir " ++ Path ++ " /a:d /b > " ++ Report
local ExitCode = file.runwait(0, "cmd", Str, "", "hide")

if(file.size(Report) - 2 == length(Name))
	quit("")

local Temp
local Hand = file.open(Report, "r")
flag clear 2

if(Hand > 0 && not ExitCode) do
	for(not(file.eof(Hand))) 
		Str = file.readstring(Hand)
		if(Str) do
			Str = file.nametype(file.getshortpath(Path ++ "\" ++ Str))
			if(stricoll(Str, Name) == -1) do
				flag set 2
				if(stricoll(Temp, Str) == -1)	
					Temp = Str

			endif
		endif
	endfor
else
	messagebox("ok error", "File not opened", "FILE plugin error")
	quit all
endif

file.close(Hand)

if(pproflag(2)) do
	quit(Temp)		
else
	quit("")		
endif

LowestDirCmd

File Name Sub_LowestDirCmd.txt
Author Vochomurka
Plugins Called file, miscplugin
Version 1.0
Updated on 24.06.2006
args Path
local Report = miscplugin.tempfilename()
local Str = "/c dir " ++ Path ++ " /a:d /b > " ++ Report
local ExitCode = file.runwait(0, "cmd", Str, "", "hide")

if(not file.size(Report))
	quit("")

flag clear 2
local Hand = file.open(Report, "r")
local Temp

if(Hand > 0 && not ExitCode) do
	for(not(file.eof(Hand))) 
		Str = file.readstring(Hand)
		if(Str) do
			Str = file.nametype(file.getshortpath(Path ++ "\" ++ Str))
			if(stricoll(Temp, Str) == -1)
				Temp = Str

		endif
	endfor
else
	messagebox("ok error", "File not opened", "FILE plugin error")
	quit all
endif

file.close(Hand)
quit(Path ++ "\" ++ Temp)

MoveFile

File Name Sub_MoveFile.txt
Author Vochomurka
Plugins Called file
Version 1.0
Updated on 27.01.2006
local Name = file.nametype(arg(1))
local New = arg(2) ++ Name
file.move(arg(1), New)

Descript_ion

File name Sub_Descript_ion.txt
Author Vochomurka
Plugins Called ini, file, map
Version 1.0
Updated on 27.08.2007
args Path, FileName, Comment, Action

local Source = Path ++ "descript.ion"
local CR = esc(?+\n+, ?+\+)
local Quote = esc(?+\"+, ?+\+)
local AsQuote = "|"
local Config = pprofolder ++ "scripts\ini\Descript_ion.ini"
local fh, Str, SomeFile, Temp, NotComms, Delim

if(ini.check_exists(Config, "Options", "Delimiter") == 3)
	Delim = ini.get(Config, "Options", "Delimiter")

if(index(FileName, " "))
	FileName = AsQuote ++ FileName ++ AsQuote

if(not file.validpath(Source)) do
	if(index("drg", Action))
		quit("ERROR: no comment file")

	fh = file.open(Source, "w")
	if(fh <= 0) do
		messagebox("ok error", "File not opened", "FILE plugin error #12")
		quit all
	endif

	file.writeline(fh, replacechars(FileName, AsQuote, Quote) ++ " " ++ Comment)
	file.close(fh)
	quit
else
	fh = file.open(Source, "r")
	if(fh <= 0) do
		messagebox("ok error", "File not opened", "FILE plugin error #11")
		quit
	endif
endif

local M = map.create(10, 1)
flag set 1

for(not(file.eof(fh))) 
	Str = file.readstring(fh)
	if(not Str)
		continue

	SomeName = word(Str, 1)
	if(file.validpath(Path ++ SomeName)) do
		Temp = select(Str, length(SomeName) - length(Str) + 1)
	else
		SomeName = word(Str, 1, Quote)
		if(not file.validpath(Path ++ SomeName)) do
			NotComms = NotComms ++ Str ++ CR
			continue
		else
			SomeName = AsQuote ++ SomeName ++ AsQuote
			Temp = select(Str, length(SomeName) - length(Str) + 1)
		endif
	endif

	if(SomeName == FileName) do
		if(Action == "g") do
			map.destroy(M)
			file.close(fh)
			quit(Temp)
		elseif(Action == "r") do
			M[FileName] = Comment
			flag clear 1
		elseif(Action == "b") do
			M[FileName] = Comment ++ Delim ++ Temp
			flag clear 1
		elseif(Action == "a") do
			M[FileName] = Temp ++ Delim ++ Comment
			flag clear 1
		endif
	else
		M[SomeName] = Temp
	endif
endfor

if(index("s", Action))
	M[FileName] = Comment

if(index("bar", Action) && pproflag(1))
	M[FileName] = Comment

file.close(fh)
file.delete(Source)

fh = file.open(Source, "w")
if(fh <= 0) do
	messagebox("ok error", "File not opened", "FILE plugin error #13")
	quit all
endif

if(NotComms)
	file.writeline(fh, NotComms ++ CR)

map.restart(M)

for(not(map.eof(M)))
	Str = map.getnext(M)

	if(not Str)
		continue

	file.writeline(fh, replacechars(Str, AsQuote, Quote) ++ " " ++ M[Str])
endfor

file.close(fh)
map.destroy(M)

Comments

Following arguments are passed to the script:

In two latter cases the script reads the Delimiter key from the Options section of the scripts\ini\Descript_ion.ini file. For example, if PowerPro is installed to d:\Utils\PowerPro, then the ini file path must be d:\Utils\PowerPro\scripts\ini\Descript_ion.ini.

If this key exists, its value is taken as a delimiter between old and new comments. Default is a period.


TMTC

File Name Sub_TMTC.txt
Author Vochomurka
Plugins called tc, win, childwin
Version 1.0
Updated on 08.06.2009
args hwnd, Panel
if(not Panel) do
	Panel = tc.active(hwnd)
elseif(Panel == 1)
	Panel = "left"
elseif(Panel == 2)
	Panel = "right"
endif

local List = win.childhandlelist(hwnd, "c=TMyPanel")
local TMTC = win.childhandlelist(hwnd, "c=TMyTabControl")
local Num = word(TMTC, 0)
local TMP

if(Num == 0) do
	quit(0)
elseif(Num == 1) do
	local TPP = win.childhandlelist(hwnd, "c=TPathPanel")
	local LPath = win.gettext(word(TPP, 1))
	local RPath = win.gettext(word(TPP, 2))

	for each word Hand in List
		Num = childwin.handle(Hand, "TPathPanel")
		if(Num) do
			Num = win.gettext(Num)
			if(Num == LPath && Panel == "right") do
				TMP = Hand
				break
			endif
			if(Num == RPath && Panel == "left") do
				TMP = Hand
				break
			endif
		endif
	endfor

	if(not TMP)
		quit(0)

	for each word Hand in List
		Num = childwin.handle(Hand, "TMyComboBox")
		if(Num) do
			if(childwin.gettext(Num) && Hand != TMP) do
					TMP = Hand
					break
			endif
		endif
	endfor
else
	for each word Hand in List
		Num = childwin.handle(Hand, "TMyTabControl")
		if(Num) do
			TMP = Hand
			if(Panel == "left")
				break

		endif
	endfor
endif

TMTC = childwin.handle(TMP, "TMyTabControl")
if(not TMTC)
	quit(0)

quit(TMTC)

Comments

Attention! This script does not work in Total Commander 7.5 pb1 and pb2!


Progress

File Name Sub_Progress.txt
Author Vochomurka
Plugins called -
Version 1.0
Updated on 23.06.2017
args Val, Start, End, Width, AutoClose, Display, Props

static D = Display
static P = "%"

if(!Display)
	D = P

static AC = AutoClose

if(!End)
	End = 100

static E = End

if(!Width)
	Width = 200

static C = cl.Create("Progress", 1)
C.Insert(0)
C.SetLabel(0, "*control progress " ++ Val ++ " " ++ Start ++ " " ++ End)
C.SetProperties("Format=barsize tooltips flat position: middlecaption")

if(Props)
	C.AddProperties(Props)

C.SetWidth(0, Width)
C.Insert(0)
C.AddLeft(0, "*bar close Progress")
C.SetWidth(0, 60)
C.SetToolTip(0, "Left: Close/_____________/Start: " ++ Start ++ "/End: " ++ End)
C.show

@Current
args Val

local Temp = Val

switch (D)
	case P
		Temp ++= D
		break
	case "/"
		Temp ++= D ++ E
endswitch

C.SetLabel(0, Temp)
C.SetCtrlValue(1, Val)

if(Val >= E && AC) do
	wait.forinterval(AC)
	C.close
endif

Comments

Script is illustrative allowing to watch the progress of some longtime operation. In the middle of window caption the small panel with two elements is shown. Right element is a progress bar displaying visual information. Left element does the same, but in numerical format (counter), and also allows to close the panel.

Script is called at least twice. First call shows the panel and must be done before the operation begins. All subsequent calls need to change the current counter.

For the first call parameters are:
Val – current counter value;
Start – starting counter value (at the first call usually Val = Start);
End – ending counter value (default is 100);
Width – panel width in pixels (default is 200);
AutoClose – time in milliseconds elapsing after operation ends until the panel is automatically closed. If AutoClose = 0, it is closed only by pressing the left panel button;
Display – counter format. Valid values are:

Props - any string for "format=" (see the PowerPro help).

Second and all subsequent calls require only one parameter – current counter value.

Example: operation is to process 123 files. First call can be:
.Subs\Sub_Progress(0, 0, 123, 300, 5000, "/", "roundbar: 7")
Panel has 300 pixels in width and rounded corners. Left panel button displays "0/123". At processing the i-th file the call is
.Subs\Sub_Progress@Current(i)
For example, if i = 61, the left button shows "61/123" and the progress bar is filled by one half.

When the last file is processed, the panel is closed after 5 seconds.


Spin

File Name Sub_Spin.txt
Author Vochomurka
Plugins called dialog
Version 1.0
Updated on 23.06.2018
args Start, From, To, Caption, Text, Styles, Cancel, H, W, YSET, HSET, YOC, WOC, HOC, XE, WE, XS, WS, XT, WT, XC

if(!H)
	H = 160

if(!W)
	W = 44

if(!YSET)
	YSET = 6

if(!HSET)
	HSET = 12

if(!YOC)
	YOC = 22

if(!WOC)
	WOC = 74

if(!HOC)
	HOC = 16

if(!XE)
	XE = 16

if(!WE)
	WE = 12

if(!XS)
	XS = 6

if(!WS)
	WS = 12

if(!XT)
	XT = 32

if(!WT)
	WT = 128

if(!XC)
	XC = 86

static No = Cancel
static Num

if(!Styles)
	Styles = "thickframe sysmenu centre"

dialog.error_dialog_on()

local hDlg = dialog.define(0, 0, H, W, Caption, Styles)

if(!hDlg)
	quit

hDlg.define_control(XE, YSET, WE, HSET, "editbox", "ebCnt", Start, "3d border", "", "", 0x0300) 
hDlg.define_control(XS, YSET, WS, HSET, "spinner", "spCnt", "", "setbuddyint") 
hDlg.define_control(XT, YSET, WT, HSET, "static", "text", Text) 
hDlg.define_control(XS, YOC, WOC, HOC, "button", "", "OK", "", cbx("@onOk")) 
hDlg.define_control(XC, YOC, WOC, HOC, "button", "btQuit", "&Cancel", "", cbx("@onQuit")) 

hDlg.create(1)
                                                                                                                      
local hWnd = hDlg.get("ebCnt", "hwnd")
hDlg.send_message("spCnt", "setbuddy", hWnd, 0, 0)       

hDlg.set_range("spCnt", From, To)
hDlg.run("foreground")

quit(Num)

Function onOk(sUserArg, dlgHan)
Num = dlgHan.get_value("spCnt")
dlgHan = dlgHan.destroy()
quit

Function onQuit(sUserArg, dlgHan)
Num = No
dlgHan = dlgHan.destroy()

Comments

Script is intended to enter one integer value. It can be done in the edit field (buddy) or by spin control.

Script parameters are

All coordinates are counted from the top left window corner:

Parameters starting from H can be omitted, then defaults are used. All control sisez are close to the "golden section".


BarName

File Name Sub_BarName.txt
Author Vochomurka
Plugins called win, childwin
Version 1.0
Updated on 28.10.19
local hh = win.handle("c=TTOTAL_CMD")
win.postmessage(hh, 0x400+51, 498, 0)
wait.for(100, win.exists("c=TBUTTONCHANGEDLG"))
local TBCD = win.handle("c=TBUTTONCHANGEDLG")
local BarName = childwin.gettext(TBCD, "TMyPanel")

if(!BarName)
	BarName = childwin.gettext(TBCD, 8)

if(TBCD)
	win.close(TBCD)

if(validpath(BarName))
	quit(BarName)

Comments

Script returns name of the current button bar


Main Page Total Commander PowerPro