Hi all
Here is a nice tool ... well not yet ... but it will be when it's completly finished.
But the time (and brain)is not much to finish it ...
So for now enjoy this one. It work (mais ou menos) more or less ... Try it.
please keep the version number(V05c) when you compile for future reference
************************************************************
TFC Script- Text to CSV - 1º part
********************************save and compile from here
;TFC - TXT FILTER TO CSV v05C_Beta - By JMF CMPTSUL01
;TFC - TXT to CSV Fields
; - Tested - bugs detected - ok for small and logical filter sequences
;******************************* Global Variables Definition *********************************
string Swait[41],Scsvfrx[41],Stext[41],Scsvftx[41],Ssepchar[41],srowdata1
string Swttmunt,Swttmwf,smaxcycl,Smaxcr,stxpacing,smaxrow,scollimit,Swindes1,spercent
string Slista = ",00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19"
string Slist0
string Slist1 = ",1,2,3,4,5,6,7,8,9,10,12,16,18.20,24,28,32,48,64,96,128,180,224,255"
string Slist2 = ",S0,S2,S3,S4,S5,S6,S7,S8,S9,I0,I1,I2,I3,I4,I5,I6,I7,I8,I9,L0,L1,L2,L3,L4,F0,F1,F2,F3,F4"
integer Iconstsw[41],icsvcolsw[41],Iuntilsw[41],Ientersw[41]
integer Ilpstrt,Ilpend,imaxrow,icntline,ipercent,switch1,switch2,switch3
integer Ialwayssw,Iwaitfsw,Itstmodsw,ilpforeversw,ilpwrsw,iopttoudssw,iudssavsw
integer iwttmunt,iwttmwf,imaxcycl,itxpacing,imaxcr,icnvhrsw,icollimit
string SFileSpec1,Sfilecsv
string sfilespec2,sfilesav,Sfiletfs,Stemp1
string sfilespec3,sfiletxt
string Srowdata[3000]
; string Scoldata[41]
;*********************************************************************************************
proc main ; ****************************************************************************
;*** Define Variables
integer icnt0
;*** Define Variables Default Values
sfilespec1 = "c:\*.csv", sfilespec2 = "c:\*.tfs",sfilespec3 = "c:\*.txt;*.cap"
slist0 = slista
for icnt0 = 0 upto 40
Ssepchar[icnt0] = " "
endfor
stemp1 =""
switch1 = 1,switch2=1,switch3=1
Ialwayssw=0,Iwaitfsw=0,Itstmodsw=0,ilpforeversw=0,ilpwrsw=0
icnvhrsw=1,iopttoudssw=0,iudssavsw = 1
atoi swttmunt iwttmunt
atoi swttmwf iwttmwf
atoi smaxcycl imaxcycl
atoi smaxcr imaxcr
atoi scollimit icollimit
atoi stxpacing itxpacing
;** exec
call clearjanela
; strcat stemp1 sfilespec2
; strextract sfilespec2 stemp1 "*.tfs" 0
; strcat stemp1 sfilespec3
; sfilespec3 = stemp1
; usermsg "%s" sfilespec3
call janela
; call readfile
usermsg "Operation Finished"
call finalize
endproc ;*********************************************************************
proc janela ; *********** janela principal e sub-menus ***************************
;*** Define Variables
string Sfiletemp0
integer event
;*** Define Variables Values
;** janela principal
dialogbox 0 0 0 530 350 135 " TFC Text Filter Tool - Script v05C 041004 By JMF 062004 - Compta Sul "
groupbox 1 14 0 124 263 " Expect "
groupbox 2 265 0 1 290 ""
; groupbox 3 229 0 285 263 " "
text 10 3 12 10 12 "01" left
editbox 12 17 10 56 12 swait[1] 20
editbox 13 74 10 20 12 Ssepchar[1] 20
editbox 14 132 10 55 12 Stext[1] 255
editbox 22 17 24 56 12 Swait[2] 20
editbox 23 74 24 20 12 Ssepchar[2] 20
editbox 24 132 24 55 12 Stext[2] 255
editbox 32 17 39 56 12 Swait[3] 20
editbox 33 74 39 20 12 Ssepchar[3] 20
editbox 34 132 39 55 12 Stext[3] 255
editbox 42 17 53 56 12 Swait[4] 20
editbox 43 74 53 20 12 Ssepchar[4] 20
editbox 44 132 53 55 12 Stext[4] 255
text 50 3 68 10 12 "05" left
editbox 52 17 66 56 12 Swait[5] 20
editbox 53 74 66 20 12 Ssepchar[5] 20
editbox 54 132 66 55 12 Stext[5] 30
editbox 62 17 80 56 12 Swait[6] 20
editbox 63 74 80 20 12 Ssepchar[6] 20
editbox 64 132 80 55 12 Stext[6] 30
editbox 72 17 95 56 12 Swait[7] 20
editbox 73 74 95 20 12 Ssepchar[7] 20
editbox 74 132 95 55 12 Stext[7] 30
editbox 82 17 109 56 12 Swait[8] 20
editbox 83 74 109 20 12 Ssepchar[8] 20
editbox 84 132 109 55 12 Stext[8] 30
editbox 92 17 122 56 12 Swait[9] 20
editbox 93 74 122 20 12 Ssepchar[9] 20
editbox 94 132 122 55 12 Stext[9] 30
text 100 3 138 10 12 "10" left
editbox 102 17 136 56 12 swait[10] 20
editbox 103 74 136 20 12 Ssepchar[10] 20
editbox 104 132 136 55 12 Stext[10] 30
editbox 112 17 151 56 12 swait[11] 20
editbox 113 74 151 20 12 Ssepchar[11] 20
editbox 114 132 151 55 12 Stext[11] 30
editbox 122 17 165 56 12 Swait[12] 20
editbox 123 74 165 20 12 Ssepchar[12] 20
editbox 124 132 165 55 12 Stext[12] 30
editbox 132 17 178 56 12 Swait[13] 20
editbox 133 74 178 20 12 Ssepchar[13] 20
editbox 134 132 178 55 12 Stext[13] 30
editbox 142 17 192 56 12 Swait[14] 20
editbox 143 74 192 20 12 Ssepchar[14] 20
editbox 144 132 192 55 12 Stext[14] 30
text 150 3 208 10 12 "15" left
editbox 152 17 207 56 12 Swait[15] 20
editbox 153 74 207 20 12 Ssepchar[15] 20
editbox 154 132 207 55 12 Stext[15] 30
editbox 162 17 221 56 12 Swait[16] 20
editbox 163 74 221 20 12 Ssepchar[16] 20
editbox 164 132 221 55 12 Stext[16] 30
editbox 172 17 234 56 12 Swait[17] 20
editbox 173 74 234 20 12 Ssepchar[17] 20
editbox 174 132 234 55 12 Stext[17] 30
editbox 182 17 248 56 12 Swait[18] 20
editbox 183 74 248 20 12 Ssepchar[18] 20
editbox 184 132 248 55 12 Stext[18] 30
editbox 192 17 262 56 12 Swait[19] 20
editbox 19 74 262 20 12 Ssepchar[19] 20
editbox 194 132 262 55 12 Stext[19] 30
text 200 3 278 10 12 "20" left
editbox 202 17 276 56 12 Swait[20] 20
editbox 203 74 276 20 12 Ssepchar[20] 20
editbox 204 132 276 55 12 Stext[20] 30
text 210 269 12 10 12 "21" left
editbox 212 282 10 56 12 swait[21] 20
editbox 213 339 10 20 12 Ssepchar[21] 20
editbox 214 397 10 55 12 Stext[21] 255
editbox 222 282 24 56 12 Swait[22] 20
editbox 223 339 24 20 12 Ssepchar[22] 20
editbox 224 397 24 55 12 Stext[22] 255
editbox 232 282 39 56 12 Swait[23] 20
editbox 233 339 39 20 12 Ssepchar[23] 20
editbox 234 397 39 55 12 Stext[23] 255
editbox 242 282 53 56 12 Swait[24] 20
editbox 243 339 53 20 12 Ssepchar[24] 20
editbox 244 397 53 55 12 Stext[24] 255
text 250 269 68 10 12 "25" left
editbox 252 282 66 56 12 Swait[25] 20
editbox 253 339 66 20 12 Ssepchar[25] 20
editbox 254 397 66 55 12 Stext[25] 30
editbox 262 282 80 56 12 Swait[26] 20
editbox 263 339 80 20 12 Ssepchar[26] 20
editbox 264 397 80 55 12 Stext[26] 30
editbox 272 282 95 56 12 Swait[27] 20
editbox 273 339 95 20 12 Ssepchar[27] 20
editbox 274 397 95 55 12 Stext[27] 30
editbox 282 282 109 56 12 Swait[28] 20
editbox 283 339 109 20 12 Ssepchar[28] 20
editbox 284 397 109 55 12 Stext[28] 30
editbox 292 282 122 56 12 Swait[29] 20
editbox 293 339 122 20 12 Ssepchar[29] 20
editbox 294 397 122 55 12 Stext[29] 30
text 300 269 138 10 12 "30" left
editbox 302 282 136 56 12 swait[30] 20
editbox 303 339 136 20 12 Ssepchar[30] 20
editbox 304 397 136 55 12 Stext[30] 30
editbox 312 282 151 56 12 swait[31] 20
editbox 313 339 151 20 12 Ssepchar[31] 20
editbox 314 397 151 55 12 Stext[31] 30
editbox 322 282 165 56 12 Swait[32] 20
editbox 323 339 165 20 12 Ssepchar[32] 20
editbox 324 397 165 55 12 Stext[32] 30
editbox 332 282 178 56 12 Swait[33] 20
editbox 333 339 178 20 12 Ssepchar[33] 20
editbox 334 397 178 55 12 Stext[33] 30
editbox 342 282 192 56 12 Swait[34] 20
editbox 343 339 192 20 12 Ssepchar[34] 20
editbox 344 397 192 55 12 Stext[34] 30
text 350 269 208 10 12 "35" left
editbox 352 282 207 56 12 Swait[35] 20
editbox 353 339 207 20 12 Ssepchar[35] 20
editbox 354 397 207 55 12 Stext[35] 30
editbox 362 282 221 56 12 Swait[36] 20
editbox 363 339 221 20 12 Ssepchar[36] 20
editbox 364 397 221 55 12 Stext[36] 30
editbox 372 282 234 56 12 Swait[37] 20
editbox 373 339 234 20 12 Ssepchar[37] 20
editbox 374 397 234 55 12 Stext[37] 30
editbox 382 282 248 56 12 Swait[38] 20
editbox 383 339 248 20 12 Ssepchar[38] 20
editbox 384 397 248 55 12 Stext[38] 30
editbox 392 282 262 56 12 Swait[39] 20
editbox 393 339 262 20 12 Ssepchar[39] 20
editbox 394 397 262 55 12 Stext[39] 30
text 400 269 278 10 12 "40" left
editbox 402 282 276 56 12 Swait[40] 20
editbox 403 339 276 20 12 Ssepchar[40] 20
editbox 404 397 276 55 12 Stext[40] 30
radiogroup 500 Ilpstrt
radiobutton 501 196 10 32 12 "SL 01"
radiobutton 502 196 24 32 12 "SL 02"
radiobutton 503 196 38 32 12 "SL 03"
radiobutton 504 196 52 32 12 "SL 04"
radiobutton 505 196 66 32 12 "SL 05"
radiobutton 506 196 80 32 12 "SL 06"
radiobutton 507 196 94 32 12 "SL 07"
radiobutton 508 196 108 32 12 "SL 08"
radiobutton 509 196 122 32 12 "SL 09"
radiobutton 510 196 136 32 12 "SL 10"
radiobutton 511 196 150 32 12 "SL 11"
radiobutton 512 196 164 32 12 "SL 12"
radiobutton 513 196 178 32 12 "SL 13"
radiobutton 514 196 192 32 12 "SL 14"
radiobutton 515 196 206 32 12 "SL 15"
radiobutton 516 196 220 32 12 "SL 16"
radiobutton 517 196 234 32 12 "SL 17"
radiobutton 518 196 248 32 12 "SL 18"
radiobutton 519 196 262 32 12 "SL 19"
radiobutton 520 196 276 32 12 "SL 20"
radiobutton 521 456 10 32 12 "SL 21"
radiobutton 522 456 24 32 12 "SL 22"
radiobutton 523 456 38 32 12 "SL 23"
radiobutton 524 456 52 32 12 "SL 24"
radiobutton 525 456 66 32 12 "SL 25"
radiobutton 526 456 80 32 12 "SL 26"
radiobutton 527 456 94 32 12 "SL 27"
radiobutton 528 456 108 32 12 "SL 28"
radiobutton 529 456 122 32 12 "SL 29"
radiobutton 530 456 136 32 12 "SL 30"
radiobutton 531 456 150 32 12 "SL 31"
radiobutton 532 456 164 32 12 "SL 32"
radiobutton 533 456 178 32 12 "SL 33"
radiobutton 534 456 192 32 12 "SL 34"
radiobutton 535 456 206 32 12 "SL 35"
radiobutton 536 456 220 32 12 "SL 36"
radiobutton 537 456 234 32 12 "SL 37"
radiobutton 538 456 248 32 12 "SL 38"
radiobutton 539 456 262 32 12 "SL 39"
radiobutton 540 456 276 32 12 "SL 40"
endgroup
radiogroup 600 Ilpend
radiobutton 601 232 10 32 12 "EL 01"
radiobutton 602 232 24 32 12 "EL 02"
radiobutton 603 232 38 32 12 "EL 03"
radiobutton 604 232 52 32 12 "EL 04"
radiobutton 605 232 66 32 12 "EL 05"
radiobutton 606 232 80 32 12 "EL 06"
radiobutton 607 232 94 32 12 "EL 07"
radiobutton 608 232 108 32 12 "EL 08"
radiobutton 609 232 122 32 12 "EL 09"
radiobutton 610 232 136 32 12 "EL 10"
radiobutton 611 232 150 32 12 "EL 11"
radiobutton 612 232 164 32 12 "EL 12"
radiobutton 613 232 178 32 12 "EL 13"
radiobutton 614 232 192 32 12 "EL 14"
radiobutton 615 232 206 32 12 "EL 15"
radiobutton 616 232 220 32 12 "EL 16"
radiobutton 617 232 234 32 12 "EL 17"
radiobutton 618 232 248 32 12 "EL 18"
radiobutton 619 232 262 32 12 "EL 19"
radiobutton 620 232 276 32 12 "EL 20"
radiobutton 621 492 10 32 12 "EL 21"
radiobutton 622 492 24 32 12 "EL 22"
radiobutton 623 492 38 32 12 "EL 23"
radiobutton 624 492 52 32 12 "EL 24"
radiobutton 625 492 66 32 12 "EL 25"
radiobutton 626 492 80 32 12 "EL 26"
radiobutton 627 492 94 32 12 "EL 27"
radiobutton 628 492 108 32 12 "EL 28"
radiobutton 629 492 122 32 12 "EL 29"
radiobutton 630 492 136 32 12 "EL 30"
radiobutton 631 492 150 32 12 "EL 31"
radiobutton 632 492 164 32 12 "EL 32"
radiobutton 633 492 178 32 12 "EL 33"
radiobutton 634 492 192 32 12 "EL 34"
radiobutton 635 492 206 32 12 "EL 35"
radiobutton 636 492 220 32 12 "EL 36"
radiobutton 637 492 234 32 12 "EL 37"
radiobutton 638 492 248 32 12 "EL 38"
radiobutton 639 492 262 32 12 "EL 39"
radiobutton 640 492 276 32 12 "EL 40"
endgroup
pushbutton 900 205 337 36 11 "Start"
pushbutton 901 287 337 36 11 "Quit"
editbox 903 329 318 194 12 Swindes1 64
pushbutton 904 342 334 42 11 "Open File"
pushbutton 905 403 334 42 11 "Save As"
pushbutton 906 462 334 42 11 "Clear All"
pushbutton 907 6 307 42 11 "Open File"
pushbutton 908 70 307 42 11 "Show File"
text 910 175 308 20 10 smaxrow left
text 911 5 327 194 10 sfilecsv center
checkbox 912 209 297 116 11 "Fill w/comma empty fields (csv)" switch1
checkbox 913 209 307 116 11 "Del initial Line spaces (txt)" switch2
checkbox 914 209 317 116 11 "Del initial Field spaces (csv)" switch3
text 916 5 297 194 10 Sfiletxt center
text 917 329 297 194 10 Sfiletfs center
text 918 116 308 60 10 "Number of Rows:" left
pushbutton 919 6 337 42 11 "New File"
pushbutton 920 70 337 42 11 "Save As"
text 922 256 339 18 10 Spercent center
groupbox 930 205 290 118 43 "Options"
groupbox 931 255 332 20 18 ""
groupbox 932 2 320 200 31 " Select Destination File (.CSV file)"
groupbox 933 2 290 200 30 " Select Source File (.Txt or .Cap)"
groupbox 934 327 290 200 60 " Open/Save - Text Filter Script Files (.tfs)"
enddialog
;*** default window starts
disable DLGCTRL 0 900
disable DLGCTRL 0 908
dlgupdate 0 0,420
dlgupdate 0 900,922
;***** janela swyching control - Hold until EXECUTE is pressed
while 1
dlgevent 0 Event
switch Event
case 0
yield
endcase
;** case 901 - CANCEL WINDOW
case 901
dlgdestroy 0 cancel
usermsg "Operation Canceled"
call finalize
endcase
;** case 904 - OPEN TFS FILE
case 904
sfiletemp0 = Sfiletfs
if sdlgfopen "Select the file .tfs " sfilespec2 SINGLE Sfiletfs
call openscript
endif
if nullstr Sfiletfs
Sfiletfs = sfiletemp0
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
elseif ilpstrt > (ilpend - 100)
disable DLGCTRL 0 900
elseif nullstr Sfiletxt
disable DLGCTRL 0 900
elseif nullstr Sfilecsv
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
dlgupdate 0 0,420
dlgupdate 0 900,922
endcase
;** case 905 - SAVE .UDS FILE
case 905
call savescript
endcase
;** case 906 - CLEAR WINDOW FIELDS
case 906
call clearjanela
endcase
;** case 907 - select and show txtfile
case 907
if sdlgfopen "Selecione o ficheiro .txt ou .cap " SFileSpec3 SINGLE SFiletxt
call showtxtfile
enable DLGCTRL 0 908
dlgupdate 0 0,420
dlgupdate 0 900,922
endif
if nullstr Sfiletxt
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
elseif ilpstrt > (ilpend - 100)
disable DLGCTRL 0 900
elseif nullstr Sfiletxt
disable DLGCTRL 0 900
elseif nullstr Sfilecsv
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
dlgupdate 0 0,420
dlgupdate 0 900,922
endcase
;*** cse 908 Show txt file
case 908
fileview sfiletxt
endcase
;** case 912 - option window switch1
case 912
dlgupdate 0 912
endcase
;** case 913 - option window switch2
case 913
dlgupdate 0 913
endcase
;** case 914 - option window switch3
case 914
dlgupdate 0 914
endcase
;** case 919 - select new csv file
case 919
if sdlgfopen "Select file *.csv " SFileSpec1 SINGLE SFilecsv
endif
dlgupdate 0 911
if nullstr Sfilecsv
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
elseif ilpstrt > (ilpend - 100)
disable DLGCTRL 0 900
elseif nullstr Sfiletxt
disable DLGCTRL 0 900
elseif nullstr Sfilecsv
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
dlgupdate 0 0,420
dlgupdate 0 900,922
endcase
;*** cse 920 save as csv file
case 920
if sdlgsaveas "Select file .csv to save " SFileSpec1 SFilecsv
endif
dlgupdate 0 911
if nullstr Sfilecsv
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
elseif ilpstrt > (ilpend - 100)
disable DLGCTRL 0 900
elseif nullstr Sfiletxt
disable DLGCTRL 0 900
elseif nullstr Sfilecsv
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
endcase
;** case 500 e 600
case 500
if ilpstrt > ilpend-100
alarm 2
errormsg " Start Loop Can't Be Bigger Than End Loop "
disable DLGCTRL 0 900
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
endcase
case 600
if ilpend-100 < ilpstrt
alarm 2
errormsg " End Loop Can't Be Smaller Than Start Loop "
disable DLGCTRL 0 900
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
elseif nullstr Sfiletxt
disable DLGCTRL 0 900
elseif nullstr Sfilecsv
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
endcase
;** case 900 all ready exit janela & execute UDS
case 900
disable dlgctrl 0 900,920
enable dlgctrl 0 922
call readfile
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 OK
return
endproc ;**************************** end of janela **************************
; end of 1º part ***************************************
Here is a nice tool ... well not yet ... but it will be when it's completly finished.
But the time (and brain)is not much to finish it ...
So for now enjoy this one. It work (mais ou menos) more or less ... Try it.
please keep the version number(V05c) when you compile for future reference
************************************************************
TFC Script- Text to CSV - 1º part
********************************save and compile from here
;TFC - TXT FILTER TO CSV v05C_Beta - By JMF CMPTSUL01
;TFC - TXT to CSV Fields
; - Tested - bugs detected - ok for small and logical filter sequences
;******************************* Global Variables Definition *********************************
string Swait[41],Scsvfrx[41],Stext[41],Scsvftx[41],Ssepchar[41],srowdata1
string Swttmunt,Swttmwf,smaxcycl,Smaxcr,stxpacing,smaxrow,scollimit,Swindes1,spercent
string Slista = ",00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19"
string Slist0
string Slist1 = ",1,2,3,4,5,6,7,8,9,10,12,16,18.20,24,28,32,48,64,96,128,180,224,255"
string Slist2 = ",S0,S2,S3,S4,S5,S6,S7,S8,S9,I0,I1,I2,I3,I4,I5,I6,I7,I8,I9,L0,L1,L2,L3,L4,F0,F1,F2,F3,F4"
integer Iconstsw[41],icsvcolsw[41],Iuntilsw[41],Ientersw[41]
integer Ilpstrt,Ilpend,imaxrow,icntline,ipercent,switch1,switch2,switch3
integer Ialwayssw,Iwaitfsw,Itstmodsw,ilpforeversw,ilpwrsw,iopttoudssw,iudssavsw
integer iwttmunt,iwttmwf,imaxcycl,itxpacing,imaxcr,icnvhrsw,icollimit
string SFileSpec1,Sfilecsv
string sfilespec2,sfilesav,Sfiletfs,Stemp1
string sfilespec3,sfiletxt
string Srowdata[3000]
; string Scoldata[41]
;*********************************************************************************************
proc main ; ****************************************************************************
;*** Define Variables
integer icnt0
;*** Define Variables Default Values
sfilespec1 = "c:\*.csv", sfilespec2 = "c:\*.tfs",sfilespec3 = "c:\*.txt;*.cap"
slist0 = slista
for icnt0 = 0 upto 40
Ssepchar[icnt0] = " "
endfor
stemp1 =""
switch1 = 1,switch2=1,switch3=1
Ialwayssw=0,Iwaitfsw=0,Itstmodsw=0,ilpforeversw=0,ilpwrsw=0
icnvhrsw=1,iopttoudssw=0,iudssavsw = 1
atoi swttmunt iwttmunt
atoi swttmwf iwttmwf
atoi smaxcycl imaxcycl
atoi smaxcr imaxcr
atoi scollimit icollimit
atoi stxpacing itxpacing
;** exec
call clearjanela
; strcat stemp1 sfilespec2
; strextract sfilespec2 stemp1 "*.tfs" 0
; strcat stemp1 sfilespec3
; sfilespec3 = stemp1
; usermsg "%s" sfilespec3
call janela
; call readfile
usermsg "Operation Finished"
call finalize
endproc ;*********************************************************************
proc janela ; *********** janela principal e sub-menus ***************************
;*** Define Variables
string Sfiletemp0
integer event
;*** Define Variables Values
;** janela principal
dialogbox 0 0 0 530 350 135 " TFC Text Filter Tool - Script v05C 041004 By JMF 062004 - Compta Sul "
groupbox 1 14 0 124 263 " Expect "
groupbox 2 265 0 1 290 ""
; groupbox 3 229 0 285 263 " "
text 10 3 12 10 12 "01" left
editbox 12 17 10 56 12 swait[1] 20
editbox 13 74 10 20 12 Ssepchar[1] 20
editbox 14 132 10 55 12 Stext[1] 255
editbox 22 17 24 56 12 Swait[2] 20
editbox 23 74 24 20 12 Ssepchar[2] 20
editbox 24 132 24 55 12 Stext[2] 255
editbox 32 17 39 56 12 Swait[3] 20
editbox 33 74 39 20 12 Ssepchar[3] 20
editbox 34 132 39 55 12 Stext[3] 255
editbox 42 17 53 56 12 Swait[4] 20
editbox 43 74 53 20 12 Ssepchar[4] 20
editbox 44 132 53 55 12 Stext[4] 255
text 50 3 68 10 12 "05" left
editbox 52 17 66 56 12 Swait[5] 20
editbox 53 74 66 20 12 Ssepchar[5] 20
editbox 54 132 66 55 12 Stext[5] 30
editbox 62 17 80 56 12 Swait[6] 20
editbox 63 74 80 20 12 Ssepchar[6] 20
editbox 64 132 80 55 12 Stext[6] 30
editbox 72 17 95 56 12 Swait[7] 20
editbox 73 74 95 20 12 Ssepchar[7] 20
editbox 74 132 95 55 12 Stext[7] 30
editbox 82 17 109 56 12 Swait[8] 20
editbox 83 74 109 20 12 Ssepchar[8] 20
editbox 84 132 109 55 12 Stext[8] 30
editbox 92 17 122 56 12 Swait[9] 20
editbox 93 74 122 20 12 Ssepchar[9] 20
editbox 94 132 122 55 12 Stext[9] 30
text 100 3 138 10 12 "10" left
editbox 102 17 136 56 12 swait[10] 20
editbox 103 74 136 20 12 Ssepchar[10] 20
editbox 104 132 136 55 12 Stext[10] 30
editbox 112 17 151 56 12 swait[11] 20
editbox 113 74 151 20 12 Ssepchar[11] 20
editbox 114 132 151 55 12 Stext[11] 30
editbox 122 17 165 56 12 Swait[12] 20
editbox 123 74 165 20 12 Ssepchar[12] 20
editbox 124 132 165 55 12 Stext[12] 30
editbox 132 17 178 56 12 Swait[13] 20
editbox 133 74 178 20 12 Ssepchar[13] 20
editbox 134 132 178 55 12 Stext[13] 30
editbox 142 17 192 56 12 Swait[14] 20
editbox 143 74 192 20 12 Ssepchar[14] 20
editbox 144 132 192 55 12 Stext[14] 30
text 150 3 208 10 12 "15" left
editbox 152 17 207 56 12 Swait[15] 20
editbox 153 74 207 20 12 Ssepchar[15] 20
editbox 154 132 207 55 12 Stext[15] 30
editbox 162 17 221 56 12 Swait[16] 20
editbox 163 74 221 20 12 Ssepchar[16] 20
editbox 164 132 221 55 12 Stext[16] 30
editbox 172 17 234 56 12 Swait[17] 20
editbox 173 74 234 20 12 Ssepchar[17] 20
editbox 174 132 234 55 12 Stext[17] 30
editbox 182 17 248 56 12 Swait[18] 20
editbox 183 74 248 20 12 Ssepchar[18] 20
editbox 184 132 248 55 12 Stext[18] 30
editbox 192 17 262 56 12 Swait[19] 20
editbox 19 74 262 20 12 Ssepchar[19] 20
editbox 194 132 262 55 12 Stext[19] 30
text 200 3 278 10 12 "20" left
editbox 202 17 276 56 12 Swait[20] 20
editbox 203 74 276 20 12 Ssepchar[20] 20
editbox 204 132 276 55 12 Stext[20] 30
text 210 269 12 10 12 "21" left
editbox 212 282 10 56 12 swait[21] 20
editbox 213 339 10 20 12 Ssepchar[21] 20
editbox 214 397 10 55 12 Stext[21] 255
editbox 222 282 24 56 12 Swait[22] 20
editbox 223 339 24 20 12 Ssepchar[22] 20
editbox 224 397 24 55 12 Stext[22] 255
editbox 232 282 39 56 12 Swait[23] 20
editbox 233 339 39 20 12 Ssepchar[23] 20
editbox 234 397 39 55 12 Stext[23] 255
editbox 242 282 53 56 12 Swait[24] 20
editbox 243 339 53 20 12 Ssepchar[24] 20
editbox 244 397 53 55 12 Stext[24] 255
text 250 269 68 10 12 "25" left
editbox 252 282 66 56 12 Swait[25] 20
editbox 253 339 66 20 12 Ssepchar[25] 20
editbox 254 397 66 55 12 Stext[25] 30
editbox 262 282 80 56 12 Swait[26] 20
editbox 263 339 80 20 12 Ssepchar[26] 20
editbox 264 397 80 55 12 Stext[26] 30
editbox 272 282 95 56 12 Swait[27] 20
editbox 273 339 95 20 12 Ssepchar[27] 20
editbox 274 397 95 55 12 Stext[27] 30
editbox 282 282 109 56 12 Swait[28] 20
editbox 283 339 109 20 12 Ssepchar[28] 20
editbox 284 397 109 55 12 Stext[28] 30
editbox 292 282 122 56 12 Swait[29] 20
editbox 293 339 122 20 12 Ssepchar[29] 20
editbox 294 397 122 55 12 Stext[29] 30
text 300 269 138 10 12 "30" left
editbox 302 282 136 56 12 swait[30] 20
editbox 303 339 136 20 12 Ssepchar[30] 20
editbox 304 397 136 55 12 Stext[30] 30
editbox 312 282 151 56 12 swait[31] 20
editbox 313 339 151 20 12 Ssepchar[31] 20
editbox 314 397 151 55 12 Stext[31] 30
editbox 322 282 165 56 12 Swait[32] 20
editbox 323 339 165 20 12 Ssepchar[32] 20
editbox 324 397 165 55 12 Stext[32] 30
editbox 332 282 178 56 12 Swait[33] 20
editbox 333 339 178 20 12 Ssepchar[33] 20
editbox 334 397 178 55 12 Stext[33] 30
editbox 342 282 192 56 12 Swait[34] 20
editbox 343 339 192 20 12 Ssepchar[34] 20
editbox 344 397 192 55 12 Stext[34] 30
text 350 269 208 10 12 "35" left
editbox 352 282 207 56 12 Swait[35] 20
editbox 353 339 207 20 12 Ssepchar[35] 20
editbox 354 397 207 55 12 Stext[35] 30
editbox 362 282 221 56 12 Swait[36] 20
editbox 363 339 221 20 12 Ssepchar[36] 20
editbox 364 397 221 55 12 Stext[36] 30
editbox 372 282 234 56 12 Swait[37] 20
editbox 373 339 234 20 12 Ssepchar[37] 20
editbox 374 397 234 55 12 Stext[37] 30
editbox 382 282 248 56 12 Swait[38] 20
editbox 383 339 248 20 12 Ssepchar[38] 20
editbox 384 397 248 55 12 Stext[38] 30
editbox 392 282 262 56 12 Swait[39] 20
editbox 393 339 262 20 12 Ssepchar[39] 20
editbox 394 397 262 55 12 Stext[39] 30
text 400 269 278 10 12 "40" left
editbox 402 282 276 56 12 Swait[40] 20
editbox 403 339 276 20 12 Ssepchar[40] 20
editbox 404 397 276 55 12 Stext[40] 30
radiogroup 500 Ilpstrt
radiobutton 501 196 10 32 12 "SL 01"
radiobutton 502 196 24 32 12 "SL 02"
radiobutton 503 196 38 32 12 "SL 03"
radiobutton 504 196 52 32 12 "SL 04"
radiobutton 505 196 66 32 12 "SL 05"
radiobutton 506 196 80 32 12 "SL 06"
radiobutton 507 196 94 32 12 "SL 07"
radiobutton 508 196 108 32 12 "SL 08"
radiobutton 509 196 122 32 12 "SL 09"
radiobutton 510 196 136 32 12 "SL 10"
radiobutton 511 196 150 32 12 "SL 11"
radiobutton 512 196 164 32 12 "SL 12"
radiobutton 513 196 178 32 12 "SL 13"
radiobutton 514 196 192 32 12 "SL 14"
radiobutton 515 196 206 32 12 "SL 15"
radiobutton 516 196 220 32 12 "SL 16"
radiobutton 517 196 234 32 12 "SL 17"
radiobutton 518 196 248 32 12 "SL 18"
radiobutton 519 196 262 32 12 "SL 19"
radiobutton 520 196 276 32 12 "SL 20"
radiobutton 521 456 10 32 12 "SL 21"
radiobutton 522 456 24 32 12 "SL 22"
radiobutton 523 456 38 32 12 "SL 23"
radiobutton 524 456 52 32 12 "SL 24"
radiobutton 525 456 66 32 12 "SL 25"
radiobutton 526 456 80 32 12 "SL 26"
radiobutton 527 456 94 32 12 "SL 27"
radiobutton 528 456 108 32 12 "SL 28"
radiobutton 529 456 122 32 12 "SL 29"
radiobutton 530 456 136 32 12 "SL 30"
radiobutton 531 456 150 32 12 "SL 31"
radiobutton 532 456 164 32 12 "SL 32"
radiobutton 533 456 178 32 12 "SL 33"
radiobutton 534 456 192 32 12 "SL 34"
radiobutton 535 456 206 32 12 "SL 35"
radiobutton 536 456 220 32 12 "SL 36"
radiobutton 537 456 234 32 12 "SL 37"
radiobutton 538 456 248 32 12 "SL 38"
radiobutton 539 456 262 32 12 "SL 39"
radiobutton 540 456 276 32 12 "SL 40"
endgroup
radiogroup 600 Ilpend
radiobutton 601 232 10 32 12 "EL 01"
radiobutton 602 232 24 32 12 "EL 02"
radiobutton 603 232 38 32 12 "EL 03"
radiobutton 604 232 52 32 12 "EL 04"
radiobutton 605 232 66 32 12 "EL 05"
radiobutton 606 232 80 32 12 "EL 06"
radiobutton 607 232 94 32 12 "EL 07"
radiobutton 608 232 108 32 12 "EL 08"
radiobutton 609 232 122 32 12 "EL 09"
radiobutton 610 232 136 32 12 "EL 10"
radiobutton 611 232 150 32 12 "EL 11"
radiobutton 612 232 164 32 12 "EL 12"
radiobutton 613 232 178 32 12 "EL 13"
radiobutton 614 232 192 32 12 "EL 14"
radiobutton 615 232 206 32 12 "EL 15"
radiobutton 616 232 220 32 12 "EL 16"
radiobutton 617 232 234 32 12 "EL 17"
radiobutton 618 232 248 32 12 "EL 18"
radiobutton 619 232 262 32 12 "EL 19"
radiobutton 620 232 276 32 12 "EL 20"
radiobutton 621 492 10 32 12 "EL 21"
radiobutton 622 492 24 32 12 "EL 22"
radiobutton 623 492 38 32 12 "EL 23"
radiobutton 624 492 52 32 12 "EL 24"
radiobutton 625 492 66 32 12 "EL 25"
radiobutton 626 492 80 32 12 "EL 26"
radiobutton 627 492 94 32 12 "EL 27"
radiobutton 628 492 108 32 12 "EL 28"
radiobutton 629 492 122 32 12 "EL 29"
radiobutton 630 492 136 32 12 "EL 30"
radiobutton 631 492 150 32 12 "EL 31"
radiobutton 632 492 164 32 12 "EL 32"
radiobutton 633 492 178 32 12 "EL 33"
radiobutton 634 492 192 32 12 "EL 34"
radiobutton 635 492 206 32 12 "EL 35"
radiobutton 636 492 220 32 12 "EL 36"
radiobutton 637 492 234 32 12 "EL 37"
radiobutton 638 492 248 32 12 "EL 38"
radiobutton 639 492 262 32 12 "EL 39"
radiobutton 640 492 276 32 12 "EL 40"
endgroup
pushbutton 900 205 337 36 11 "Start"
pushbutton 901 287 337 36 11 "Quit"
editbox 903 329 318 194 12 Swindes1 64
pushbutton 904 342 334 42 11 "Open File"
pushbutton 905 403 334 42 11 "Save As"
pushbutton 906 462 334 42 11 "Clear All"
pushbutton 907 6 307 42 11 "Open File"
pushbutton 908 70 307 42 11 "Show File"
text 910 175 308 20 10 smaxrow left
text 911 5 327 194 10 sfilecsv center
checkbox 912 209 297 116 11 "Fill w/comma empty fields (csv)" switch1
checkbox 913 209 307 116 11 "Del initial Line spaces (txt)" switch2
checkbox 914 209 317 116 11 "Del initial Field spaces (csv)" switch3
text 916 5 297 194 10 Sfiletxt center
text 917 329 297 194 10 Sfiletfs center
text 918 116 308 60 10 "Number of Rows:" left
pushbutton 919 6 337 42 11 "New File"
pushbutton 920 70 337 42 11 "Save As"
text 922 256 339 18 10 Spercent center
groupbox 930 205 290 118 43 "Options"
groupbox 931 255 332 20 18 ""
groupbox 932 2 320 200 31 " Select Destination File (.CSV file)"
groupbox 933 2 290 200 30 " Select Source File (.Txt or .Cap)"
groupbox 934 327 290 200 60 " Open/Save - Text Filter Script Files (.tfs)"
enddialog
;*** default window starts
disable DLGCTRL 0 900
disable DLGCTRL 0 908
dlgupdate 0 0,420
dlgupdate 0 900,922
;***** janela swyching control - Hold until EXECUTE is pressed
while 1
dlgevent 0 Event
switch Event
case 0
yield
endcase
;** case 901 - CANCEL WINDOW
case 901
dlgdestroy 0 cancel
usermsg "Operation Canceled"
call finalize
endcase
;** case 904 - OPEN TFS FILE
case 904
sfiletemp0 = Sfiletfs
if sdlgfopen "Select the file .tfs " sfilespec2 SINGLE Sfiletfs
call openscript
endif
if nullstr Sfiletfs
Sfiletfs = sfiletemp0
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
elseif ilpstrt > (ilpend - 100)
disable DLGCTRL 0 900
elseif nullstr Sfiletxt
disable DLGCTRL 0 900
elseif nullstr Sfilecsv
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
dlgupdate 0 0,420
dlgupdate 0 900,922
endcase
;** case 905 - SAVE .UDS FILE
case 905
call savescript
endcase
;** case 906 - CLEAR WINDOW FIELDS
case 906
call clearjanela
endcase
;** case 907 - select and show txtfile
case 907
if sdlgfopen "Selecione o ficheiro .txt ou .cap " SFileSpec3 SINGLE SFiletxt
call showtxtfile
enable DLGCTRL 0 908
dlgupdate 0 0,420
dlgupdate 0 900,922
endif
if nullstr Sfiletxt
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
elseif ilpstrt > (ilpend - 100)
disable DLGCTRL 0 900
elseif nullstr Sfiletxt
disable DLGCTRL 0 900
elseif nullstr Sfilecsv
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
dlgupdate 0 0,420
dlgupdate 0 900,922
endcase
;*** cse 908 Show txt file
case 908
fileview sfiletxt
endcase
;** case 912 - option window switch1
case 912
dlgupdate 0 912
endcase
;** case 913 - option window switch2
case 913
dlgupdate 0 913
endcase
;** case 914 - option window switch3
case 914
dlgupdate 0 914
endcase
;** case 919 - select new csv file
case 919
if sdlgfopen "Select file *.csv " SFileSpec1 SINGLE SFilecsv
endif
dlgupdate 0 911
if nullstr Sfilecsv
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
elseif ilpstrt > (ilpend - 100)
disable DLGCTRL 0 900
elseif nullstr Sfiletxt
disable DLGCTRL 0 900
elseif nullstr Sfilecsv
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
dlgupdate 0 0,420
dlgupdate 0 900,922
endcase
;*** cse 920 save as csv file
case 920
if sdlgsaveas "Select file .csv to save " SFileSpec1 SFilecsv
endif
dlgupdate 0 911
if nullstr Sfilecsv
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
elseif ilpstrt > (ilpend - 100)
disable DLGCTRL 0 900
elseif nullstr Sfiletxt
disable DLGCTRL 0 900
elseif nullstr Sfilecsv
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
endcase
;** case 500 e 600
case 500
if ilpstrt > ilpend-100
alarm 2
errormsg " Start Loop Can't Be Bigger Than End Loop "
disable DLGCTRL 0 900
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
endcase
case 600
if ilpend-100 < ilpstrt
alarm 2
errormsg " End Loop Can't Be Smaller Than Start Loop "
disable DLGCTRL 0 900
elseif nullstr Sfiletfs
disable DLGCTRL 0 900
elseif nullstr Sfiletxt
disable DLGCTRL 0 900
elseif nullstr Sfilecsv
disable DLGCTRL 0 900
else
enable DLGCTRL 0 900
endif
endcase
;** case 900 all ready exit janela & execute UDS
case 900
disable dlgctrl 0 900,920
enable dlgctrl 0 922
call readfile
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 OK
return
endproc ;**************************** end of janela **************************
; end of 1º part ***************************************