File association with LUA

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

File association with LUA

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

File association with LUA

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

File association with LUA

Postby HaRT » Tue 18 Apr, 2017 12:31

techie wrote:Source of the post 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: 709
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 22 times
Been thanked: 2 times

File association with LUA

Postby techie » Fri 21 Apr, 2017 07:03

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

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

File association with LUA

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

File association with LUA

Postby Shmuel » Fri 21 Apr, 2017 08:21

techie wrote:Source of the post 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.


Return to “Support and Troubleshooting”

Who is online

Users browsing this forum: No registered users and 1 guest