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

Here you can discuss any topic concerning Far macro commands.
Post Reply
farman
Posts: 118
Joined: Thu 03 Sep, 2009 11:32
Been thanked: 2 times

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

Post by farman »

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: 13801
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 72 times
Been thanked: 425 times
Contact:

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

Post by John Doe »

farman wrote: But I don't know how
It's not clear what is your goal.
farman
Posts: 118
Joined: Thu 03 Sep, 2009 11:32
Been thanked: 2 times

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

Post by farman »

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: 13801
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 72 times
Been thanked: 425 times
Contact:

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

Post by John Doe »

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
Been thanked: 2 times

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

Post by farman »

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)
Post Reply

Return to “Macro Commands Discussions”