File association with LUA

You have encountered a problem using Far Manager? Here you can get help.
Post Reply
User avatar
techie
Posts: 795
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 35 times
Been thanked: 6 times

File association with LUA

Post by techie »

I need to setup file association that strips first two letters from a filename. I tried to do this with SET substrings, but I could not find the way to chain SET with subsequent command. Perhaps it is possible to do this with Lua scripting. Are there any examples?
Shmuel
Posts: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

File association with LUA

Post by Shmuel »

Here is a tested example:
lua: win.ShellExecute(nil, nil, [[C:\Exe32\TreeSpice\Treespice.exe]], [[!\]]..([[!.!]]):sub(3))
Probably it could be also achieved without ShellExecute, by constructing a command line with Lua.
User avatar
HaRT
Moderator
Posts: 10806
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 220 times
Been thanked: 357 times

File association with LUA

Post by HaRT »

techie wrote: I could not find the way to chain SET with subsequent command
I suppose it's possible within a CMD script being called by a file association.
Фар есть инструмент, а не нянька. © 2009 DrKnS
User avatar
techie
Posts: 795
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 35 times
Been thanked: 6 times

File association with LUA

Post by techie »

Nice. Where can I lookup documentation on `lua: win.ShellExecute`?
User avatar
techie
Posts: 795
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 35 times
Been thanked: 6 times

File association with LUA

Post by techie »

Also, the command is executed in popup console, is it possible to run it in Far console window?
Shmuel
Posts: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

File association with LUA

Post by Shmuel »

techie wrote: Also, the command is executed in popup console, is it possible to run it in Far console window?
lua: Far.DisableHistory(0xF) Keys"CtrlY" print([[C:\Exe32\TreeSpice\Treespice.exe !\]]..([[!.!]]):sub(3)) Keys"Enter"
Last edited by Shmuel on Fri 21 Apr, 2017 08:23, edited 1 time in total.
Post Reply

Return to “Support and Troubleshooting”