Page 1 of 1

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

Posted: Tue 06 Jan, 2015 18:50
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%

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

Posted: Tue 06 Jan, 2015 19:08
by John Doe
farman wrote: But I don't know how
It's not clear what is your goal.

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

Posted: Tue 06 Jan, 2015 19:15
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).

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

Posted: Tue 06 Jan, 2015 19:20
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)

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

Posted: Tue 06 Jan, 2015 20:15
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)