1 local getopt
= require('getopt')
8 Perform bulk enrollment of 26 bit AWID style RFID Tags
9 For more info, check the comments in the code
13 script run lf_awid_bulkclone.lua -f 1 -b 1000
16 script run lf_awid_bulkclone.lua -f facility -b base_id_num
25 -- A debug printout-function
26 local function dbg(args
)
27 if not DEBUG
then return end
28 if type(args
) == 'table' then
39 -- This is only meant to be used when errors occur
40 local function oops(err
)
42 core
.clearCommandBuffer()
52 print(ansicolors
.cyan
..'Usage'..ansicolors
.reset
)
54 print(ansicolors
.cyan
..'Arguments'..ansicolors
.reset
)
56 print(ansicolors
.cyan
..'Example usage'..ansicolors
.reset
)
61 local function exitMsg(msg
)
62 print( string.rep('--',20) )
63 print( string.rep('--',20) )
68 local function showHelp()
69 print("Usage: script run <scriptname> [-h]")
71 print("-h \t This help")
74 local function main(args
)
77 print( string.rep('--',20) )
78 print( string.rep('--',20) )
81 if #args
== 0 then return help() end
83 for o
, a
in getopt
.getopt(args
, 'f:b:c:h') do
84 if o
== 'h' then return help() end
87 print('You did not supply a facility code, using 255')
95 print('You did not supply a starting card number, using 59615')
103 -- Example starting values
104 local sessionStart
= os
.date("%Y_%m_%d_%H_%M_%S") -- Capture the session start time
106 print("Session Start: " .. sessionStart
)
107 print("Facility Code,Card Number")
110 print(string.format("Preparing to Write: Facility Code %d, Card Number %d", fc
, cn
))
112 local command
= string.format("lf awid clone --fmt 26 --fc %d --cn %d", fc
, cn
)
113 core
.console(command
)
115 print(string.format("%d,%d", fc
, cn
))
117 print("Press Enter to continue with the next card number or type 'q' and press Enter to quit.")
118 local user_input
= io
.read()
120 if user_input
:lower() == 'q' then