How to use "Groups of file masks" in lua script

Here you can discuss any topic concerning Far macro commands.
farman
Posts: 118
Joined: Thu 03 Sep, 2009 11:32

How to use "Groups of file masks" in lua script

Postby farman » Tue 06 Jan, 2015 18:50

I have several "Groups of file masks" defined which I like to use in a lua script. But I don't know how. Can someone please give me a hint?

Examples:
    batch │ *.cmd,*.bat
    exec │ *.exe,*.com,*.scr,*.lnk,<batch>,%PATHEXT%

User avatar
John Doe
Бюрократ
Posts: 11026
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 9 times
Been thanked: 61 times

How to use "Groups of file masks" in lua script

Postby John Doe » Tue 06 Jan, 2015 19:08

farman wrote:Source of the post But I don't know how
It's not clear what is your goal.

farman
Posts: 118
Joined: Thu 03 Sep, 2009 11:32

How to use "Groups of file masks" in lua script

Postby farman » Tue 06 Jan, 2015 19:15

Oh, sorry. I have a ""Groups of file masks" (F9 - options) such as <batch> and want to take a look if there is a file extension (i.e. current filename) in it (in a lua script).

User avatar
John Doe
Бюрократ
Posts: 11026
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 9 times
Been thanked: 61 times

How to use "Groups of file masks" in lua script

Postby John Doe » Tue 06 Jan, 2015 19:20

See function far.ProcessName (luafar_manual.chm)

e.g.:

Code: Select all

lua:=far.ProcessName (far.Flags.PN_CMPNAMELIST, "<batch>", APanel.Current)

farman
Posts: 118
Joined: Thu 03 Sep, 2009 11:32

How to use "Groups of file masks" in lua script

Postby farman » Tue 06 Jan, 2015 20:15

Ah, easy again.
Thanx John.

Code: Select all

               
...
local fnExt = mf.fsplit(APanel.Current,0x8)
local bFound=far.ProcessName (far.Flags.PN_CMPNAMELIST, "<media>", fnExt);
if bFound then s="yes" else s="no" end;
far.Message ("Extension=" .. fnExt .. " Found=" .. s)


Return to “Macro Commands Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest