Solved: What is panel.setpos in LUA?

Here you can discuss any topic concerning Far macro commands.
Post Reply
jonib
Posts: 73
Joined: Wed 16 Apr, 2008 19:55
Has thanked: 1 time

Solved: What is panel.setpos in LUA?

Post by jonib »

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
Last edited by jonib on Tue 26 Feb, 2013 20:38, edited 1 time in total.
Shmuel
Posts: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

Re: What is panel.setpos in LUA?

Post 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.
jonib
Posts: 73
Joined: Wed 16 Apr, 2008 19:55
Has thanked: 1 time

Re: What is panel.setpos in LUA?

Post 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. :shock:
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. :D

Code: Select all

Macro:Post mmode(1,0) $If (APanel.Selected) %index=1; $Rep (APanel.ItemCount) $If (panelitem(0,%index,8)) $If (%list) %list=%list+panelitem(0,%index,0)+"|"; $Else %list=panelitem(0,%index,0)+"|"; $End $End %index=%index+1; $End ShiftSubtract $While (%List) $If (panel.setpos(0,substr(%List,0,index(%List,"|")))) $Else msgbox("Error", "File: "+substr(%List,0,index(%List,"|"))+" gone!") $Exit $End %List=substr(%List,index(%List,"|")+1); ShiftF1 Enter Home $Text PPanel.Path \ Enter $End $Else ShiftF1 Enter Home $Text PPanel.Path \ Enter $End
Edit2: Looks like I got the macro converted, so I'm fine for now. :laugh: Hopefully I can avoid any more roadblocks. :o

jonib
Shmuel
Posts: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

Re: What is panel.setpos in LUA?

Post by Shmuel »

jonib wrote:What manual are you referring to?
macroapi_manual.chm

Here is your macro converted.
jonib
Posts: 73
Joined: Wed 16 Apr, 2008 19:55
Has thanked: 1 time

Re: What is panel.setpos in LUA?

Post 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.
Here is your macro converted.
Thanks, but mines nicer. :wink:
Jupp, I prefer to convert manually as the code is kinda horrible with a direct conversion.

jonib
Post Reply

Return to “Macro Commands Discussions”