/
macroapi_manual.en.tsi
2799 lines (2799 loc) · 106 KB
/
macroapi_manual.en.tsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<header>
tag=SMZ1
ver=2.7
</header>
<node>
id=1
lv=0
dt=Text
nm=Far Manager macro system manual
ctime=3551829092
mtime=3602513805
<article>
#_<markdown>
#_
#_Since 30.09.2012 (Far 3.0.2851), Far Manager uses [Lua][1] programming language (version 5.1)
#_instead of the built-in macro language.
#_
#_A macro is a Lua-script and its meta-data such as:
#_
#_* Areas from which the script may be executed
#_* Keys that initiate execution of the script from those areas
#_* Prerequisites for the execution of the script
#_* Run-time flags: `EnableOutput` and `NoSendKeysToPlugins`
#_
#_Functionality
#_--------------
#_
#_* Macro recording and playback
#_* Standard Lua libraries
#_* LuaFAR libraries ("plugin API")
#_* [Libraries of macro functions][2] ("macro API")
#_* For plugins: function `MacroControl`
#_
#_[1]: http://www.lua.org/
#_[2]: 42.html
#_
#_@@@
#_{macrocontrol}: http://api.farmanager.com/ru/service_functions/macrocontrol.html
#_
</article>
</node>
<node>
id=42
lv=1
dt=Text
nm=Libraries of macro functions
ctime=3553243413
mtime=3601971499
<article>
#_<markdown>
#_The description of the APIs in this document is **not** self-contained, it is *supplementing and clarifying* the description of the Far objects' properties and functions in the [Macro language][2] section of Far Encyclopedia.
#_
#_Ideally, the API must match the original macro language API, with the exception of the cases listed in article [API changes in comparison to the macro language][1].
#_
#_[1]: 38.html
#_[2]: http://api.farmanager.com/ru/macro/macrocmd/index.html
#_
#_
#_
</article>
</node>
<node>
id=38
lv=2
dt=Text
nm=API changes in comparison to the macro language
ctime=3553185939
mtime=3629991950
<article>
#_<markdown>
#_
#_1. All identifiers are case sensitive.
#_1. Instead of directly specifying the keys you use function [`Keys`][Keys].
#_1. [`$AKey`][$akey] -> `Keys("AKey")`
#_1. [`$SelWord`][$selword] -> `Keys("SelWord")`
#_1. [`$XLat`][$xlat] -> `Keys("XLat")`
#_1. [`$Exit`][$exit] -> [`exit()`][exit]
#_1. Logical properties have type *boolean* (so it does not make sense to compare them
#_ with the number `0`).
#_1. Function `prompt` can return either a string or a `false` (but never a number `0`).
#_1. Many functions are placed in the table [`mf`][mf] (abbreviation from *macrofunctions*),
#_ e.g.: `mf.abs`, `mf.fsplit`, etc.
#_1. Function `mf.beep` returns a boolean rather than a number.
#_1. Function `mf.fexist` returns a boolean rather than a number.
#_1. Functions [`mload`] [mload] and [`msave`] [msave] have changed, see their descriptions.
#_1. Context dependent properties are placed in the table [`Object`][Object],
#_ e.g.: `Object.CurPos`, `Object.Empty`.
#_1. `CheckHotkey -> Object.CheckHotkey`
#_1. `GetHotkey -> Object.GetHotkey`
#_1. Logical properties for testing execution areas are in table [`Area`][Area],
#_ e.g.: `Area.Editor`, `Area.Shell`.
#_1. `Macro.Area -> Area.Current`.
#_1. `Dialog.AutoCompletion -> Area.DialogAutoCompletion`
#_1. `Shell.AutoCompletion -> Area.ShellAutoCompletion`
#_1. `CallPlugin` -> [`Plugin.Call`][Call]. This call is always asynchronous.
#_ For synchronous calls use [`Plugin.SyncCall`][SyncCall].
#_1. Functions `Plugin.Menu`, `Plugin.Config` and `Plugin.Command` return a boolean value.
#_1. `mmode(3,x)` no more affects synchronicity/asynchronicity of calls to plugins;
#_ it does nothing and returns `0`.
#_1. `Dlg.Info.Id -> Dlg.Id`
#_1. `Dlg.Info.Owner -> Dlg.Owner`
#_1. `Far.Cfg.Get -> Far.Cfg_Get`. This function returns a string in case of success
#_ and `false` in case of failure.
#_1. `Far.Cfg.Err` does not exist anymore.
#_1. `FullScreen -> Far.FullScreen`
#_1. `IsUserAdmin -> Far.IsUserAdmin`
#_1. `History.Disable -> Far.DisableHistory`
#_1. `KbdLayout -> Far.KbdLayout`
#_1. `KeyBar.Show -> Far.KeyBar_Show`
#_1. `Window.Scroll -> Far.Window_Scroll`
#_1. `Menu.Info.Id -> Menu.Id`
#_1. `MsX`, `MsY`, `MsButton`, `MsCtrlState`, `MsEventFlags` -- see table [`Mouse`][Mouse]
#_1. `RCounter` does not exist anymore.
#_1. `Macro.Const`, `Macro.Func`, `Macro.Keyword` è `Macro.Var` do not exist anymore.
#_1. Macro specification: flag `DisableOutput` does not exist; screen redraw is disabled by default;
#_ added flag `EnableOutput` (apply it if screen redraw is needed during macro execution).
#_1. Macro specification: flags `Selection` and `NoSelection` are no more applicable for
#_ editor/viewer/dialog areas. For these areas one should use respectively `EVSelection` and
#_ `NoEVSelection` flags.
#_1. Macro specification: flag `RunAfterFARStart` is in effect also when Far Manager is run with `/e` or `/v` command line switch. In those cases only macros whose `area` field contains respectively `Editor` or `Viewer` are run.
#_
#_[exit]: 61.html
#_[mload]: 13.html
#_[msave]: 12.html
#_[mf]: 44.html
#_[Keys]: 4.html
#_[Area]: 36.html
#_[Object]: 45.html
#_[Mouse]: 59.html
#_[SyncCall]: 83.html
#_[Call]: 65.html
#_
#_[$akey]: http://api.farmanager.com/ru/macro/macrocmd/akey.html
#_[$exit]: http://api.farmanager.com/ru/macro/macrocmd/exit.html
#_[$selword]: http://api.farmanager.com/ru/macro/macrocmd/selword.html
#_[$xlat]: http://api.farmanager.com/ru/macro/macrocmd/xlat.html
#_
#_@@@
#_{checkhotkey}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/menus.html#checkhotkey
#_{dlg.info.id}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/dialog.html#Dlg.Info.Id
#_{far.cfg.err}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Far.Cfg.Err
#_{far.cfg.get}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#far.cfg.get
#_{fullscreen}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Fullscreen
#_{gethotkey}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/menus.html#gethotkey
#_{history.disable}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#history.disable
#_{isuseradmin}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#IsUserAdmin
#_{kbdlayout}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#kbdlayout
#_{keybar.show}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#keybar.show
#_{macro.area}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Macro.Area
#_{macro.const}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#macro.const
#_{macro.func}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#macro.func
#_{macro.keyword}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#macro.keyword
#_{macro.var}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#macro.var
#_{menu.info.id}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/menus.html#Menu.Info.Id
#_{mmode}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#mmode
#_{msbutton}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#MsButton
#_{msctrlstate}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#MsCtrlState
#_{mseventflags}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#MsEventFlags
#_{msx}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#MsX
#_{msy}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#MsY
#_{plugin.call}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#plugin.call
#_{prompt}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#prompt
#_{rcounter}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#RCounter
#_{window.scroll}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Window.Scroll
#_
</article>
</node>
<node>
id=20
lv=2
dt=Text
nm=Global properties and functions
ctime=3552221109
mtime=3607865667
<article>
#_**Properties:** none.
#_
#_**Functions:**
#_
#_ akey
#_ band, bnot, bor, bxor, lshift, rshift
#_ eval
#_ `exit`
#_ `Keys`
#_ mmode
#_ msgbox
#_ print
#_ `printf`
#_ prompt
#_
#_**Notes:**
#_
#_1. Functions *band*, *bnot*, *bor*, *bxor*, *lshift* è *rshift* (bitwise operations)
#_ are global aliases of the same-named functions of *bit64* library.
#_ (see LuaFAR manual).
#_
#_2. Functions *akey* and *mmode*, when called from within function *condition* of a macro,
#_ return *false*.
#_
#_3. For uniformity sake, all the above functions (except the bitwise ones)
#_ are duplicated in table `mf`, for example: *eval* è *mf.eval* reference
#_ the same function.
#_
#_@@@
#_[exit]: 61.html
#_[printf]: 60.html
#_[mf]: 44.html
#_[Keys]: 4.html
#_
#_{akey}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#akey
#_{eval}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#eval
#_{mmode}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#mmode
#_{msgbox}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#msgbox
#_{print}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#print
#_{prompt}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#prompt
#_
</article>
</node>
<node>
id=61
lv=3
dt=Text
nm=exit
ctime=3555411121
mtime=3600459808
<article>
#_exit ()
#_
#_**Parameters:**
#_ none
#_
#_**Returns:**
#_ nothing
#_
#_**Description:**
#_ Exit macro.
#_
</article>
</node>
<node>
id=4
lv=3
dt=Text
nm=Keys
ctime=3551902602
mtime=3632495627
<article>
#_Keys (...)
#_
#_**Parameters:**
#_ One or more arguments of string type.
#_ Each argument may contain multiple keys separated by whitespace characters.
#_ The arguments are case insensitive.
#_
#_**Returns:**
#_ nothing
#_
#_**Description:**
#_ Send one or more keys to Far Manager.
#_
#_**Notes:**
#_
#_ 1. Special keys:
#_ *"AKey"* - send Far Manager the key that started this macro.
#_ *"SelWord"* - select the word under cursor.
#_ *"XLat"* - convert the word under cursor.
#_
#_**Example:**
#_ mykeys = "CtrlF5 Esc"
#_ Keys("AKey A b CtrlC ShiftEnter", mykeys)
#_
#_
</article>
</node>
<node>
id=60
lv=3
dt=Text
nm=printf
ctime=3554233087
mtime=3643817828
<article>
#_printf (fmt, ...)
#_
#_**Parameters:**
#_ fmt : string
#_ ... : 0 or more arguments, according to format specified by argument *fmt*.
#_
#_**Returns:**
#_ nothing
#_
#_**Description:**
#_ Works just like the macro language function *print*, but with additional
#_ ability of formatting. Formatting rules are described in the `Lua manual`.
#_
#_**NOTE:**
#_ **DO NOT USE THIS FUNCTION IN NEW DEVELOPMENTS AND REMOVE IT FROM THE EXISTING ONES.**
#_ **THIS FUNCTION WILL BE REMOVED IN DECEMBER 2015.**
#_
#_@@@
#_[Lua manual]: http://www.lua.org/manual/5.1/manual.html#pdf-string.format
#_
#_{print}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#print
#_
#_
</article>
</node>
<node>
id=44
lv=2
dt=Text
nm=mf
ctime=3553243522
mtime=3614688576
<article>
#_**Properties:** none.
#_
#_**Functions:**
#_
#_ abs max
#_ `acall` `mdelete`
#_ akey min
#_ asc `mload`
#_ atoi mmode
#_ beep mod
#_ chr `msave`
#_ clip msgbox
#_ date `postmacro`
#_ env print
#_ `eval` `printf`
#_ `exit` prompt
#_ fattr replace
#_ fexist rindex
#_ float size2str
#_ flock sleep
#_ fmatch string
#_ fsplit strpad
#_ `GetMacroCopy` strwrap
#_ iif substr
#_ index testfolder
#_ int trim
#_ itoa ucase
#_ key `usermenu`
#_ `Keys` waitkey
#_ lcase xlat
#_ len
#_
#_@@@
#_[acall]: 91.html
#_[eval]: 79.html
#_[exit]: 61.html
#_[GetMacroCopy]: 72.html
#_[Keys]: 4.html
#_[mdelete]: 15.html
#_[mload]: 13.html
#_[msave]: 12.html
#_[postmacro]: 85.html
#_[printf]: 60.html
#_[usermenu]: 69.html
#_
#_
#_{abs}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#abs
#_{akey}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#akey
#_{asc}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#asc
#_{atoi}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#atoi
#_{beep}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#beep
#_{chr}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#chr
#_{clip}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#clip
#_{date}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#date
#_{env}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#env
#_{fattr}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#fattr
#_{fexist}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#fexist
#_{float}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#float
#_{flock}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#flock
#_{fmatch}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#fmatch
#_{fsplit}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#fsplit
#_{iif}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#iif
#_{index}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#index
#_{int}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#int
#_{itoa}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#itoa
#_{key}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#key
#_{lcase}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#lcase
#_{len}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#len
#_{max}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#max
#_{min}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#min
#_{mmode}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#mmode
#_{mod}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#mod
#_{msgbox}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#msgbox
#_{print}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#print
#_{prompt}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#prompt
#_{replace}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#replace
#_{rindex}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#rindex
#_{size2str}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#size2str
#_{sleep}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#sleep
#_{string}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#string
#_{strpad}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#strpad
#_{strwrap}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#strwrap
#_{substr}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#substr
#_{testfolder}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#testfolder
#_{trim}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#trim
#_{ucase}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#ucase
#_{waitkey}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#waitkey
#_{xlat}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#xlat
#_
</article>
</node>
<node>
id=91
lv=3
dt=Text
nm=acall
ctime=3614688602
mtime=3614691589
<article>
#_... = mf.acall (func, ...)
#_
#_**Parameters:**
#_ func: function
#_ ...: 0 or more Lua values
#_
#_**Returns:**
#_ ...: 0 or more Lua values
#_
#_**Description:**
#_ This function calls "asynchronously" the function *func*, passing it all the following
#_ arguments.
#_
#_ *mf.acall* is a sort of specialization of `Plugin.Call` for the `LuaMacro` plugin,
#_ but unlike Plugin.Call it allows code execution in the context of the caller
#_ as well as passing and returning any Lua values.
#_
#_ Like Plugin.Call, *mf.acall* is "asynchronous": when the function *func* pops up
#_ a dialog or a menu on the screen, *mf.acall* immediately terminates and returns *true*.
#_
#_ If the function *func* pops up no dialogs or menus on the screen, it is a "synchronous"
#_ operation mode: in this case *mf.acall* returns all values, returned by the function *func*.
#_
#_@@@
#_[Plugin.Call]: 65.html
#_[LuaMacro]: 7.html
#_
</article>
</node>
<node>
id=79
lv=3
dt=Text
nm=eval
ctime=3581755102
mtime=3633294473
<article>
#_<markdown>
#_`ret = eval(S[,Mode[,Lang]])`
#_
#_This function corresponds to the [description][1] in Far Manager Encyclopedia,
#_with the following extensions:
#_
#_### 1. `eval` can execute either Lua or MoonScript code
#_
#_Added an optional 3-rd parameter `Lang` specifying the programming language
#_of the parameter `S` in modes 1, 2 and 3. Acceptable values are `"lua"` and
#_`"moonscript"`. The default value is `"lua"`.
#_
#_### 2. Parameter `S` can specify a script-file
#_
#_In modes 0, 1 and 3 parameter `S` can refer to a script-file, if this parameter
#_begins with a `@` character. In this case the `S` parameter must be in the
#_following format:
#_
#_ @<script-file name> [<script parameters>]
#_
#_- The file name can contain environment variables, they will be expanded.
#_- Optional script parameters are a list of expressions separated by commas.
#_- The expression should use the same programming language as the script.
#_
#_#### Example:
#_```
#_ eval("@%MyFarScripts%\\calc.moon 'factorial', 3+5", 0, "moonscript")
#_```
#_
#_### 3. New return codes of `eval(S, 2)`
#_
#_* `0` (normal return) : is followed by any additional values that might be returned
#_ by the "evaluated" macro.
#_* `-3` : if the macro selection menu was displayed and cancelled by the user.
#_* `-4` : if the "evaluated" macro was interrupted by a run-time error.
#_
#_[1]: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#eval
#_
#_@@@
#_--{eval}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#eval
#_
</article>
</node>
<node>
id=72
lv=3
dt=Text
nm=GetMacroCopy
ctime=3578176338
mtime=3607090687
<article>
#_macro = mf.GetMacroCopy (index)
#_
#_**Parameters:**
#_ index: integer
#_
#_**Returns:**
#_ macro: table or nil
#_
#_**Description:**
#_ *GetMacroCopy* returns a copy of a loaded macro (or event handler) table
#_ by its index in the internal array (starting from 1). If the index is greater
#_ than the size of the array, the function returns nil, so one can determine
#_ the end of the array.
#_
#_**Notes:**
#_ * Inactive (unloaded or deleted) elements have the field "disabled" == true.
#_ * To distinguish between macro table from event handler table: there is the field
#_ "area" of type string that is present only in macro tables.
#_
#_
</article>
</node>
<node>
id=15
lv=3
dt=Text
nm=mdelete
ctime=3552066075
mtime=3622999561
<article>
#_mf.mdelete (key, name [, location])
#_
#_**Parameters:**
#_ key: string
#_ name: string
#_ location: string ("roaming" or "local"; default: "roaming")
#_
#_**Returns:**
#_ nothing
#_
#_**Description:**
#_ Function *mdelete* deletes a value or key from the database.
#_ To delete a key, specify *name* == "`*`" (asterisk).
#_
#_
</article>
</node>
<node>
id=13
lv=3
dt=Text
nm=mload
ctime=3551993209
mtime=3622999587
<article>
#_ret = mf.mload (key, name [, location])
#_
#_**Parameters:**
#_ key: string
#_ name: string
#_ location: string ("roaming" or "local"; default: "roaming")
#_
#_**Returns:**
#_ ret: number, string, boolean, table, int64 or nil.
#_
#_**Description:**
#_ Function *mload* reads a value from the database.
#_
#_
</article>
</node>
<node>
id=12
lv=3
dt=Text
nm=msave
ctime=3551993205
mtime=3622999613
<article>
#_mf.msave (key, name, value [, location])
#_
#_**Parameters:**
#_ key: string
#_ name: string
#_ value: nil, boolean, number, string, table, int64
#_ location: string ("roaming" or "local"; default: "roaming")
#_
#_**Returns:**
#_ nothing
#_
#_**Description:**
#_ Function *msave* saves the specified value into the database.
#_
#_ When you save the table the following will be preserved:
#_ keys of types: number, string, boolean, table.
#_ values of types: number, string, boolean, table, int64.
#_
#_ Nested tables and recursive references are correctly processed.
#_
#_ The link between a table and its metatable is preserved.
#_
#_**Note:**
#_ int64 - a distinguished type of userdata, created by the bit64 library.
#_
</article>
</node>
<node>
id=85
lv=3
dt=Text
nm=postmacro
ctime=3599211970
mtime=3600496919
<article>
#_result = mf.postmacro (func [, ...])
#_
#_**Parameters:**
#_ func: function
#_ ...: 0 or more Lua values
#_
#_**Returns:**
#_ result: boolean
#_
#_**Description:**
#_ The function places a new macro in a queue for execution.
#_ When the execution begins *func* is called with arguments *...*
#_
</article>
</node>
<node>
id=69
lv=3
dt=Text
nm=usermenu
ctime=3571243204
mtime=3607090852
<article>
#_mf.usermenu (mode, filename)
#_
#_**Parameters:**
#_ mode: number (0 by default)
#_ filename: string or nil
#_
#_**Returns:**
#_ nothing
#_
#_**Description:**
#_ Opens or creates a user menu.
#_
#_ Function behavior depends on the least significant byte of *mode*:
#_
#_ 0: equivalent to pressing F2 in panels; *filename* is ignored.
#_ 1: displays the dialog for user menu selection; *filename* is ignored.
#_ 2: opens user menu from the file "as is", i.e. by specified *filename*.
#_ 3: opens user menu from the file *filename* in %farprofile%\Menus
#_ (the directory is created automatically).
#_
#_ If the bit 0x100 of *mode* is set the function will return only upon closing
#_ the menu (synchronous call). If that bit is cleared the function will return
#_ immediately when the menu is opened (asynchronous call).
#_
#_
</article>
</node>
<node>
id=36
lv=2
dt=Text
nm=Area
ctime=3552736839
mtime=3607091184
<article>
#_**Area** - a table with the following fields:
#_
#_**Properties:**
#_
#_ Current: string
#_ Other: boolean
#_ Shell: boolean
#_ Viewer: boolean
#_ Editor: boolean
#_ Dialog: boolean
#_ Search: boolean
#_ Disks: boolean
#_ MainMenu: boolean
#_ Menu: boolean
#_ Help: boolean
#_ Info: boolean
#_ QView: boolean
#_ Tree: boolean
#_ FindFolder: boolean
#_ UserMenu: boolean
#_ ShellAutoCompletion: boolean
#_ DialogAutoCompletion: boolean
#_
#_**Functions:**
#_
#_ None.
#_
#_@@@
#_{dialog}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Dialog
#_{disks}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Disks
#_{editor}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Editor
#_{findfolder}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#FindFolder
#_{help}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Help
#_{info}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Info
#_{mainmenu}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#MainMenu
#_{menu}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Menu
#_{other}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Other
#_{qview}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#QView
#_{search}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Search
#_{shell}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Shell
#_{tree}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Tree
#_{usermenu}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#UserMenu
#_{viewer}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/general.html#Viewer
#_
</article>
</node>
<node>
id=46
lv=2
dt=Text
nm=APanel, PPanel
ctime=3553252677
mtime=3607094244
<article>
#_**APanel**, **PPanel** - tables with the following fields:
#_
#_**Properties:**
#_
#_ Bof: boolean
#_ ColumnCount: number
#_ CurPos: number
#_ Current: string
#_ DriveType: number
#_ Empty: boolean
#_ Eof: boolean
#_ FilePanel: boolean
#_ Filter: boolean
#_ Folder: boolean
#_ Format: string
#_ Height: number
#_ HostFile: string
#_ ItemCount: number
#_ Left: boolean
#_ LFN: boolean
#_ OPIFlags: number
#_ Path: string
#_ Path0: string
#_ Plugin: boolean
#_ Prefix: string
#_ Root: boolean
#_ SelCount: number
#_ Selected: boolean
#_ Type: number
#_ UNCPath: string
#_ Visible: boolean
#_ Width: number
#_
#_**Functions:**
#_
#_ None.
#_
#_@@@
#_{bof}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Bof
#_{columncount}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.ColumnCount
#_{curpos}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.CurPos
#_{current}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Current
#_{drivetype}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.DriveType
#_{empty}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Empty
#_{eof}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Eof
#_{filepanel}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.FilePanel
#_{filter}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Filter
#_{folder}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Folder
#_{format}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Format
#_{height}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Height
#_{hostfile}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.HostFile
#_{itemcount}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.ItemCount
#_{left}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Left
#_{lfn}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.LFN
#_{opiflags}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.OPIFlags
#_{path}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Path
#_{path0}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Path0
#_{plugin}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Plugin
#_{prefix}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Prefix
#_{root}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Root
#_{selcount}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.SelCount
#_{selected}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Selected
#_{type}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Type
#_{uncpath}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.UNCPath
#_{visible}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Visible
#_{width}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#APanel.Width
#_
</article>
</node>
<node>
id=57
lv=2
dt=Text
nm=Panel
ctime=3553252776
mtime=3607096893
<article>
#_**Panel** - a table with the following fields:
#_
#_**Properties:**
#_
#_ None.
#_
#_**Functions:**
#_
#_ FAttr
#_ FExist
#_ Item
#_ Select
#_ SetPath
#_ SetPos
#_ SetPosIdx
#_ `CustomSortMenu`
#_ `LoadCustomSortMode`
#_ `SetCustomSortMode`
#_
#_**Note:**
#_ Functions `CustomSortMenu`, `LoadCustomSortMode` and `SetCustomSortMode`
#_ are available only if the Lua engine is LuaJIT 2.x.
#_
#_@@@
#_[CustomSortMenu]: 82.html
#_[SetCustomSortMode]: 81.html
#_[LoadCustomSortMode]: 80.html
#_
#_{fattr}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#panel.fattr
#_{fexist}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#panel.fexist
#_{item}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#panel.item
#_{select}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#panel.select
#_{setpath}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#panel.setpath
#_{setpos}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#panel.setpos
#_{setposidx}: http://api.farmanager.com/ru/macro/macrocmd/prop_func/panels.html#panel.setposidx
#_
</article>
</node>
<node>
id=82
lv=3
dt=Text
nm=CustomSortMenu
ctime=3585577926
mtime=3607097005
<article>
#_Panel.CustomSortMenu ()
#_
#_**Parameters:**
#_ None
#_
#_**Returns:**
#_ Nothing
#_
#_**Description:**
#_ Displays a menu containing the list of loaded custom sort modes.
#_ Pressing **Enter** will set the selected sort mode in the active panel,
#_ pressing **CtrlEnter** - in the passive panel, **CtrlShiftEnter** - in both panels.
#_
#_
</article>
</node>
<node>
id=80
lv=3
dt=Text
nm=LoadCustomSortMode
ctime=3585324926
mtime=3607097121
<article>
#_Panel.LoadCustomSortMode (Mode, Settings)
#_
#_**Parameters:**
#_ Mode: sort mode; integer >=100 and <=0x7FFFFFFF
#_ Settings: a table containing the following fields:
#_ *Compare* (required field):
#_ Function, see its description below.
#_ *DirectoriesFirst, SelectedFirst, RevertSorting, SortGroups:*
#_ These optional fields specify corresponding sorting options:
#_ 0 - the option is off, 1 - the option is on. Any other value (or missing value)
#_ mean "use the current setting of Far Manager".
#_ *InvertByDefault:*
#_ Whether the default sort direction is the inverse one.
#_ *Indicator:*
#_ Indication of sort mode on the panel, a two character string
#_ (1-st character for the direct sort mode, 2-nd for the inverse one).
#_ *NoSortEqualsByName:*
#_ By default the elements equal from the sorting algorithm's point of view
#_ are sorted by name. If that is not desired, set this field in *true*.
#_ *Description:*
#_ Textual description of the sorting mode. If this field is specified
#_ it is used in the custom sort menu (see `Panel.CustomSortMenu`).
#_ *SortFunction:*
#_ Specify the sorting algorithm out of the 2 available ones.
#_ It is a string: "shellsort" (default value) or "qsort".
#_ *InitSort:*
#_ Function. If specified, it will be called before the sorting begins.
#_ It receives one argument: *FarOptions* table (see the same-named parameter
#_ of the function *Compare*).
#_ *EndSort:*
#_ Function. If specified, it will be called after the sorting ends.
#_
#_ If the value of *Settings* is nil or false, it means unloading (removal) of the given
#_ sorting mode.
#_
#_**Returns:**
#_ Nothing
#_
#_**Description:**
#_ This function loads (or unloads) a custom panel sort mode.
#_ Once the mode is loaded it can be set in the panel by means of calling
#_ `Panel.SetCustomSortMode`.
#_
#_**Function Compare**
#_ result = Compare (Pi1, Pi2, FarOptions)
#_
#_ **Parameters:**
#_ Pi1 è Pi2 - panel elements being compared, structures of `SortingPanelItem` type.
#_ FarOptions - a table containing the current Far Manager panel sort options
#_ (all values are boolean): *DirectoriesFirst, SelectedFirst,*
#_ *RevertSorting, SortGroups, NumericSort, CaseSensitiveSort*.
#_
#_ **Returns:**
#_ result - if the 1-st element should appear after direct sorting above the 2-nd one,
#_ a negative number should be returned, if below - a positive number,
#_ and if the elements are equal by sorting criteria - return zero.
#_
#_**Note 1:**
#_ Custom panel sorting uses the LuaJIT's FFI library. The use of FFI requires familiarity
#_ with its `documentation`.
#_
#_**Note 2:**
#_ Custom panel sort modes are automatically restored after Far Manager restart, provided
#_ that the configuration has been saved and the corresponding Panel.LoadCustomSortMode()
#_ calls are done during the process of loading macros.
#_ Restoring of custom panel sort modes takes place after the macros have been loaded,
#_ before the execution of auto-starting macros.
#_
#_**Note 3:**
#_ The custom panel sort modes are forcibly unloaded when the macros are unloaded.
#_
#_
#_**Example:**
#_ *-- Load the sorting by file name length.*
#_ local ffi = require "ffi"
#_ local C = ffi.C
#_ ffi.cdef [[
#_ int wcslen(const wchar_t`*`,const wchar_t`*`);
#_ ]]
#_ Panel.LoadCustomSortMode (100,
#_ {
#_ Compare = function(p1, p2, opt)
#_ return C.wcslen(p1.FileName) - C.wcslen(p2.FileName)
#_ end;
#_ Indicator = "bB";
#_ })
#_
#_@@@
#_[Panel.CustomSortMenu]: 82.html
#_[documentation]: http://luajit.org/ext_ffi.html
#_[Panel.SetCustomSortMode]: 81.html
#_[SortingPanelItem]: http://api.farmanager.com/ru/structures/sortingpanelitem.html
#_
#_
</article>
</node>
<node>
id=81
lv=3
dt=Text
nm=SetCustomSortMode
ctime=3585499487
mtime=3607097174
<article>
#_Panel.SetCustomSortMode (Mode, whatpanel)
#_
#_**Parameters:**
#_ Mode: sorting mode, an integer >=100 and <=0x7FFFFFFF
#_ whatpanel: 0=active panel, 1=passive panel
#_
#_**Returns:**
#_ Nothing
#_
#_**Description:**
#_ If the specified sorting mode is loaded (see `Panel.LoadCustomSortMode`), that sorting mode
#_ will be set in the specified panel. Otherwise, no actions will be done.
#_
#_**Example:**
#_ *-- Set the given custom sort mode in the active panel.*
#_ Macro {
#_ description="Sort files by their name lengths";
#_ area="Shell"; key="CtrlShiftF1";
#_ action=function() Panel.SetCustomSortMode(100,0) end;
#_ }
#_