File association with LUA

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

File association with LUA

Post by techie » Tue 18 Apr, 2017 04:48

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: 5235
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 152 times

File association with LUA

Post by Shmuel » Tue 18 Apr, 2017 07:29

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: 8118
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 68 times
Been thanked: 107 times

File association with LUA

Post by HaRT » Tue 18 Apr, 2017 12:31

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: 761
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 28 times
Been thanked: 2 times

File association with LUA

Post by techie » Fri 21 Apr, 2017 07:03

Nice. Where can I lookup documentation on `lua: win.ShellExecute`?

User avatar
techie
Posts: 761
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 28 times
Been thanked: 2 times

File association with LUA

Post by techie » Fri 21 Apr, 2017 07:09

Also, the command is executed in popup console, is it possible to run it in Far console window?

Shmuel
Posts: 5235
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 152 times

File association with LUA

Post by Shmuel » Fri 21 Apr, 2017 08:21

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”