Solved: What is panel.setpos in LUA?

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

Solved: What is panel.setpos in LUA?

Postby jonib » Tue 26 Feb, 2013 19:13

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: 4956
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 11 times
Been thanked: 125 times

Re: What is panel.setpos in LUA?

Postby Shmuel » Tue 26 Feb, 2013 19:54

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: 72
Joined: Wed 16 Apr, 2008 19:55
Has thanked: 1 time

Re: What is panel.setpos in LUA?

Postby jonib » Tue 26 Feb, 2013 20:17

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: 4956
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 11 times
Been thanked: 125 times

Re: What is panel.setpos in LUA?

Postby Shmuel » Tue 26 Feb, 2013 21:06

jonib wrote:What manual are you referring to?

macroapi_manual.chm

Here is your macro converted.

jonib
Posts: 72
Joined: Wed 16 Apr, 2008 19:55
Has thanked: 1 time

Re: What is panel.setpos in LUA?

Postby jonib » Tue 26 Feb, 2013 21:30

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


Return to “Macro Commands Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest