Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[MENU] Another action on Enter than timeout
2014-03-17, 13:59
Post: #6
RE: [MENU] Another action on Enter than timeout
Works perfectly now.
The script automatically "cancels" the timeout if a incorrect key is pressed, thus returning to start.
The system is as good as watertight now. Only the cardreader can input data into the login system now :-)

Here is the completed script:
Code:
#!ipxe
set servermessage Please swipe your card  !
cpair --foreground 7 --background 0 0
cpair --foreground 7 --background 0 1
cpair --foreground 7 --background 0 2
cpair --foreground 7 --background 0 3
cpair --foreground 7 --background 0 4
cpair --foreground 7 --background 0 5
cpair --foreground 7 --background 0 6
cpair --foreground 7 --background 0 7
set lf:hex 0a
set lfs ${lf:string}${lf:string}${lf:string}
set lflong ${lfs}${lfs}${lfs}${lfs}${lfs}${lfs}${lfs}${lf:string}${lf:string}
set sp:hex 20
set ss ${sp:string}${sp:string}${sp:string}${sp:string}${sp:string}
set spaces ${ss}${ss}${ss}${ss}${ss}${sp:string}${sp:string}
:start
set scancount:int32 0
clear completeinput
set deftimeout 0
:continue
menu ${servermessage}
item --key 0 0
item --key 1 1
item --key 2 2
item --key 3 3
item --key 4 4
item --key 5 5
item --key 6 6
item --key 7 7
item --key 8 8
item --key 9 9
item
item
item
item
item
item
item
item
item
item cancel
choose --default cancel --timeout ${deftimeout} input && goto process || goto start
:process
iseq ${input} cancel && goto start || goto cproc
:cproc
set deftimeout 56
set servermessage Please swipe your card  !
inc scancount
set completeinput ${completeinput}${input}
iseq ${scancount} 10 && goto doprompt || goto continue
:doprompt
prompt --key 0x0a --timeout 56 ${spaces}Please swipe your card  !${lflong}${sp:string} && goto doecho || goto start
:doecho
chain http://192.168.1.2/boot.cgi?${completeinput}


The "set servermessage" line is actually printed by a perl script, so it can for example show the user "Invalid access card, try again" or "This access card is barred, please call IT dep!"
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [MENU] Another action on Enter than timeout - sebastian - 2014-03-17 13:59



User(s) browsing this thread: 1 Guest(s)