fabulousbasicfunctiondescriptionapp.fabulousprinter.com/files/pdf/basic_en_v1.7_20181207.pdfdocumenttype...

44
Document type Security class External Department Date Document number Version Status Page Fabulous Inc 2018-12-07 1.7 Release 1 (44) Fabulous BASIC Function Description Abstract It describes how to use Fabulous BASIC functions in Fabulous printers.

Upload: others

Post on 13-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 1 (44)

Fabulous BASIC Function Description

AbstractIt describes how to use Fabulous BASIC functions in Fabulousprinters.

Page 2: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 2 (44)

Table of contents1. INTRODUCTION......................................................................................................................51.1 DOWNLOAD BASIC SCRIPT FILE.......................................................................................... 51.2 EXECUTE BASIC SCRIPT......................................................................................................51.3 AUTOEXE.............................................................................................................................. 61.4 EXIT BASIC PROGRAM........................................................................................................ 7

2. BASIC COMMANDS................................................................................................................ 72.1 SYNTAX................................................................................................................................ 72.1.1 let..................................................................................................................................72.1.2 rem................................................................................................................................82.1.3 end................................................................................................................................ 82.1.4 if … then [… elif … then … else … ] endif...................................................................82.1.5 while … wend............................................................................................................... 92.1.6 do … until................................................................................................................... 102.1.7 for … to … next.......................................................................................................... 112.1.8 gosub … return && a labelled subroutine.................................................................12

2.2 FUNCTIONS......................................................................................................................... 132.2.1 print(s$)......................................................................................................................132.2.2 str$(i)..........................................................................................................................132.2.3 left$(s$, i)................................................................................................................... 132.2.4 mid$(s$, i, j)............................................................................................................... 142.2.5 right(s$, i)...................................................................................................................142.2.6 instr(s$,t$[,i])............................................................................................................. 142.2.7 chr$(i).........................................................................................................................152.2.8 len(s$).........................................................................................................................152.2.9 val(s$).........................................................................................................................162.2.10 asc(s$)........................................................................................................................ 162.2.11 getin$(i)...................................................................................................................... 162.2.12 floattostr$(f@[,i]).......................................................................................................172.2.13 strtofloat(s$)............................................................................................................... 172.2.14 inttofloat(i)................................................................................................................. 182.2.15 floattoint(@f)..............................................................................................................182.2.16 strcmp(a$,b$)............................................................................................................. 182.2.17 outputstringtodev(a$,b$)............................................................................................ 192.2.18 outputstringtolcd(a$,b$,x,y)....................................................................................... 202.2.19 sleep(i)........................................................................................................................202.2.20 now$(f$)..................................................................................................................... 212.2.21 nowadd$(t$,i,f$)......................................................................................................... 23

Page 3: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 3 (44)

2.2.22 readstring$(p$,i)........................................................................................................ 232.2.23 suspendgodexparser()................................................................................................ 252.2.24 resumegodexparser()..................................................................................................252.2.25 readalltext$(f$)...........................................................................................................252.2.26 beep(a,b,c)..................................................................................................................252.2.27 get_label_width()....................................................................................................... 262.2.28 get_label_q$()............................................................................................................ 262.2.29 get_print_speed ()...................................................................................................... 272.2.30 get_print_darkness().................................................................................................. 272.2.31 get_tear_position()..................................................................................................... 272.2.32 get_o_status()............................................................................................................. 282.2.33 get_print_mode()........................................................................................................282.2.34 get_cr_offset_x().........................................................................................................282.2.35 get_tq_offset_y().........................................................................................................292.2.36 get_print_direction().................................................................................................. 292.2.37 get_code_page$()....................................................................................................... 292.2.38 get_model_version$().................................................................................................292.2.39 stddb_open(s$)........................................................................................................... 302.2.40 stddb_close(i)............................................................................................................. 322.2.41 stddb_rs_MoveFirst(i)................................................................................................322.2.42 stddb_rs_MoveLast(i).................................................................................................322.2.43 stddb_rs_MoveNext(i)................................................................................................ 322.2.44 stddb_rs_MovePrevious(i)......................................................................................... 332.2.45 stddb_rs_MoveTo(i,j)................................................................................................. 332.2.46 stddb_rs_RecordIndex(i)............................................................................................332.2.47 stddb_rs_RecordCounts(i)......................................................................................... 332.2.48 stddb_rs_FieldCounts(i).............................................................................................332.2.49 stddb_rs_FieldsByName$(i,s$).................................................................................. 342.2.50 stddb_rs_FieldsByItem$(i,j).......................................................................................342.2.51 stddb_rs_FindFirstByFieldName(i,f$,k$,r)................................................................342.2.52 stddb_rs_FindFirstByFieldItem (i,f,k$,r)...................................................................352.2.53 EnableFwAllPortRx(n)...............................................................................................362.2.54 EnableFwKeyboardRx(n)...........................................................................................362.2.55 set_show_data_recv_time(n)......................................................................................362.2.56 FileExists(s$)..............................................................................................................372.2.57 FileCreate(s$)............................................................................................................ 372.2.58 FileOpen(s$,m)...........................................................................................................382.2.59 FileClose(i).................................................................................................................382.2.60 FileWrite(i,s$,n)......................................................................................................... 392.2.61 FileRealSize(i)............................................................................................................392.2.62 FileSeek(i,o,n)............................................................................................................ 392.2.63 FileRead(i,n).............................................................................................................. 392.2.64 DeleteFile(s$).............................................................................................................40

2.3 SUPPORTED OPERATOR IN EXPRESSION.............................................................................. 41

Page 4: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 4 (44)

2.3.1 Logical not..................................................................................................................412.3.2 Logical or................................................................................................................... 422.3.3 Logical and.................................................................................................................43

3. VERSION HISTORY.............................................................................................................. 44

Page 5: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 5 (44)

1. Introduction

1.1 Download BASIC script file~MSETT,name<CR>nnnnnnnn<data> : Download the BASIC Script file to printer

Syntax ~MSETT,name<CR>nnnnnnnn<data>

Parameter

name = the name of savednnnnnnnn = data size (8 digits)data = data to be saved

1.2 Execute BASIC Script

