File association with LUA

You have encountered a problem using Far Manager? Here you can get help.
User avatar
techie
Posts: 654
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 20 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?
Some ancient PlugRinG schema.

Shmuel
Posts: 4944
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 11 times
Been thanked: 123 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: 7906
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 63 times
Been thanked: 94 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: 654
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 20 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`?
Some ancient PlugRinG schema.

User avatar
techie
Posts: 654
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 20 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?
Some ancient PlugRinG schema.

Shmuel
Posts: 4944
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 11 times
Been thanked: 123 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 2 guests