I'm trying to convert a macro from Far2 to the new Far3 Lua.
What is "panel.setpos" in Lua? I need to jump to a file based on it's name in the panel.
And is "luafar_manual.chm" the only English documentation available?
Edit: Is the old Macro commands still available in Far3? as all documentation (including F1) seems to show the old commands, but nowhere can I find how I would use them.
jonib
Re: What is panel.setpos in LUA?
Posted: Tue 26 Feb, 2013 19:54
by Shmuel
jonib
Lua is case sensitive language. Hence, it is Panel.SetPos, exactly as spelled in the manual.
The manual currently has no English translation.
You can export your Far 2 macros from the registry and send me via personal message. I have a (not finished but functional) utility for automatic conversion to Far 3 format.
Re: What is panel.setpos in LUA?
Posted: Tue 26 Feb, 2013 20:17
by jonib
Thanks for the quick reply.
Shmuel wrote:Lua is case sensitive language. Hence, it is Panel.SetPos, exactly as spelled in the manual.
The manual currently has no English translation.
Problem is I haven't found any syntax in any manual. I found one reference in "macroapi_manual.chm" but that don't actually show how to use it.
What manual are you referring to?
Edit: I think I got Panel.SetPos figured out. Let's see what creates problems next.
You can export your Far 2 macros from the registry and send me via personal message. I have a (not finished but functional) utility for automatic conversion to Far 3 format.
Thanks for the offer, I'll put in the macro I'm working on. Rest of my macros I want to convert myself. It's kinda hard to learn this new Lua stuff if your tool does all the work.
mmode(1,0)
if APanel.Selected then
index=1;
for RCounter= APanel.ItemCount,1,-1 do
if Panel.Item(0,index,8) then
if list then
list=list..Panel.Item(0,index,0).."|";
else
list=Panel.Item(0,index,0).."|";
end
end
index=index+1;
end
Keys("ShiftSubtract")
while list do
if Panel.SetPos(0,mf.substr(list,0,mf.index(list,"|"))) then
else
msgbox("Error", "File: "..mf.substr(list,0,mf.index(list,"|")).." gone!")
exit()
end
list=mf.substr(list,mf.index(list,"|")+1);
Keys("ShiftF1 Enter Home") print(PPanel.Path) Keys("\\ Enter")
end
else
Keys("ShiftF1 Enter Home") print(PPanel.Path) Keys("\\ Enter")
end
Re: What is panel.setpos in LUA?
Posted: Tue 26 Feb, 2013 21:30
by jonib
Shmuel wrote:macroapi_manual.chm
OK, I guess many of the functions have the same syntax as the old macro language, so I'll try that next time.
mmode(1,0)
if APanel.SelCount>0 then
local Files={}
for i=1,APanel.SelCount do
Files[i]=panel.GetSelectedPanelItem(nil,1,i).FileName
end
Keys("ShiftSubtract")
for i=1,table.getn(Files) do
Panel.SetPos(0,Files[i])
Keys("ShiftF1 Home") print(PPanel.Path) Keys("\\ Enter")
end
else
Keys("ShiftF1 Home") print(PPanel.Path) Keys("\\ Enter")
end
Jupp, I prefer to convert manually as the code is kinda horrible with a direct conversion.