Code: Select all
local TsClientId = "4B787BF1-4846-4FC9-9D63-A1D5E2D60FF8"
local F = far.Flags
MenuItem {
description = "TSCLIENT";
menu = "Disks";
guid = TsClientId;
text = "TSCLIENT";
action = function(openfrom,item)
local h = io.popen(win.GetEnv("SystemRoot").."\\system32\\net.exe use")
-- msgbox ("!")
local s = h:read()
local tsdisks = {}
while s do
s = win.OemToUtf8(s):match("\\\\TSCLIENT\\%S+")
if s then
tsdisks[#tsdisks+1] = {disk=s,text=s:gsub("(\\\\TSCLIENT\\)(.)","%1&%2")}
end
s = h:read()
end
h:close()
if #tsdisks > 0 then
local res,pos = far.Menu(
{
X = openfrom==F.OPEN_LEFTDISKMENU and 10 or (APanel.Left and APanel.Width+10 or PPanel.Width+10),
Title="TS Disks", Bottom="", Id=win.Uuid(TsClientId),
MaxHeight=Far.Height-10,
},
tsdisks
)
if pos then
local ap = (openfrom==F.OPEN_LEFTDISKMENU and APanel.Left or openfrom==F.OPEN_RIGHTDISKMENU and not APanel.Left) and 1 or 0
panel.SetPanelDirectory(nil,ap,tsdisks[pos].disk)
end
end
end;
}