~EXE,name : execute the BASIC script stored in the printer.

Syntax ~EXE,nameParamete

r name = the name of saved BASIC command file

A simple tool BASICTool.exe provides the above two functions

Description Comments

Run “BASICTool.exe”. Click“Download BASIC file” button.

Page 6: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 6 (44)

Select “basci01” file and openit.Note: Please check thecontent of “basci01” file onchap 2.1.1.

Input “basci01” on file nameEditor and click “Execute”button.

Print outstring C$ = testinteger f = 57float I@ = 3.452000

1.3 AutoexeDownload the BASIC Script file named as autoexe to printer. It will execute autoexe scriptfile automatically when printer is turned on.(similar to AutoForm)

Page 7: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 7 (44)

1.4 Exit BASIC programIf the BASIC program is in infinite loop, you can press FEED button to exit BASIC process.

2. BASIC Commands

2.1 Syntax

2.1.1 letSyntax letParameters NoneDescription Assign the value of variable

String variable : a&~z$, A&~Z$Integer variable : a~z,A~Z

Page 8: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 8 (44)

Floating variable : a@~z@,A@~Z@Sample rem Variable Test

let A$ = "te"let B$ = "st"C$ = A$ + B$let d = 45let e = 12f = d + elet G@=1.23let H@=2.222I@ = G@ + H@print("^Q30,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,string C$ = " + C$ + "\r\n")print("AD,10,50,1,1,0,0E,integer f = " + str$(f) + "\r\n")print("AD,10,80,1,1,0,0E,float I@ = " + floattostr$(I@) + "\r\n")print("E\r\n")end

Result string C$ = testinteger f = 57float I@ = 3.452000

2.1.2 remSyntax remParameter noneDescription Used for commentExample See 2.1.1

2.1.3 endSyntax endParameter noneDescription End of programExample See 2.1.1

2.1.4 if … then [… elif … then … else … ] endifSyntax if … then [… elif … then … else … ] endifParameter None

Page 9: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 9 (44)

Description Conditionally executes statements, depending on the value of an expression.Sample print("^Q50,0,0\r\n")

print("^L\r\n")

let g$="1.23"let a@=strtofloat(g$)let h$="3.45"let b@ = strtofloat(h$)

print("AD,30,30,1,1,0,0E,a@ = " + floattostr$(a@) + " g$=" + g$ + "\r\n")print("AD,30,80,1,1,0,0E,b@ = " + floattostr$(b@) + " h$=" + h$ + "\r\n")

let y = 130if a@=b@ then

print("AD,30," + str$(y) + ",1,1,0,0E,a@ equals b@\r\n")else

print("AD,30," + str$(y) + ",1,1,0,0E,a@ does NOT equal b@\r\n")y = 180if a@>b@ then

print("AD,30," + str$(y) + ",1,1,0,0E,a@=" + floattostr$(a@) + "is larger\r\n")

elseprint("AD,30," + str$(y) + ",1,1,0,0E,b@=" + floattostr$(b@) + "

is larger\r\n")endif

endif

print("E\r\n")end

Result a@ = 1.230000 g$=1.23b@ = 3.450000 h$=3.45a@ does NOT equal b@b@=3.450000 is larger

2.1.5 while … wendSyntax While … wendParameter NoneDescription Runs statements if a given condition is True.

Page 10: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 10 (44)

Sample print("^Q50,0,0\r\n")print("^L\r\n")let a@=1let y = 10while a@<5

print("AD,30," + str$(y) + ",1,1,0,0E,floattostr$(a@)=" + floattostr$(a@)+ "\r\n")

a@=a@+0.6y = y +50

wendprint("E\r\n")end

Result floattostr$(a@)=1.000000floattostr$(a@)=1.600000floattostr$(a@)=2.200000floattostr$(a@)=2.800000floattostr$(a@)=3.400000floattostr$(a@)=4.000000floattostr$(a@)=4.600000

2.1.6 do … untilSyntax While … wendParameter None

Description Runs statements if a given condition is True.Sample print("^Q50,0,0\r\n")

print("^L\r\n")let a=1let y = 10doif a % 2 = 0 thenprint("AD,30," + str$(y) + ",1,1,0,0E,str$(a)=" + str$(a) + " is even\r\n")elseprint("AD,30," + str$(y) + ",1,1,0,0E,str$(a)=" + str$(a) + " is odd\r\n")endifa=a+1y = y +50until a>5print("E\r\n")end

Result str$(a)=1 is oddstr$(a)=2 is even

Page 11: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 11 (44)

str$(a)=3 is oddstr$(a)=4 is evenstr$(a)=5 is odd

2.1.7 for … to … nextSyntax For … to … nextParameter noneDescription Repeats statements a specified timesExample print("^Q50,0,0\r\n")

print("^L\r\n")let a=1let y = 10let s=4for a=1 to 5

print("AD,30," + str$(y) + ",1,1,0,0E,a=" + str$(a) + "\r\n")y = y +50

next aprint("E\r\n")

print("^L\r\n")let a=1let y = 10for a=1 to 5 step 2

print("AD,30," + str$(y) + ",1,1,0,0E,a=" + str$(a) + "\r\n")y = y +50

next aprint("E\r\n")

print("^L\r\n")let a=1let y = 10for a=1 to 5 step s

print("AD,30," + str$(y) + ",1,1,0,0E,a=" + str$(a) + "\r\n")y = y +50

next aprint("E\r\n")end

Result a=1a=2a=3a=4

Page 12: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 12 (44)

a=5

a=1a=3a=5

a=1a=5

2.1.8 gosub … return && a labelled subroutineSyntax gosub … returnParameter noneDescription go to a labelled subroutine

A labelled segment must be marked with “:” symbol., and placed behind of“end”.

Example print("^Q60,0,0\r\n")print("^L\r\n")

let a=1let y = 10while a<5

if a % 2 = 0 thengosub "printeven"

elsegosub "printodd"

endifa=a+1y = y +50

wendprint("E\r\n")end

:printevenprint("AD,30," + str$(y) + ",1,1,0,0E," + str$(a) + " is even\r\n")return

:printoddprint("AD,30," + str$(y) + ",1,1,0,0E," + str$(a) + " is odd\r\n")return

Page 13: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 13 (44)

Result 1 is odd2 is even3 is odd4 is even

2.2 Functions

2.2.1 print(s$)Syntax print(s$)Parameter StringDescription Output data to buffer of printerExample See 2.1.1

2.2.2 str$(i)Syntax str$(i)Parameter i = [integer]Description returns the integer value i as a stringExample let a = 123

let b$ = str$(a)print("^Q30,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,b$ = " + b$ + "\r\n")print("E\r\n")end

Result b$ = 123

2.2.3 left$(s$, i)Syntax left$(s$, i)Parameter s$ = [string]

i = [integer] end indexDescription returns the first i characters of s$Example let a$ = "FabulousTest"

let b$ = left$(a$,2)

Page 14: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 14 (44)

print("^Q30,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,b$ = " + b$ + "\r\n")print("E\r\n")end

Result b$ = Go

2.2.4 mid$(s$, i, j)Syntax mid$(s$, i, j)Parameter s$ = [string]

i = [integer] start indexj = [integer] end index

Description returns the substring of length j starting at position i in s$Example let a$ = "FabulousTest"

let b$ = mid$(a$,2,3)print("^Q30,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,b$ = " + b$ + "\r\n")print("E\r\n")end

Result b$ = oDE

2.2.5 right(s$, i)Syntax right(s$, i)Parameter s$ = [string]

i = [integer]Description returns the last i characters of s$Example let a$ = "FabulousTest"

let b$ = right$(a$,3)print("^Q30,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,b$ = " + b$ + "\r\n")print("E\r\n")end

Result b$ = est

2.2.6 instr(s$,t$[,i])Syntax instr(s$,t$)

Orinstr(s$,t$,i)

Page 15: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 15 (44)

Parameter s$ = [string] The string to be searchedt$ = [string] The string to search fori = [integer] start index (j >= 1)

Description returns the position of the string t$ in s$Example let a$ = "FabulousTest"

let b$ = "Test"let p = instr(a$,b$)print("^L\r\n")print("AD,10,30,1,1,0,0E,p(Position) = " + str$(p) +"\r\n")print("E\r\n")end

Result p(Position) = 6

2.2.7 chr$(i)Syntax chr$(i)Parameter i = [interger] (0~127)Description returns the ASCII character of iExample print("^Q30,0,0\r\n")

print("^L\r\n")print("AD,10,20,1,1,0,0E,chr = " + chr$(97) + "\r\n")print("E\r\n")end

Result chr = a

2.2.8 len(s$)Syntax len(s$)Parameter s$ = [string]Description returns the number of characters in s$Example let a$ = "FabulousTest"

let b = len(a$)print("^Q30,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,b = " + str$(b) + "\r\n")print("E\r\n")end

Result b = 9

Page 16: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 16 (44)

2.2.9 val(s$)Syntax val(s$)Parameter s$ = [string]Description returns the integer value of the string of digits s$Example let a$ = "123"

let b = val(a$)print("^Q30,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,b$ = " + str$(b) + "\r\n")print("E\r\n")end

Result b$ = 123

2.2.10 asc(s$)Syntax asc(s$)Parameters s$ = [string]Description returns the ASCII code for the first character in s$Example let b = asc("a")

print("^Q30,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,b$ = " + str$(b) + "\r\n")print("E\r\n")end

Result b$ = 97

2.2.11 getin$(i)Syntax getin$(i)

Parameter i = [integer] the length of bytes receivedPS If i = 0, it means to receive data until input data is “Enter”. (“\r\n”)

Description Receive data [string] from portThis command will wait and go to next line until the data received.

Example

print("^Q30,0,0\r\n")let a$ = getin$(0)rem input “Fabulous”print("\r\n")print("^L\r\n")

Page 17: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 17 (44)

print("AD,10,30,1,1,0,0E,input data(a$) = "+ a$ + "\r\n")print("E\r\n")end

Result input data(a$) = godex

2.2.12 floattostr$(f@[,i])Syntax floattostr$(f@[,i])

Parameter f@ = [float]i = [integer]: numbers of digits for a floating value

Description Return a string from a floating value

Example

print("^Q30,0,0\r\n")let a@ = 123.456print("^L\r\n")print("AD,10,30,1,1,0,0E,a@ = "+ floattostr$(a@) + "\r\n")print("AD,10,80,1,1,0,0E,a@ = "+ floattostr$(a@,4) + "\r\n")print("AD,10,130,1,1,0,0E,a@ = "+ floattostr$(a@,2) + "\r\n")print("E\r\n")end

Resulta@ = 123.456000a@ = 123.4560a@ = 123.46

2.2.13 strtofloat(s$)Syntax strtofloat(s$)Parameter s$ = [string]Description Return a floating value

Example

print("^Q30,0,0\r\n")let s$ = "123.456"let a@ = strtofloat(s$)a@ = a@ + 1000print("^L\r\n")print("AD,10,30,1,1,0,0E,a@ = "+ floattostr$(a@) + "\r\n")print("E\r\n")end

Result a@ = 1123.456000

Page 18: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 18 (44)

2.2.14 inttofloat(i)Syntax inttofloat(i)Parameter i = [integer]Description Return a floating value

Example

print("^Q30,0,0\r\n")let s$ = "123.456"let a@ = 123.456let A = floattoint(a@)let b = 123let B@ = inttofloat(b)print("^L\r\n")print("AD,10,30,1,1,0,0E,A = "+ str$(A) + "\r\n")print("AD,10,80,1,1,0,0E,B@ = "+ floattostr$(B@) + "\r\n")print("E\r\n")end

Result A = 123B@ = 123.00000

2.2.15 floattoint(@f)Syntax floattoint(@f)Parameter f@ = [float]Description Return an interger valueExample See 2.2.14Result See 2.2.14

2.2.16 strcmp(a$,b$)Syntax strcmp(a$,b$)

Parameter a$ = [string]b$ = [string]

Description Return 0 if a$ is as same as b$

Example

let a$="123abc"print("^Q50,0,0\r\n")print("^L\r\n")let b$="Fabulous"print("AD,30,30,1,1,0,0E,a$=" + a$ + "\r\n")print("AD,30,80,1,1,0,0E,b$=" + b$ + "\r\n")let y = 130if strcmp(a$,b$)=0 then

Page 19: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 19 (44)

print("AD,30," + str$(y) + ",1,1,0,0E,a$ equals b$\r\n")else

print("AD,30," + str$(y) + ",1,1,0,0E,a$ does NOT equal b$\r\n")endifb$=a$print("AD,30,180,1,1,0,0E,a$=" + a$ + "\r\n")y = y + 50print("AD,30,230,1,1,0,0E,b$=" + b$ + "\r\n")let y = 280if strcmp(a$,b$)=0 then

print("AD,30," + str$(y) + ",1,1,0,0E,a$ equals b$\r\n")else

print("AD,30," + str$(y) + ",1,1,0,0E,a$ does NOT equal b$\r\n")endifprint("E\r\n")end

Result

a$=123abcb$=Fabulousa$ does NOT equal b$a$=123abcb$=123abca$ equals b$

2.2.17 outputstringtodev(a$,b$)Syntax outputstringtodev

Parameter

a$ = [string]: Output data stringb$ = [string] Interface name.“com”: output data to RS232“auto”: output data to the interface the used last time

Description Output data to specific interface

Example

let a$="123abc"let b$="Fabulous"let y = 130if strcmp(a$,b$)=0 then

outputstringtodev(a$ + " equals " + b$, "com")else

outputstringtodev(a$ + " does NOT equal " + b$, "com")endifend

Result Output data via RS232:

Page 20: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 20 (44)

123abc does NOT equal Fabulous

2.2.18 outputstringtolcd(a$,b$,x,y)Syntax outputstringtolcd

Parameter

a$ = [string]: Output stringb$ = [string] the type of LCD.“standard”: standard LCDx= [integer]: x-coordination (dots)y = [integer] y-coordination (dots)

Description Output data to LCD

Example

let s$="Input Data:"outputstringtolcd(s$,"standard",30,135)

let a$ = getin$(0)

print("\r\n^Q20,0,0\r\n")print("\r\n^L\r\n")print("\r\nAD,10,30,1,1,0,0E,input data(a$) = "+ a$+"\r\n")print("\r\nE\r\n")end

Result

Display "Input Data:" as the following image:

Type “Fabulous”, then print out:

input data(a$) = Fabulous

2.2.19 sleep(i)Syntax inttofloat(i)

Parameter i = [integer]unit: ms

Description Suspend the basic program for i ms.Example let a$ = "123"

Page 21: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 21 (44)

print("^Q30,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,a$ = " + a$ + "\r\n")print("E\r\n")

sleep(5000)

let b$ = "abc"print("^Q30,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,b$ = " + b$ + "\r\n")print("E\r\n")

end

Result

a$ = 123

5 seconds later, print out:

b$ = abc

2.2.20 now$(f$)Syntax now$(f$)Parameter f$:[string]-Format (see bellow description)Description Return a string of current Time

Example

let a$=now$()print("^Q10,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,now$(N) = " + a$ + "\r\n")print("E\r\n")

let b$=now$("##%H:%M:%S %Y-%m-%d##")print("^Q10,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,now$(F) = " + b$ + "\r\n")print("E\r\n")end

Result now$(N) = 2017-06-07 16:33:09now$(F) = ##16:33:09 2017-06-07##

specifier Replaced by Example

%a Abbreviated weekday name * Thu

Page 22: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 22 (44)

%A Full weekday name * Thursday

%b Abbreviated month name * Aug

%B Full month name * August

%c Date and time representation *Thu Aug 23 14:55:02

2001

%C Year divided by 100 and truncated to integer (00-99) 20

%d Day of the month, zero-padded (01-31) 23

%D Short MM/DD/YY date, equivalent to %m/%d/%y 08/23/01

%e Day of the month, space-padded ( 1-31) 23

%F Short YYYY-MM-DD date, equivalent to %Y-%m-%d 2001-08-23

%g Week-based year, last two digits (00-99) 01

%G Week-based year 2001

%h Abbreviated month name * (same as %b) Aug

%H Hour in 24h format (00-23) 14

%I Hour in 12h format (01-12) 02

%j Day of the year (001-366) 235

%m Month as a decimal number (01-12) 08

%M Minute (00-59) 55

%n New-line character ('\n')

%p AM or PM designation PM

%r 12-hour clock time * 02:55:02 pm

%R 24-hour HH:MM time, equivalent to %H:%M 14:55

%S Second (00-61) 02

%t Horizontal-tab character ('\t')

%T ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S 14:55:02

%u ISO 8601 weekday as number with Monday as 1 (1-7) 4

%UWeek number with the first Sunday as the first day of week one (00-

53)33

%V ISO 8601 week number (01-53) 34

%w Weekday as a decimal number with Sunday as 0 (0-6) 4

%WWeek number with the first Monday as the first day of week one (00-

53)34

%x Date representation * 08/23/01

%X Time representation * 14:55:02

%y Year, last two digits (00-99) 01

Page 23: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 23 (44)

%Y Year 2001

%z ISO 8601 offset from UTC in timezone (1 minute=1, 1 hour=100)If timezone cannot be determined, no characters +100

%Z Timezone name or abbreviation *If timezone cannot be determined, no characters CDT

%% A % sign %

2.2.21 nowadd$(t$,i,f$)Syntax nowadd$(t$,i,f$)

Parametert$:[string] (t$=”y” or “m” or “d”)i:[integer]f$:[string]-Format

Description Return a string of current Time

Example

let a$ = now$()print("^Q10,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,now$ = " + a$ + "\r\n")print("E\r\n")

let b$ = nowadd$("y",1)print("^Q10,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,nowadd$(1y) = " + b$ + "\r\n")print("E\r\n")

let c$ = nowadd$("d",1,"##%H:%M:%S %Y-%m-%d##")print("^Q10,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,nowadd$(1d) = " + c$ + "\r\n")print("E\r\n")end

Resultnow$ = 2017-06-07 16:54:10nowadd$(1y) = 2018-06-07 16:54:10nowadd$(1d) = ##16:54:10 2017-06-08##

2.2.22 readstring$(p$,i)Syntax readstring$(p$,i,f$)

Parameter p$:[string] (p$=“com”, “usb”, “net”, “bt”, “keyboard”)i:[integer] (the time of reading data; unit: ms)

Description Return a string or NULL

Page 24: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 24 (44)

Example 1

let w$ = ""EnableFwAllPortRx(0)for m=1 to 100

w$ = w$ + readstring$("com",50)next mEnableFwAllPortRx(1)print("^Q10,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,w$ = " + w$ + "\r\n")print("E\r\n")end

Note: be sure to send data(for example “Test01”) to the printer’s com port in 5seconds after running this script.

Result Print outTest01

Example 2

beep(200,200,1)EnableFwKeyboardRx(0)

let k$ = ""a = 1while (a > 0)

k$ = k$ + readstring$("keyboard",50)sleep(50)f = instr(k$,"\r")if(f > 0) then

beep(200,200,3)a = 0

endifwendoutputstringtodev("k$="+k$,"com")

EnableFwKeyboardRx(1)end

Result

Key in “Test01\r”The following text shown in terminal:k$=Test01

Page 25: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 25 (44)

2.2.23 suspendgodexparser()Syntax suspendgodexparser()Parameter None

Description When using readstring$(), avoid the data is received by godex parser.

Example See the example of 2.2.22

2.2.24 resumegodexparser()Syntax resumegodexparser()Parameter None

DescriptionAfter finishing using readstring$() and suspendgodexparser(), remember toresume godex parser. Otherwise it might happen unexpected results on theprinter.

Example See the example of 2.2.22

2.2.25 readalltext$(f$)Syntax readalltext$(f$)Parameter f$:[string], file name.Description Return a string of the file

Example

Assume that “Test01.txt” is stored in the printer.The content is “Fabulous”

let w$ = ""w$ = readalltext$("Test01")print("^Q10,0,0\r\n")print("^L\r\n")print("AD,10,20,1,1,0,0E,w$ = " + w$ + "\r\n")print("E\r\n")end

Result Print outFabulous

2.2.26 beep(a,b,c)Syntax beep(a,b,c)

Parameter a:[integer] beeping time (ms)b:[integer] gap time (ms)

Page 26: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 26 (44)

c:[integer] how many cyclesDescription Return a string of the file

Example beep(200,100,2)end

Result

It sound as the following-.-.

Note:-: beeping time about 200ms.: quiet time about 100msTotal 2 cycles.

2.2.27 get_label_width()Syntax get_label_width()Parameter N/ADescription returns the integer value of the current label width

Example

print("^W100\r\n")sleep(100)w = get_label_width()outputstringtodev("w="+str$(w),"com")end

Result Output data:w=100

2.2.28 get_label_q$()Syntax get_label_q$()Parameter N/ADescription Return a string of the ^Q information

Example

print("^Q102,3\r\n")sleep(100)r$ = get_label_q$()outputstringtodev("r$="+r$,"com")

end

Result Output data:r$=^Q102,3

Page 27: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 27 (44)

2.2.29 get_print_speed ()Syntax get_print_speed()Parameter N/ADescription returns the integer value of printing speed

Example

print("^S4\r\n")sleep(100)s = get_print_speed()outputstringtodev("s="+str$(s),"com")end

Result Output data:s=4

2.2.30 get_print_darkness()Syntax get_print_darkness()Parameter N/ADescription returns the integer value of printing darkness

Example

print("^H5\r\n")sleep(100)x = get_print_darkness()outputstringtodev("x="+str$(x),"com")end

Result Output data:x=5

2.2.31 get_tear_position()Syntax get_tear_position()Parameter N/ADescription returns the integer value of tear-off

Example

print("^E8\r\n")a = get_tear_position()outputstringtodev("a="+str$(a),"com")end

Result Output data:a=8

Page 28: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 28 (44)

2.2.32 get_o_status()Syntax get_o_status()Parameter N/ADescription returns the integer value of ^O parameter.

Example

print("^O0\r\n")a = get_o_status()outputstringtodev("a="+str$(a),"com")end

Result Output data:a=0

2.2.33 get_print_mode()Syntax get_print_mode()Parameter N/ADescription returns the integer value of printing mode

Example

print("^AT\r\n")a = get_print_mode()outputstringtodev("a="+str$(a),"com")

print("^AD\r\n")b = get_print_mode()outputstringtodev("b="+str$(b),"com")end

ResultOutput data:a=84b=68

2.2.34 get_cr_offset_x()Syntax get_cr_offset_x()Parameter N/ADescription returns the integer value of ^R parameter. (offset X)

Example

print("^R0\r\n")a = get_cr_offset_x()outputstringtodev("get_cr_offset_x()="+str$(a),"com")end

Result Output data:get_cr_offset_x()=0

Page 29: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 29 (44)

2.2.35 get_tq_offset_y()Syntax get_tq_offset_y()Parameter N/ADescription returns the integer value of ~Q parameter. (offset Y)

Example

print("~Q0\r\n")a = get_tq_offset_y()outputstringtodev("get_tq_offset_y()="+str$(a),"com")end

Result Output data:get_tq_offset_y()=0

2.2.36 get_print_direction()Syntax get_print_direction()Parameter N/ADescription returns the integer value of printing direction

Example

print("~R200\r\n")a = get_print_direction()outputstringtodev("get_print_direction()="+str$(a),"com")end

Result Output data:get_print_direction()=200

2.2.37 get_code_page$()Syntax get_code_page$()Parameter N/ADescription Return a string of the code page information

Examplea$ = get_code_page$()outputstringtodev("get_code_page$()="+a$,"com")end

Result Output data:get_code_page$()=Code Page:850

2.2.38 get_model_version$()Syntax get_model_version$()Parameter N/ADescription Return a string of the model and version information

Page 30: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 30 (44)

Examplea$ = get_model_version$()outputstringtodev("get_model_version$()="+a$,"com")end

Result Output data:get_model_version$()=ZX420i V2.UL1

2.2.39 stddb_open(s$)Syntax stddb_open(s$)Parameter s$ = [string], file name of the database

Description returns a pointer value to a database object0 means open failure.

CSVFile in PC

Note: Please Save it as “CSVFile.csv” in PC and download it into the printerby GoLabel.

The commandcontent ofDownloading“CSVFile.csv”

~MDELD,CSVFile~L,DBASECSV,CSVFile,135Name,Number,AddressA0,11111111,"000,aaaaaaaaaaaa"A1111,22222222,"000,bbbb"A22,33333333,"000,cccc"A333,44444444,"000,dddddddd"

View it in theprinter

~MDIRDirectory of 'FLASH'CSVFile DBF 4 KB65234 KB free

Example

A = stddb_open("CSVFile")outputstringtodev("stddb_open(),A="+str$(A),"com")n = stddb_rs_RecordCounts(A)outputstringtodev("stddb_rs_RecordCounts(),n="+str$(n),"com")stddb_rs_MoveFirst(A)outputstringtodev("after stddb_rs_MoveFirst(A),A="+str$(A),"com")

for i=1 to nx$ = stddb_rs_FieldsByName$(A,"Name")

Page 31: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 31 (44)

y$ = stddb_rs_FieldsByName$(A,"Number")z$ = stddb_rs_FieldsByName$(A,"Address")rem x$ = stddb_rs_FieldsByItem$(A,0)rem y$ = stddb_rs_FieldsByItem$(A,1)rem z$ = stddb_rs_FieldsByItem$(A,2)

outputstringtodev("i="+str$(i),"com")outputstringtodev("Name="+x$,"com")outputstringtodev("Number="+y$,"com")outputstringtodev("Address="+z$,"com")stddb_rs_MoveNext(A)

next i

stddb_close(A)outputstringtodev("stddb_close(),A="+str$(A),"com")end

A = stddb_open("CSVFile")outputstringtodev("stddb_open(),A="+str$(A),"com")n = stddb_rs_RecordCounts(A)outputstringtodev("stddb_rs_RecordCounts(),n="+str$(n),"com")m = stddb_rs_FieldCounts(A)outputstringtodev("stddb_open(),n="+str$(m),"com")stddb_rs_MoveFirst(A)outputstringtodev("after stddb_rs_MoveFirst(A),A="+str$(A),"com")

for i=1 to noutputstringtodev("i="+str$(i),"com")z$ = ""for j=1 to m

rem x$ = stddb_rs_FieldsByName$(A,"Name")rem y$ = stddb_rs_FieldsByName$(A,"Number")rem z$ = stddb_rs_FieldsByName$(A,"Address")x$ = stddb_rs_FieldsByItem$(A,j-1)z$=z$+x$+";"

next joutputstringtodev(z$,"com")stddb_rs_MoveNext(A)

next i

stddb_close(A)outputstringtodev("stddb_close(),A="+str$(A),"com")end

Result Output data:

Page 32: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 32 (44)

stddb_open(),A=1098054420stddb_rs_RecordCounts(),n=4after stddb_rs_MoveFirst(A),A=1098054420i=1Name=A0Number=11111111Address=000,aaaaaaaaaaaai=2Name=A1111Number=22222222Address=000,bbbbi=3Name=A22Number=33333333Address=000,cccci=4Name=A333Number=44444444Address=000,ddddddddstddb_close(),A=1098054420

2.2.40 stddb_close(i)Syntax stddb_close(i)Parameter i = [integer], a pointer value to a database objectDescription Close a database.Example See the example in chap �2.2.39

2.2.41 stddb_rs_MoveFirst(i)Syntax stddb_rs_MoveFirst(i)Parameter i = [integer], a pointer value to a database objectDescription Move to the first record in the database.Example See the example in chap �2.2.39

2.2.42 stddb_rs_MoveLast(i)Syntax stddb_rs_MoveLast(i)Parameter i = [integer], a pointer value to a database objectDescription Move to the last record in the database.Example N/A

2.2.43 stddb_rs_MoveNext(i)Syntax stddb_rs_MoveNext(i)Parameter i = [integer], a pointer value to a database object

Page 33: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 33 (44)

Description Move to the next record in the database.Example See the example in chap �2.2.39

2.2.44 stddb_rs_MovePrevious(i)Syntax stddb_rs_MovePrevious(i)Parameter i = [integer], a pointer value to a database objectDescription Move to the Previous record in the database.Example N/A

2.2.45 stddb_rs_MoveTo(i,j)Syntax stddb_rs_MoveTo(i,j)

Parameteri = [integer], a pointer value to a database objectj = [integer], the jth record in the database.(range:0~ stddb_rs_RecordCounts()-1)

Description Move to the specified record j in the database.Example See the example in chap �2.2.51

2.2.46 stddb_rs_RecordIndex(i)Syntax stddb_rs_RecordIndex(i)Parameter i = [integer], a pointer value to a database objectDescription Returns the current record in the databaseExample N/A

2.2.47 stddb_rs_RecordCounts(i)Syntax stddb_rs_RecordCounts(i)Parameter i = [integer], a pointer value to a database objectDescription Returns the total records in the databaseExample See the example in chap �2.2.39

2.2.48 stddb_rs_FieldCounts(i)Syntax stddb_rs_FieldCounts(i)Parameter i = [integer], a pointer value to a database objectDescription Returns the total fields in the database

Page 34: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 34 (44)

Example N/A

2.2.49 stddb_rs_FieldsByName$(i,s$)Syntax stddb_rs_FieldsByName$(i,s$)

Parameter i = [integer], a pointer value to a database objects$ = [string], the Field name

Description Return a string of the s$ field’s contentExample See the example in chap �2.2.39

2.2.50 stddb_rs_FieldsByItem$(i,j)Syntax stddb_rs_FieldsByItem$(i,j)

Parameter i = [integer], a pointer value to a database objectj = [integer], the index of Field (range:0~ stddb_rs_FieldCounts()-1)

Description Return a string of the jth field’s contentExample See the example in chap �2.2.52

2.2.51 stddb_rs_FindFirstByFieldName(i,f$,k$,r)Syntax stddb_rs_FindFirstByFieldName(i,f$,k$,r)

Parameter

i = [integer], a pointer value to a database objectf$ = [string], field namek$ = [string], keyword to searchr = [integer], start record index

Description Returns the first record index which is matched the condition.Returns -1 if the condition is not matched.

Example

A = stddb_open("CSVFile")outputstringtodev("stddb_open(),A="+str$(A),"com")

i=stddb_rs_FindFirstByFieldName(A,"Name","A22",0)outputstringtodev("stddb_rs_FindFirstByFieldName() i="+str$(i),"com")

stddb_rs_MoveTo(A,i)x$ = stddb_rs_FieldsByName$(A,"Name")y$ = stddb_rs_FieldsByName$(A,"Number")z$ = stddb_rs_FieldsByName$(A,"Address")

outputstringtodev("Name="+x$,"com")outputstringtodev("Number="+y$,"com")outputstringtodev("Address="+z$,"com")

Page 35: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 35 (44)

stddb_close(A)outputstringtodev("stddb_close(),A="+str$(A),"com")

end

Result

stddb_open(),A=1098055152stddb_rs_FindFirstByFieldName() i=2Name=A22Number=33333333Address=000,ccccstddb_close(),A=1098055152

2.2.52 stddb_rs_FindFirstByFieldItem (i,f,k$,r)Syntax stddb_rs_FindFirstByFieldItem(i,f,k$,r)

Parameter

i = [integer], a pointer value to a database objectf = [integer], field indexk$ = [string], keyword to searchr = [integer], start record index

Description Returns the first record index which is matched the condition.Returns -1 if the condition is not matched.

Example

A = stddb_open("CSVFile")outputstringtodev("stddb_open(),A="+str$(A),"com")

i=stddb_rs_FindFirstByFieldItem(A,0,"A22",0)outputstringtodev("stddb_rs_FindFirstByFieldItem() i="+str$(i),"com")

stddb_rs_MoveTo(A,i)x$ = stddb_rs_FieldsByItem$(A,0)y$ = stddb_rs_FieldsByItem$(A,1)z$ = stddb_rs_FieldsByItem$(A,2)

outputstringtodev("Name(0)="+x$,"com")outputstringtodev("Number(1)="+y$,"com")outputstringtodev("Address(2)="+z$,"com")

stddb_close(A)outputstringtodev("stddb_close(),A="+str$(A),"com")

end

Result

stddb_open(),A=1098055152stddb_rs_FindFirstByFieldItem() i=2Name(0)=A22Number(1)=33333333Address(2)=000,cccc

Page 36: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 36 (44)

stddb_close(),A=1098055152

2.2.53 EnableFwAllPortRx(n)Syntax EnableFwAllPortRx(n)

Parametern = [integer]0: Disabled1:Enabled

Description

When using readstring$(), EnableFwAllPortRx(0) can avoid the data is receivedby printer firmware.

After finishing using readstring$() and EnableFwAllPortRx(0), remember toenable[EnableFwAllPortRx(1)] printer firmware to receive data from allinterfaces. Otherwise it might happen unexpected results on the printer.

Example See the example 1 of 2.2.22

2.2.54 EnableFwKeyboardRx(n)Syntax EnableFwKeyboardRx(n)

Parametern = [integer]0: Disabled1:Enabled

Description

When using readstring$(“keyboard”), EnableFwKeyboardRx(0) can avoid the datafrom the keyboard is received by printer firmware.

After finishing using readstring$(“keyboard”) and EnableFwKeyboardRx(0),remember to enable[EnableFwKeyboardRx(1)] printer firmware to receive datafrom the keyboard. Otherwise it might happen unexpected results on theprinter.

Example See the example 2 of 2.2.22

2.2.55 set_show_data_recv_time(n)Syntax set_show_data_recv_time(n)

Parametern = [integer], unit: ticks0: Disabled1~65535:Enabled

Description set_show_data_recv_time(0) disables showing “Data Receiving”

Page 37: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 37 (44)

set_show_data_recv_time(n) enables showing “Data Receiving” for n ticks.

2.2.56 FileExists(s$)Syntax FileExists(s$)Parameter s$ = [string], file name of txt

Descriptionreturns a integer value0 means the file not exist.1 means the file exists.

Example See the example of �2.2.57

2.2.57 FileCreate(s$)Syntax FileCreate(s$)Parameter s$ = [string], file name of text

Description returns a pointer value to a text file object0 means open failure.

Example

k = FileExists("t1")if(k>0) then

outputstringtodev("File exists, k="+str$(k),"com")A = FileOpen("t1",2)if(A = 0) then

outputstringtodev("FileOpen fail, A$="+A$,"com")else

x = FileRealSize(A)outputstringtodev("FileRealSize x="+str$(x),"com")FileSeek(A,x,0)L = FileWrite(A,"FABULOUS",5);outputstringtodev("L="+str$(L),"com")FileClose(A)

endifelse

outputstringtodev("File not exist, k="+str$(k),"com")A = FileCreate("t1")A$ = str$(A)if(A = 0) then

outputstringtodev("FileCreate fail, A$="+A$,"com")else

L = FileWrite(A,"1234",4);outputstringtodev("L="+str$(L),"com")

Page 38: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 38 (44)

L = FileWrite(A,"abc",3);outputstringtodev("L="+str$(L),"com")FileClose(A)

endifendif

end

Result 1:Run 1st timeandView it in theprinter

File not exist, k=0L=4L=3

~MGETT,t11234abc

~MDIRDirectory of 'FLASH't1 TXT 4 KB65242 KB free

Result 2:Run 2nd timeandView it in theprinter

File exists, k=1FileRealSize x=7L=5

~MGETT,t11234abcFABULOUS

2.2.58 FileOpen(s$,m)Syntax FileOpen(s$,m)

Parameter

s$ = [string], file name of txtm = 0, read onlym = 1, write only (Only ARM9 model support)m = 2, read and write (Only ARM9 model support)

Description returns a pointer value to a txt object0 means open failure.

Example See the example of �2.2.57

2.2.59 FileClose(i)Syntax FileClose(i)Parameter i = [integer], a pointer value to a text file object

Description No return value.Close a text file.

Example See the example of �2.2.57

Page 39: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 39 (44)

2.2.60 FileWrite(i,s$,n)Syntax FileWrite(i,s$,n)

Parameteri = [integer], a pointer value to a text file objects$ = [string], to writen= [integer], the size to write

Description If return value > 0 means write successfully.Write data in a text file.

Example See the example of �2.2.57

2.2.61 FileRealSize(i)Syntax FileRealSize(i)Parameter i = [integer], a pointer value to a text file objectDescription Return the size of a text file.Example See the example of �2.2.57

2.2.62 FileSeek(i,o,n)

Syntax FileSeek(i,o,n)(Only ARM9 model support)

Parameter

i = [integer], a pointer value to a text file objecto= [integer], Offset bytesn= [integer],0: the beginning of the file1: the current position of the file2: the end of the file

Description No return value.Seek in a text file

Example See the example of �2.2.57

2.2.63 FileRead(i,n)Syntax FileRead(i,n)

Parameter i = [integer], a pointer value to a text file objectn= [integer], the size to read

Description Return a read string in a text file.

Example k = FileExists("t1")if(k>0) then

Page 40: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 40 (44)

outputstringtodev("File exists, k="+str$(k),"com")A = FileOpen("t1",0)if(A = 0) then

outputstringtodev("FileOpen fail, A$="+A$,"com")else

x = FileRealSize(A)outputstringtodev("FileRealSize x="+str$(x),"com")T$ = FileRead(A,x)outputstringtodev("T$="+T$,"com")FileSeek(A,x,2)U$ = FileRead(A,4)outputstringtodev("U$="+U$,"com")FileSeek(A,3,1)V$ = FileRead(A,5)outputstringtodev("V$="+V$,"com")FileSeek(A,4,0)X$ = FileRead(A,3)outputstringtodev("X$="+X$,"com")FileClose(A)

endifendif

DeleteFile("t1")

endFile Content ~MGETT,t1

1234abcFABULOUS

Result

File exists, k=1FileRealSize x=12T$=1234abcFABULOUSU$=1234V$=FABULOUSX$=abc

2.2.64 DeleteFile(s$)Syntax DeleteFile(s$)Parameter s$ = [string], file name of txt

Description No return value.Delete a text file.

Example See the example of �2.2.63

Page 41: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 41 (44)

2.3 Supported operator in expressionHere is the list of supported operator in expression.

Supported operators Description+ addition- subtraction* multiplication/ division% remainder< less than> greater than= equal<= less than or equal>= great than or equal<> not equalnot Logical notor Logical orand Logical and

The following are some examples.

2.3.1 Logical not

Syntax andParameters N/ADescription Logical notExample print("^Q100,0,0\r\n")

print("^L\r\n")

let a=1let y = 10while (not(a=5))if a % 2 = 0 thenprint("AD,30," + str$(y) + ",1,1,0,0E,str$(a)=" + str$(a) + " is even\r\n")elseprint("AD,30," + str$(y) + ",1,1,0,0E,str$(a)=" + str$(a) + " is odd\r\n")endifa=a+1y = y +50wendprint("E\r\n")

Page 42: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 42 (44)

endResult str$(a)=1 is odd

str$(a)=2 is evenstr$(a)=3 is oddstr$(a)=4 is even

2.3.2 Logical or

Syntax orParameters N/ADescription Logical orExample print("^Q100,0,0\r\n")

print("^L\r\n")let y = 10for a=1 to 15if (a<5 or a>10)thenprint("AD,30," + str$(y) + ",1,1,0,0E,str$(a)=" + str$(a) + " is <5 or >10\r\n")elseprint("AD,30," + str$(y) + ",1,1,0,0E,str$(a)=" + str$(a) + " is >=5 and

<=10\r\n")endify = y +50next aprint("E\r\n")end

Result str$(a)=1 is <5 or >10str$(a)=2 is <5 or >10str$(a)=3 is <5 or >10str$(a)=4 is <5 or >10str$(a)=5 is >=5 and <=10str$(a)=6 is >=5 and <=10str$(a)=7 is >=5 and <=10str$(a)=8 is >=5 and <=10str$(a)=9 is >=5 and <=10str$(a)=10 is >=5 and <=10str$(a)=11 is <5 or >10str$(a)=12 is <5 or >10str$(a)=13 is <5 or >10str$(a)=14 is <5 or >10str$(a)=15 is <5 or >10

Page 43: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 43 (44)

2.3.3 Logical andSyntax andParameters N/ADescription Logical andExample print("^Q80,0,0\r\n")

print("^L\r\n")

let a=1let y = 10doif a % 2 = 0 thenprint("AD,30," + str$(y) + ",1,1,0,0E,str$(a)=" + str$(a) + " is even\r\n")elseprint("AD,30," + str$(y) + ",1,1,0,0E,str$(a)=" + str$(a) + " is odd\r\n")endifa=a+1y = y +50until (a%2=0 and a%3=0 and a%4=0)print("E\r\n")end

Result str$(a)=1 is oddstr$(a)=2 is evenstr$(a)=3 is oddstr$(a)=4 is evenstr$(a)=5 is oddstr$(a)=6 is evenstr$(a)=7 is oddstr$(a)=8 is evenstr$(a)=9 is oddstr$(a)=10 is evenstr$(a)=11 is odd

Page 44: FabulousBASICFunctionDescriptionapp.fabulousprinter.com/files/pdf/BASIC_EN_V1.7_20181207.pdfDocumenttype Securityclass External Department Date Documentnumber Version Status Page FabulousInc

Document type Security classExternal

Department Date Document number Version Status Page

Fabulous Inc 2018-12-07 1.7 Release 44 (44)

3. Version History

Version Changes/Comments Author’sName Date

1.0 First draft Terry 2015-12-29

1.1 Change the architecture and examples Justin Ho 2017-06-30

1.2

(1)Add chapter 2.2.22 ~ 2.2.26

(2)Change Windows capture images to fullEnglish

Justin Ho 2017-10-13

1.3 (1)Modify �2.2.6 Justin Ho 2018-03-15

1.4 (1)Modify �2.1.4 if … then [… elif … then …else … ] endif Justin Ho 2018-05-17

1.5 (1)Add chapter �2.2.27 and �2.2.28 Justin Ho 2018-05-31

1.6(1)Add chapter �2.2.29~�2.2.52

(2) Add chapter �2.2.53, �2.2.54, �2.2.55Justin Ho 2018-11-15

1.7 (1)Modify chapter �2.2.56~�2.2.64 Justin Ho 2018-12-07