Hi
I hope this time you all can try this script for procomm, it's original for P4.8 but I think it will work on P32 too.
- UDS Script - User Defined Script
- basicly it's waitfor/ transmit script.
- with this script you don't need to know aspect, and you can perform small and repeated service changes on Meridian or other systems.
- you can send data from Excel(.CSV)
- create a loop until the data on the CSV files is finished
- and you can save you own .UDS files and use after.
-Problems: some bugs, and the limitations of only 18 commands.
- I'll put some examples of .UDS files to load.
***********************************************************
1º Part
***********************************************************
;LDxxx - User Define Script V2.0 BY JMF 030504
;******************************* Global Variables Definition *********************************
string Swait[19],Scsvfrx[19],Stext[19],Scsvftx[19],Sholdtim[19],swaitforever
string Ssepcart,Swttmunt,Swttmwf,smaxcycl,Smaxcr,stxpacing,smaxrow,scollimit,ssavecsvsw,Swindes1
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 = ",0,1,2,3,4,5,6,7,10,12,15,20,25,30,45,60,90,120,150,180,240,360"
string Slist2 = ",00-Queryuser,01-Time,02-Date,03-Date&Time,04-Time&Date"
integer Iconstsw[19],icsvcolsw[19],Iuntilsw[19],Ientersw[19]
integer Ilpstrt,Ilpend,IHeadRowsw,imaxrow
integer Ialwayssw,Iwaitfsw,Itstmodsw,ilpforeversw,ilpwrsw,imoreitemsw,iopttoudssw,iudssavsw
integer iwttmunt,iwttmwf,imaxcycl,itxpacing,imaxcr,icnvhrsw,isavecsvsw,icollimit
string SFileSpec1,Sfilecsv
string sfilespec2,sfilesav,sfileopen,Stemp1
string sfilespec3
string Srowdata[1000]
string Scoldata[20]
proc main ; ****************************************************************************
;*** Define Variables
string sfiletemp
;*** Define Variables Default Values
sfilespec1 = "c:\*.csv", sfilespec2 = "c:\*.uds",sfilespec3 = "\Functions\*.wax"
slist0 = slista
swaitforever = " Wait Forever "
Ssepcart = ";" ,Swttmunt = "3",Swttmwf = "30", smaxcycl = "0"
Smaxcr = "5", stxpacing = "50",scollimit="19",stemp1 =""
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
stemp1 = "",sfiletemp=""
sfiletemp = sfilespec2
strcat stemp1 sfiletemp
strextract stemp1 sfiletemp "*.uds" 0
strcat stemp1 sfilespec3
sfilespec3 = stemp1
call janela
call whattosend
usermsg "Operation Finished"
call finalize
endproc ;*********************************************************************
proc clearjanela ;*********************************************************************
;** case 206 - CLEAR WINDOW FIELDS and set to saved options settings
Sfilesav ="c:\clear.uds"
sfileopen="c:\clear.uds"
iopttoudssw == 1
if fopen 2 SFileopen read text ; Open file for read.
fgets 2 sfilespec1
fgets 2 sfilespec2
else
fopen 2 SFilesav write text
fputs 2 Sfilespec1
fputs 2 Sfilespec2
endif
fclose 2
call openscript
iopttoudssw == 0
disable DLGCTRL 0 200
if nullstr sfilecsv
disable DLGCTRL 0 208
endif
disable DLGCTRL 0 217
dlgupdate 0 0,217
return
endproc ;*********************************************************************
proc janela ; *********** janela principal e sub-menus ***************************
;*** Define Variables
string Sfiletemp0
integer event,WinID,OwnerID
;*** Define Variables Values
;** janela principal
dialogbox 0 0 0 530 330 135 " Multi Tool - User Defined Script v2.d beta By JMF 032004 - "
groupbox 1 14 0 124 263 " Expect < RX > CSV/Col "
groupbox 2 139 0 31 263 "Pause"
groupbox 3 172 0 204 263 " Future Use Send Text < TX > Send CSV/Col "
groupbox 4 228 5 1 255 ""
groupbox 5 300 5 1 255 ""
groupbox 8 377 0 75 263 "CR <> CR Until RX"
groupbox 9 453 0 74 263 "Start loop--End loop"
text 10 3 12 10 12 "01" left
combobox 11 75 10 60 60 DROPDOWNLIST Slist0 Scsvfrx[1]
editbox 12 17 10 56 12 swaitforever 30
checkbox 13 231 10 10 12 "" Iconstsw[1]
editbox 14 242 10 55 12 Stext[1] 30
checkbox 15 303 10 10 12 "" icsvcolsw[1]
combobox 16 314 10 60 60 DROPDOWNLIST Slist0 Scsvftx[1]
checkbox 17 381 10 25 12 "Rtn" Ientersw[1]
checkbox 18 408 10 40 12 "Rtn Until" Iuntilsw[1]
combobox 19 142 10 26 60 DROPDOWNLIST Slist1 Sholdtim[1]
text 20 3 26 10 12 "02" left
combobox 21 75 24 60 60 DROPDOWNLIST Slist0 Scsvfrx[2]
editbox 22 17 24 56 12 Swait[2] 20
checkbox 23 231 24 10 12 "" Iconstsw[2]
editbox 24 242 24 55 12 Stext[2] 30
checkbox 25 303 24 10 12 "" icsvcolsw[2]
combobox 26 314 24 60 60 DROPDOWNLIST Slist0 Scsvftx[2]
checkbox 27 381 24 25 12 "Rtn" Ientersw[2]
checkbox 28 408 24 40 12 "Rtn Until" Iuntilsw[2]
combobox 29 142 24 26 60 DROPDOWNLIST Slist1 Sholdtim[2]
text 30 3 41 10 12 "03" left
combobox 31 75 39 60 60 DROPDOWNLIST Slist0 Scsvfrx[3]
editbox 32 17 39 56 12 Swait[3] 20
checkbox 33 231 39 10 12 "" Iconstsw[3]
editbox 34 242 39 55 12 Stext[3] 30
checkbox 35 303 39 10 12 "" icsvcolsw[3]
combobox 36 314 39 60 60 DROPDOWNLIST Slist0 Scsvftx[3]
checkbox 37 381 39 25 12 "Rtn" Ientersw[3]
checkbox 38 408 39 40 12 "Rtn Until" Iuntilsw[3]
combobox 39 142 39 26 60 DROPDOWNLIST Slist1 Sholdtim[3]
text 40 3 55 10 12 "04" left
combobox 41 75 53 60 60 DROPDOWNLIST Slist0 Scsvfrx[4]
editbox 42 17 53 56 12 Swait[4] 20
checkbox 43 231 53 10 12 "" Iconstsw[4]
editbox 44 242 53 55 12 Stext[4] 30
checkbox 45 303 53 10 12 "" icsvcolsw[4]
combobox 46 314 53 60 60 DROPDOWNLIST Slist0 Scsvftx[4]
checkbox 47 381 53 25 12 "Rtn" Ientersw[4]
checkbox 48 408 53 40 12 "Rtn Until" Iuntilsw[4]
combobox 49 142 53 26 60 DROPDOWNLIST Slist1 Sholdtim[4]
text 50 3 68 10 12 "05" left
combobox 51 75 66 60 60 DROPDOWNLIST Slist0 Scsvfrx[5]
editbox 52 17 66 56 12 Swait[5] 20
checkbox 53 231 66 10 12 "" Iconstsw[5]
editbox 54 242 66 55 12 Stext[5] 30
checkbox 55 303 66 10 12 "" icsvcolsw[5]
combobox 56 314 66 60 60 DROPDOWNLIST Slist0 Scsvftx[5]
checkbox 57 381 66 25 12 "Rtn" Ientersw[5]
checkbox 58 408 66 40 12 "Rtn Until" Iuntilsw[5]
combobox 59 142 66 26 60 DROPDOWNLIST Slist1 Sholdtim[5]
text 60 3 82 10 12 "06" left
combobox 61 75 80 60 60 DROPDOWNLIST Slist0 Scsvfrx[6]
editbox 62 17 80 56 12 Swait[6] 20
checkbox 63 231 80 10 12 "" Iconstsw[6]
editbox 64 242 80 55 12 Stext[6] 30
checkbox 65 303 80 10 12 "" icsvcolsw[6]
combobox 66 314 80 60 60 DROPDOWNLIST Slist0 Scsvftx[6]
checkbox 67 381 80 25 12 "Rtn" Ientersw[6]
checkbox 68 408 80 40 12 "Rtn Until" Iuntilsw[6]
combobox 69 142 80 26 60 DROPDOWNLIST Slist1 Sholdtim[6]
text 70 3 96 10 12 "07" left
combobox 71 75 95 60 60 DROPDOWNLIST Slist0 Scsvfrx[7]
editbox 72 17 95 56 12 Swait[7] 20
checkbox 73 231 95 10 12 "" Iconstsw[7]
editbox 74 242 95 55 12 Stext[7] 30
checkbox 75 303 95 10 12 "" icsvcolsw[7]
combobox 76 314 95 60 60 DROPDOWNLIST Slist0 Scsvftx[7]
checkbox 77 381 95 25 12 "Rtn" Ientersw[7]
checkbox 78 408 95 40 12 "Rtn Until" Iuntilsw[7]
combobox 79 142 95 26 60 DROPDOWNLIST Slist1 Sholdtim[7]
text 80 3 109 10 12 "08" left
combobox 81 75 109 60 60 DROPDOWNLIST Slist0 Scsvfrx[8]
editbox 82 17 109 56 12 Swait[8] 20
checkbox 83 231 109 10 12 "" Iconstsw[8]
editbox 84 242 109 55 12 Stext[8] 30
checkbox 85 303 109 10 12 "" icsvcolsw[8]
combobox 86 314 109 60 60 DROPDOWNLIST Slist0 Scsvftx[8]
checkbox 87 381 109 25 12 "Rtn" Ientersw[8]
checkbox 88 408 109 40 12 "Rtn Until" Iuntilsw[8]
combobox 89 142 109 26 60 DROPDOWNLIST Slist1 Sholdtim[8]
text 90 3 124 10 12 "09" left
combobox 91 75 122 60 60 DROPDOWNLIST Slist0 Scsvfrx[9]
editbox 92 17 122 56 12 Swait[9] 20
checkbox 93 231 122 10 12 "" Iconstsw[9]
editbox 94 242 122 55 12 Stext[9] 30
checkbox 95 303 122 10 12 "" icsvcolsw[9]
combobox 96 314 122 60 60 DROPDOWNLIST Slist0 Scsvftx[9]
checkbox 97 381 122 25 12 "Rtn" Ientersw[9]
checkbox 98 408 122 40 12 "Rtn Until" Iuntilsw[9]
combobox 99 142 122 26 60 DROPDOWNLIST Slist1 Sholdtim[9]
text 100 3 138 10 12 "10" left
combobox 101 75 136 60 60 DROPDOWNLIST Slist0 Scsvfrx[10]
editbox 102 17 136 56 12 swait[10] 20
checkbox 103 231 136 10 12 "" Iconstsw[10]
editbox 104 242 136 55 12 Stext[10] 30
checkbox 105 303 136 10 12 "" icsvcolsw[10]
combobox 106 314 136 60 60 DROPDOWNLIST Slist0 Scsvftx[10]
checkbox 107 381 136 25 12 "Rtn" Ientersw[10]
checkbox 108 408 136 40 12 "Rtn Until" Iuntilsw[10]
combobox 109 142 136 26 60 DROPDOWNLIST Slist1 Sholdtim[10]
text 110 3 152 10 12 "11" left
combobox 111 75 151 60 60 DROPDOWNLIST Slist0 Scsvfrx[11]
editbox 112 17 151 56 12 swait[11] 20
checkbox 113 231 151 10 12 "" Iconstsw[11]
editbox 114 242 151 55 12 Stext[11] 30
checkbox 115 303 151 10 12 "" icsvcolsw[11]
combobox 116 314 151 60 60 DROPDOWNLIST Slist0 Scsvftx[11]
checkbox 117 381 151 25 12 "Rtn" Ientersw[11]
checkbox 118 408 151 40 12 "Rtn Until" Iuntilsw[11]
combobox 119 142 151 26 60 DROPDOWNLIST Slist1 Sholdtim[11]
text 120 3 165 10 12 "12" left
combobox 121 75 165 60 60 DROPDOWNLIST Slist0 Scsvfrx[12]
editbox 122 17 165 56 12 Swait[12] 20
checkbox 123 231 165 10 12 "" Iconstsw[12]
editbox 124 242 165 55 12 Stext[12] 30
checkbox 125 303 165 10 12 "" icsvcolsw[12]
combobox 126 314 165 60 60 DROPDOWNLIST Slist0 Scsvftx[12]
checkbox 127 381 165 25 12 "Rtn" Ientersw[12]
checkbox 128 408 165 40 12 "Rtn Until" Iuntilsw[12]
combobox 129 142 165 26 60 DROPDOWNLIST Slist1 Sholdtim[12]
text 130 3 180 10 12 "13" left
combobox 131 75 178 60 60 DROPDOWNLIST Slist0 Scsvfrx[13]
editbox 132 17 178 56 12 Swait[13] 20
checkbox 133 231 178 10 12 "" Iconstsw[13]
editbox 134 242 178 55 12 Stext[13] 30
checkbox 135 303 178 10 12 "" icsvcolsw[13]
combobox 136 314 178 60 60 DROPDOWNLIST Slist0 Scsvftx[13]
checkbox 137 381 178 25 12 "Rtn" Ientersw[13]
checkbox 138 408 178 40 12 "Rtn Until" Iuntilsw[13]
combobox 139 142 178 26 60 DROPDOWNLIST Slist1 Sholdtim[13]
text 140 3 194 10 12 "14" left
combobox 141 75 192 60 60 DROPDOWNLIST Slist0 Scsvfrx[14]
editbox 142 17 192 56 12 Swait[14] 20
checkbox 143 231 192 10 12 "" Iconstsw[14]
editbox 144 242 192 55 12 Stext[14] 30
checkbox 145 303 192 10 12 "" icsvcolsw[14]
combobox 146 314 192 60 60 DROPDOWNLIST Slist0 Scsvftx[14]
checkbox 147 381 192 25 12 "Rtn" Ientersw[14]
checkbox 148 408 192 40 12 "Rtn Until" Iuntilsw[14]
combobox 149 142 192 26 60 DROPDOWNLIST Slist1 Sholdtim[14]
text 150 3 208 10 12 "15" left
combobox 151 75 207 60 60 DROPDOWNLIST Slist0 Scsvfrx[15]
editbox 152 17 207 56 12 Swait[15] 20
checkbox 153 231 207 10 12 "" Iconstsw[15]
editbox 154 242 207 55 12 Stext[15] 30
checkbox 155 303 207 10 12 "" icsvcolsw[15]
combobox 156 314 207 60 60 DROPDOWNLIST Slist0 Scsvftx[15]
checkbox 157 381 207 25 12 "Rtn" Ientersw[15]
checkbox 158 408 207 40 12 "Rtn Until" Iuntilsw[15]
combobox 159 142 207 26 60 DROPDOWNLIST Slist1 Sholdtim[15]
text 160 3 221 10 12 "16" left
combobox 161 75 221 60 60 DROPDOWNLIST Slist0 Scsvfrx[16]
editbox 162 17 221 56 12 Swait[16] 20
checkbox 163 231 221 10 12 "" Iconstsw[16]
editbox 164 242 221 55 12 Stext[16] 30
checkbox 165 303 221 10 12 "" icsvcolsw[16]
combobox 166 314 221 60 60 DROPDOWNLIST Slist0 Scsvftx[16]
checkbox 167 381 221 25 12 "Rtn" Ientersw[16]
checkbox 168 408 221 40 12 "Rtn Until" Iuntilsw[16]
combobox 169 142 221 26 60 DROPDOWNLIST Slist1 Sholdtim[16]
text 170 3 236 10 12 "17" left
combobox 171 75 234 60 60 DROPDOWNLIST Slist0 Scsvfrx[17]
editbox 172 17 234 56 12 Swait[17] 20
checkbox 173 231 234 10 12 "" Iconstsw[17]
editbox 174 242 234 55 12 Stext[17] 30
checkbox 175 303 234 10 12 "" icsvcolsw[17]
combobox 176 314 234 60 60 DROPDOWNLIST Slist0 Scsvftx[17]
checkbox 177 381 234 25 12 "Rtn" Ientersw[17]
checkbox 178 408 234 40 12 "Rtn Until" Iuntilsw[17]
combobox 179 142 234 26 60 DROPDOWNLIST Slist1 Sholdtim[17]
text 180 3 250 10 12 "18" left
combobox 181 75 248 60 60 DROPDOWNLIST Slist0 Scsvfrx[18]
editbox 182 17 248 56 12 Swait[18] 20
checkbox 183 231 248 10 12 "" Iconstsw[18]
editbox 184 242 248 55 12 Stext[18] 30
checkbox 185 303 248 10 12 "" icsvcolsw[18]
combobox 186 314 248 60 60 DROPDOWNLIST Slist0 Scsvftx[18]
checkbox 187 381 248 25 12 "Rtn" Ientersw[18]
checkbox 188 408 248 40 12 "Rtn Until" Iuntilsw[18]
combobox 189 142 248 26 60 DROPDOWNLIST Slist1 Sholdtim[18]
pushbutton 200 274 307 42 12 "Execute" OK
pushbutton 201 214 308 42 10 "Quit" Cancel
editbox 202 5 296 194 12 Srowdata[0] 64
editbox 203 329 296 194 12 Swindes1 64
pushbutton 204 342 310 42 11 "Open File"
pushbutton 205 403 310 42 11 "Save As"
pushbutton 206 462 310 42 11 "Clear All"
pushbutton 207 10 310 42 11 "Open File"
pushbutton 208 100 310 42 11 "Show File"
checkbox 209 145 310 53 12 "Header Row" IHeadRowsw
text 210 77 312 20 12 smaxrow left
pushbutton 211 274 290 42 10 "Options"
pushbutton 212 214 290 42 10 "Terminal"
groupbox 213 2 265 200 60 " Open File .csv (Excel File saved as .csv(msdos))"
groupbox 214 327 267 200 60 " Open/Save - User Defined Script Files (.uds)"
text 216 5 275 194 18 Sfilecsv center
text 217 329 275 194 18 Sfileopen center
text 218 55 312 20 12 "Rows:" left
pushbutton 219 274 272 42 10 "Extra Lines"
pushbutton 220 214 272 42 10 "Help && Tips"
radiogroup 500 Ilpstrt
radiobutton 501 456 10 32 12 "SL 01"
radiobutton 502 456 24 32 12 "SL 02"
radiobutton 503 456 38 32 12 "SL 03"
radiobutton 504 456 52 32 12 "SL 04"
radiobutton 505 456 66 32 12 "SL 05"
radiobutton 506 456 80 32 12 "SL 06"
radiobutton 507 456 94 32 12 "SL 07"
radiobutton 508 456 108 32 12 "SL 08"
radiobutton 509 456 122 32 12 "SL 09"
radiobutton 510 456 136 32 12 "SL 10"
radiobutton 511 456 150 32 12 "SL 11"
radiobutton 512 456 164 32 12 "SL 12"
radiobutton 513 456 178 32 12 "SL 13"
radiobutton 514 456 192 32 12 "SL 14"
radiobutton 515 456 206 32 12 "SL 15"
radiobutton 516 456 220 32 12 "SL 16"
radiobutton 517 456 234 32 12 "SL 17"
radiobutton 518 456 248 32 12 "SL 18"
endgroup
radiogroup 600 Ilpend
radiobutton 601 492 10 32 12 "EL 01"
radiobutton 602 492 24 32 12 "EL 02"
radiobutton 603 492 38 32 12 "EL 03"
radiobutton 604 492 52 32 12 "EL 04"
radiobutton 605 492 66 32 12 "EL 05"
radiobutton 606 492 80 32 12 "EL 06"
radiobutton 607 492 94 32 12 "EL 07"
radiobutton 608 492 108 32 12 "EL 08"
radiobutton 609 492 122 32 12 "EL 09"
radiobutton 610 492 136 32 12 "EL 10"
radiobutton 611 492 150 32 12 "EL 11"
radiobutton 612 492 164 32 12 "EL 12"
radiobutton 613 492 178 32 12 "EL 13"
radiobutton 614 492 192 32 12 "EL 14"
radiobutton 615 492 206 32 12 "EL 15"
radiobutton 616 492 220 32 12 "EL 16"
radiobutton 617 492 234 32 12 "EL 17"
radiobutton 618 492 248 32 12 "EL 18"
endgroup
enddialog
;*** default window starts
disable DLGCTRL 0 12
disable DLGCTRL 0 188
disable DLGCTRL 0 200
disable DLGCTRL 0 202
disable DLGCTRL 0 208
disable DLGCTRL 0 219,220
dlgupdate 0 0,217
;***** janela swyching control - Hold until EXECUTE is pressed
while 1
dlgevent 0 Event
switch Event
case 0
yield
endcase
;** case 201 - CANCEL WINDOW
case 201
dlgdestroy 0 cancel
usermsg "Operação Cancelada"
call finalize
endcase
;** case 204 - OPEN UDS FILE
case 204
sfiletemp0 = sfileopen
if sdlgfopen "Selecione o ficheiro .uds " sfilespec2 SINGLE sfileopen
call openscript
endif
if nullstr sfileopen
sfileopen = sfiletemp0
elseif nullstr sfileopen
disable DLGCTRL 0 200
elseif ilpstrt > (ilpend - 100)
disable DLGCTRL 0 200
else
enable DLGCTRL 0 200
endif
dlgupdate 0 0,218
endcase
;** case 205 - SAVE .UDS FILE
case 205
call savescript
endcase
;** case 206 - CLEAR WINDOW FIELDS
case 206
call clearjanela
endcase
;** case 207 - select and show csvfile
case 207
if sdlgfopen "Selecione o ficheiro .csv " sfilespec1 SINGLE sfilecsv
call showcsvfile
enable DLGCTRL 0 208
dlgupdate 0 0,217
elseif nullstr sfilecsv
Smaxrow = "0",iheadrowsw = 0
Srowdata[0] = $nullstr
Slist0 = ",00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19"
disable DLGCTRL 0 208
dlgupdate 0 0,218
endif
endcase
;*** cse 208 Show csv file
case 208
call showcsvfile
endcase
;** case 209 Header Row yes or no
case 209
if iheadrowsw == 1
enable DLGCTRL 0 202
imaxrow = imaxrow > 0 ? imaxrow - 1 : 0
if icnvhrsw == 1
call csvnumtonam
endif
else
disable DLGCTRL 0 202
imaxrow = imaxrow > 0 ? imaxrow + 1 : 0
Slist0 = ",00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19"
endif
itoa imaxrow smaxrow
dlgupdate 0 0,218
endcase
;** case 211 options window
case 211
call opcoes
endcase
;** case 212 hide janela
case 212
dlgwin 0 WinID
winowner WinID OwnerID
winfocus OwnerID
winhide WinID
call hidewindow
winfocus WinID
winshow WinID
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 200
elseif nullstr sfileopen
disable DLGCTRL 0 200
else
enable DLGCTRL 0 200
endif
endcase
case 600
if ilpend-100 < ilpstrt
alarm 2
errormsg " End Loop Can't Be Smaller Than Start Loop "
disable DLGCTRL 0 200
elseif nullstr sfileopen
disable DLGCTRL 0 200
else
enable DLGCTRL 0 200
endif
if ilpend == 618
enable DLGCTRL 0 188
else
disable DLGCTRL 0 188
endif
endcase
;** case 200 all ready exit janela & execute UDS
case 200
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 OK
return
endproc ;**************************** end of janela **************************
proc whattosend ;*********************************************************************
;*** Define Variables
integer icntrow,icntrlow,icntrhigh
integer icntcol,icntclow,icntchigh
integer icnt0,itemp0,imincol,imaxcol
integer icntirow,icntirow1,icntilow,icntihigh
integer icntlp,icntllow,icntlhigh
integer irowtemp
;*** definitions
set txpace itxpacing
ilpstrt = ilpstrt - 500
ilpend = ilpend - 600
switch ilpforeversw
case 23 ; all forever
irowtemp = 0
endcase
case 22 ; loop forever
irowtemp = 1
endcase
default
irowtemp = imaxrow > 0 ? imaxrow : imaxcycl
if iheadrowsw == 1
icntrlow = 1
icntrhigh = irowtemp
else
icntrlow = 0
icntrhigh = irowtemp > 0 ? irowtemp - 1 : 0
endif
endcase
endswitch
;* extract col num from scol
;* find maxcol & mincol
itemp0=0,imaxcol=0,imincol=0
for icnt0 = 1 upto 18
atoi Scsvftx[icnt0] itemp0
imaxcol = itemp0 > imaxcol ? itemp0 : imaxcol
imincol = itemp0 < imincol ? itemp0 : imincol
endfor
;*
icntilow = 1
icntihigh = 18
icntclow = imincol
icntchigh = imaxcol
icntllow = ilpstrt
icntlhigh = ilpend
;***no loop send to com item line
for icntirow = icntilow upto icntihigh
;*** Loop Rows or Cycles
if (icntirow >= ilpstrt && icntirow <= ilpend) && irowtemp > 0
for icntrow = icntrlow upto icntrhigh
;*** Read colunm from row
for icntcol = icntclow upto icntchigh
strextract scoldata[icntcol] srowdata[icntrow] Ssepcart icntcol
endfor
;*** Loop (SL/EL)
for icntlp = icntllow upto icntlhigh
if icntlp == icntlhigh & icntrow < irowtemp
icntirow1 = icntllow
else
icntirow1 = icntlp + 1
endif
icntirow = icntlp
if itstmodsw == 1
call sendtotestwindow with icntirow,icntirow1
else
call sendtocom with icntirow,icntirow1
endif
;***loop forever switch
if ilpforeversw == 22 && icntlp == icntlhigh
icntlp = icntllow-1
loopfor
endif
endfor
icntirow = icntirow < icntihigh ? icntirow + 1 : icntihigh
endfor
endif
if icntirow < ilpstrt | icntirow > ilpend | irowtemp == 0
if icntirow > icntihigh
return
else
icntirow1 = icntirow + 1
endif
if itstmodsw == 1
call sendtotestwindow with icntirow,icntirow1
else
call sendtocom with icntirow,icntirow1
endif
;***all forever switch
if ilpforeversw == 23 && icntirow == icntihigh
icntirow = icntilow-1
loopfor
endif
endif
endfor
return
endproc ;*********************************************************************
proc sendtotestwindow ;*** send to message window for testing UDS script *******************
;*** variables definition
param integer icntirow,icntirow1
integer itemp0,itemp1
;*** waitfor swaituntil forever
if iwaitfsw == 1
if not nullstr swaitforever
usermsg "RX waitfor forever (30s)test => % s" swaitforever
waitfor swaitforever 30 ; forever
endif
endif
;*** pause (x)
if not nullstr sholdtim[icntirow]
atoi sholdtim[icntirow] itemp0
usermsg "PAUSE for => %d" itemp0
PAUSE 5
itemp0 = 0
endif
;*** transmit constant
if Iconstsw[icntirow] == 1
usermsg "TX TXT => % s" stext[icntirow]
endif
;*** transmit variable
if icsvcolsw[icntirow] == 1
atoi Scsvftx[icntirow] itemp0
usermsg "TX CSV FIELD => % s" scoldata[itemp0]
endif
;*** transmit one CR
if Ientersw[icntirow] == 1
usermsg "TX SEND CR"
endif
;*** waitfor & transmit CR until next waitfor ; time 1 atencao
if icntirow == 18 ; aqui tinha | icntlp == 18 ** ver ilpend != 18
return
endif
if Iuntilsw[icntirow] == 1
itemp0 = 0,itemp1 = 0
if not nullstr Scsvfrx[icntirow1]
atoi Scsvfrx[icntirow1] itemp1
usermsg "RX SEND CR UNTIL CSV => % s" scoldata[itemp1]
while not waitfor scoldata[itemp1] iwttmunt
itemp0 = itemp0 + 1
if itemp0 == imaxcr
exitwhile
endif
usermsg "TX SEND CR U"
endwhile
else
usermsg "RX SEND CR UNTIL => % s" swait[icntirow1]
while not waitfor swait[icntirow1] iwttmunt
itemp0 = itemp0 + 1
if itemp0 == imaxcr
exitwhile
endif
usermsg "TX SEND CR U"
endwhile
endif
elseif not nullstr swait[icntirow1]
usermsg "RX WAITFOR => % s" swait[icntirow1]
waitfor swait[icntirow1] iwttmwf
elseif not nullstr Scsvfrx[icntirow1]
itemp1 = 0
atoi Scsvfrx[icntirow1] itemp1
usermsg "RX WAITFOR CSV => % s" scoldata[itemp1]
waitfor scoldata[itemp1] iwttmunt
endif
return
endproc ;*********************************************************************
I hope this time you all can try this script for procomm, it's original for P4.8 but I think it will work on P32 too.
- UDS Script - User Defined Script
- basicly it's waitfor/ transmit script.
- with this script you don't need to know aspect, and you can perform small and repeated service changes on Meridian or other systems.
- you can send data from Excel(.CSV)
- create a loop until the data on the CSV files is finished
- and you can save you own .UDS files and use after.
-Problems: some bugs, and the limitations of only 18 commands.
- I'll put some examples of .UDS files to load.
***********************************************************
1º Part
***********************************************************
;LDxxx - User Define Script V2.0 BY JMF 030504
;******************************* Global Variables Definition *********************************
string Swait[19],Scsvfrx[19],Stext[19],Scsvftx[19],Sholdtim[19],swaitforever
string Ssepcart,Swttmunt,Swttmwf,smaxcycl,Smaxcr,stxpacing,smaxrow,scollimit,ssavecsvsw,Swindes1
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 = ",0,1,2,3,4,5,6,7,10,12,15,20,25,30,45,60,90,120,150,180,240,360"
string Slist2 = ",00-Queryuser,01-Time,02-Date,03-Date&Time,04-Time&Date"
integer Iconstsw[19],icsvcolsw[19],Iuntilsw[19],Ientersw[19]
integer Ilpstrt,Ilpend,IHeadRowsw,imaxrow
integer Ialwayssw,Iwaitfsw,Itstmodsw,ilpforeversw,ilpwrsw,imoreitemsw,iopttoudssw,iudssavsw
integer iwttmunt,iwttmwf,imaxcycl,itxpacing,imaxcr,icnvhrsw,isavecsvsw,icollimit
string SFileSpec1,Sfilecsv
string sfilespec2,sfilesav,sfileopen,Stemp1
string sfilespec3
string Srowdata[1000]
string Scoldata[20]
proc main ; ****************************************************************************
;*** Define Variables
string sfiletemp
;*** Define Variables Default Values
sfilespec1 = "c:\*.csv", sfilespec2 = "c:\*.uds",sfilespec3 = "\Functions\*.wax"
slist0 = slista
swaitforever = " Wait Forever "
Ssepcart = ";" ,Swttmunt = "3",Swttmwf = "30", smaxcycl = "0"
Smaxcr = "5", stxpacing = "50",scollimit="19",stemp1 =""
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
stemp1 = "",sfiletemp=""
sfiletemp = sfilespec2
strcat stemp1 sfiletemp
strextract stemp1 sfiletemp "*.uds" 0
strcat stemp1 sfilespec3
sfilespec3 = stemp1
call janela
call whattosend
usermsg "Operation Finished"
call finalize
endproc ;*********************************************************************
proc clearjanela ;*********************************************************************
;** case 206 - CLEAR WINDOW FIELDS and set to saved options settings
Sfilesav ="c:\clear.uds"
sfileopen="c:\clear.uds"
iopttoudssw == 1
if fopen 2 SFileopen read text ; Open file for read.
fgets 2 sfilespec1
fgets 2 sfilespec2
else
fopen 2 SFilesav write text
fputs 2 Sfilespec1
fputs 2 Sfilespec2
endif
fclose 2
call openscript
iopttoudssw == 0
disable DLGCTRL 0 200
if nullstr sfilecsv
disable DLGCTRL 0 208
endif
disable DLGCTRL 0 217
dlgupdate 0 0,217
return
endproc ;*********************************************************************
proc janela ; *********** janela principal e sub-menus ***************************
;*** Define Variables
string Sfiletemp0
integer event,WinID,OwnerID
;*** Define Variables Values
;** janela principal
dialogbox 0 0 0 530 330 135 " Multi Tool - User Defined Script v2.d beta By JMF 032004 - "
groupbox 1 14 0 124 263 " Expect < RX > CSV/Col "
groupbox 2 139 0 31 263 "Pause"
groupbox 3 172 0 204 263 " Future Use Send Text < TX > Send CSV/Col "
groupbox 4 228 5 1 255 ""
groupbox 5 300 5 1 255 ""
groupbox 8 377 0 75 263 "CR <> CR Until RX"
groupbox 9 453 0 74 263 "Start loop--End loop"
text 10 3 12 10 12 "01" left
combobox 11 75 10 60 60 DROPDOWNLIST Slist0 Scsvfrx[1]
editbox 12 17 10 56 12 swaitforever 30
checkbox 13 231 10 10 12 "" Iconstsw[1]
editbox 14 242 10 55 12 Stext[1] 30
checkbox 15 303 10 10 12 "" icsvcolsw[1]
combobox 16 314 10 60 60 DROPDOWNLIST Slist0 Scsvftx[1]
checkbox 17 381 10 25 12 "Rtn" Ientersw[1]
checkbox 18 408 10 40 12 "Rtn Until" Iuntilsw[1]
combobox 19 142 10 26 60 DROPDOWNLIST Slist1 Sholdtim[1]
text 20 3 26 10 12 "02" left
combobox 21 75 24 60 60 DROPDOWNLIST Slist0 Scsvfrx[2]
editbox 22 17 24 56 12 Swait[2] 20
checkbox 23 231 24 10 12 "" Iconstsw[2]
editbox 24 242 24 55 12 Stext[2] 30
checkbox 25 303 24 10 12 "" icsvcolsw[2]
combobox 26 314 24 60 60 DROPDOWNLIST Slist0 Scsvftx[2]
checkbox 27 381 24 25 12 "Rtn" Ientersw[2]
checkbox 28 408 24 40 12 "Rtn Until" Iuntilsw[2]
combobox 29 142 24 26 60 DROPDOWNLIST Slist1 Sholdtim[2]
text 30 3 41 10 12 "03" left
combobox 31 75 39 60 60 DROPDOWNLIST Slist0 Scsvfrx[3]
editbox 32 17 39 56 12 Swait[3] 20
checkbox 33 231 39 10 12 "" Iconstsw[3]
editbox 34 242 39 55 12 Stext[3] 30
checkbox 35 303 39 10 12 "" icsvcolsw[3]
combobox 36 314 39 60 60 DROPDOWNLIST Slist0 Scsvftx[3]
checkbox 37 381 39 25 12 "Rtn" Ientersw[3]
checkbox 38 408 39 40 12 "Rtn Until" Iuntilsw[3]
combobox 39 142 39 26 60 DROPDOWNLIST Slist1 Sholdtim[3]
text 40 3 55 10 12 "04" left
combobox 41 75 53 60 60 DROPDOWNLIST Slist0 Scsvfrx[4]
editbox 42 17 53 56 12 Swait[4] 20
checkbox 43 231 53 10 12 "" Iconstsw[4]
editbox 44 242 53 55 12 Stext[4] 30
checkbox 45 303 53 10 12 "" icsvcolsw[4]
combobox 46 314 53 60 60 DROPDOWNLIST Slist0 Scsvftx[4]
checkbox 47 381 53 25 12 "Rtn" Ientersw[4]
checkbox 48 408 53 40 12 "Rtn Until" Iuntilsw[4]
combobox 49 142 53 26 60 DROPDOWNLIST Slist1 Sholdtim[4]
text 50 3 68 10 12 "05" left
combobox 51 75 66 60 60 DROPDOWNLIST Slist0 Scsvfrx[5]
editbox 52 17 66 56 12 Swait[5] 20
checkbox 53 231 66 10 12 "" Iconstsw[5]
editbox 54 242 66 55 12 Stext[5] 30
checkbox 55 303 66 10 12 "" icsvcolsw[5]
combobox 56 314 66 60 60 DROPDOWNLIST Slist0 Scsvftx[5]
checkbox 57 381 66 25 12 "Rtn" Ientersw[5]
checkbox 58 408 66 40 12 "Rtn Until" Iuntilsw[5]
combobox 59 142 66 26 60 DROPDOWNLIST Slist1 Sholdtim[5]
text 60 3 82 10 12 "06" left
combobox 61 75 80 60 60 DROPDOWNLIST Slist0 Scsvfrx[6]
editbox 62 17 80 56 12 Swait[6] 20
checkbox 63 231 80 10 12 "" Iconstsw[6]
editbox 64 242 80 55 12 Stext[6] 30
checkbox 65 303 80 10 12 "" icsvcolsw[6]
combobox 66 314 80 60 60 DROPDOWNLIST Slist0 Scsvftx[6]
checkbox 67 381 80 25 12 "Rtn" Ientersw[6]
checkbox 68 408 80 40 12 "Rtn Until" Iuntilsw[6]
combobox 69 142 80 26 60 DROPDOWNLIST Slist1 Sholdtim[6]
text 70 3 96 10 12 "07" left
combobox 71 75 95 60 60 DROPDOWNLIST Slist0 Scsvfrx[7]
editbox 72 17 95 56 12 Swait[7] 20
checkbox 73 231 95 10 12 "" Iconstsw[7]
editbox 74 242 95 55 12 Stext[7] 30
checkbox 75 303 95 10 12 "" icsvcolsw[7]
combobox 76 314 95 60 60 DROPDOWNLIST Slist0 Scsvftx[7]
checkbox 77 381 95 25 12 "Rtn" Ientersw[7]
checkbox 78 408 95 40 12 "Rtn Until" Iuntilsw[7]
combobox 79 142 95 26 60 DROPDOWNLIST Slist1 Sholdtim[7]
text 80 3 109 10 12 "08" left
combobox 81 75 109 60 60 DROPDOWNLIST Slist0 Scsvfrx[8]
editbox 82 17 109 56 12 Swait[8] 20
checkbox 83 231 109 10 12 "" Iconstsw[8]
editbox 84 242 109 55 12 Stext[8] 30
checkbox 85 303 109 10 12 "" icsvcolsw[8]
combobox 86 314 109 60 60 DROPDOWNLIST Slist0 Scsvftx[8]
checkbox 87 381 109 25 12 "Rtn" Ientersw[8]
checkbox 88 408 109 40 12 "Rtn Until" Iuntilsw[8]
combobox 89 142 109 26 60 DROPDOWNLIST Slist1 Sholdtim[8]
text 90 3 124 10 12 "09" left
combobox 91 75 122 60 60 DROPDOWNLIST Slist0 Scsvfrx[9]
editbox 92 17 122 56 12 Swait[9] 20
checkbox 93 231 122 10 12 "" Iconstsw[9]
editbox 94 242 122 55 12 Stext[9] 30
checkbox 95 303 122 10 12 "" icsvcolsw[9]
combobox 96 314 122 60 60 DROPDOWNLIST Slist0 Scsvftx[9]
checkbox 97 381 122 25 12 "Rtn" Ientersw[9]
checkbox 98 408 122 40 12 "Rtn Until" Iuntilsw[9]
combobox 99 142 122 26 60 DROPDOWNLIST Slist1 Sholdtim[9]
text 100 3 138 10 12 "10" left
combobox 101 75 136 60 60 DROPDOWNLIST Slist0 Scsvfrx[10]
editbox 102 17 136 56 12 swait[10] 20
checkbox 103 231 136 10 12 "" Iconstsw[10]
editbox 104 242 136 55 12 Stext[10] 30
checkbox 105 303 136 10 12 "" icsvcolsw[10]
combobox 106 314 136 60 60 DROPDOWNLIST Slist0 Scsvftx[10]
checkbox 107 381 136 25 12 "Rtn" Ientersw[10]
checkbox 108 408 136 40 12 "Rtn Until" Iuntilsw[10]
combobox 109 142 136 26 60 DROPDOWNLIST Slist1 Sholdtim[10]
text 110 3 152 10 12 "11" left
combobox 111 75 151 60 60 DROPDOWNLIST Slist0 Scsvfrx[11]
editbox 112 17 151 56 12 swait[11] 20
checkbox 113 231 151 10 12 "" Iconstsw[11]
editbox 114 242 151 55 12 Stext[11] 30
checkbox 115 303 151 10 12 "" icsvcolsw[11]
combobox 116 314 151 60 60 DROPDOWNLIST Slist0 Scsvftx[11]
checkbox 117 381 151 25 12 "Rtn" Ientersw[11]
checkbox 118 408 151 40 12 "Rtn Until" Iuntilsw[11]
combobox 119 142 151 26 60 DROPDOWNLIST Slist1 Sholdtim[11]
text 120 3 165 10 12 "12" left
combobox 121 75 165 60 60 DROPDOWNLIST Slist0 Scsvfrx[12]
editbox 122 17 165 56 12 Swait[12] 20
checkbox 123 231 165 10 12 "" Iconstsw[12]
editbox 124 242 165 55 12 Stext[12] 30
checkbox 125 303 165 10 12 "" icsvcolsw[12]
combobox 126 314 165 60 60 DROPDOWNLIST Slist0 Scsvftx[12]
checkbox 127 381 165 25 12 "Rtn" Ientersw[12]
checkbox 128 408 165 40 12 "Rtn Until" Iuntilsw[12]
combobox 129 142 165 26 60 DROPDOWNLIST Slist1 Sholdtim[12]
text 130 3 180 10 12 "13" left
combobox 131 75 178 60 60 DROPDOWNLIST Slist0 Scsvfrx[13]
editbox 132 17 178 56 12 Swait[13] 20
checkbox 133 231 178 10 12 "" Iconstsw[13]
editbox 134 242 178 55 12 Stext[13] 30
checkbox 135 303 178 10 12 "" icsvcolsw[13]
combobox 136 314 178 60 60 DROPDOWNLIST Slist0 Scsvftx[13]
checkbox 137 381 178 25 12 "Rtn" Ientersw[13]
checkbox 138 408 178 40 12 "Rtn Until" Iuntilsw[13]
combobox 139 142 178 26 60 DROPDOWNLIST Slist1 Sholdtim[13]
text 140 3 194 10 12 "14" left
combobox 141 75 192 60 60 DROPDOWNLIST Slist0 Scsvfrx[14]
editbox 142 17 192 56 12 Swait[14] 20
checkbox 143 231 192 10 12 "" Iconstsw[14]
editbox 144 242 192 55 12 Stext[14] 30
checkbox 145 303 192 10 12 "" icsvcolsw[14]
combobox 146 314 192 60 60 DROPDOWNLIST Slist0 Scsvftx[14]
checkbox 147 381 192 25 12 "Rtn" Ientersw[14]
checkbox 148 408 192 40 12 "Rtn Until" Iuntilsw[14]
combobox 149 142 192 26 60 DROPDOWNLIST Slist1 Sholdtim[14]
text 150 3 208 10 12 "15" left
combobox 151 75 207 60 60 DROPDOWNLIST Slist0 Scsvfrx[15]
editbox 152 17 207 56 12 Swait[15] 20
checkbox 153 231 207 10 12 "" Iconstsw[15]
editbox 154 242 207 55 12 Stext[15] 30
checkbox 155 303 207 10 12 "" icsvcolsw[15]
combobox 156 314 207 60 60 DROPDOWNLIST Slist0 Scsvftx[15]
checkbox 157 381 207 25 12 "Rtn" Ientersw[15]
checkbox 158 408 207 40 12 "Rtn Until" Iuntilsw[15]
combobox 159 142 207 26 60 DROPDOWNLIST Slist1 Sholdtim[15]
text 160 3 221 10 12 "16" left
combobox 161 75 221 60 60 DROPDOWNLIST Slist0 Scsvfrx[16]
editbox 162 17 221 56 12 Swait[16] 20
checkbox 163 231 221 10 12 "" Iconstsw[16]
editbox 164 242 221 55 12 Stext[16] 30
checkbox 165 303 221 10 12 "" icsvcolsw[16]
combobox 166 314 221 60 60 DROPDOWNLIST Slist0 Scsvftx[16]
checkbox 167 381 221 25 12 "Rtn" Ientersw[16]
checkbox 168 408 221 40 12 "Rtn Until" Iuntilsw[16]
combobox 169 142 221 26 60 DROPDOWNLIST Slist1 Sholdtim[16]
text 170 3 236 10 12 "17" left
combobox 171 75 234 60 60 DROPDOWNLIST Slist0 Scsvfrx[17]
editbox 172 17 234 56 12 Swait[17] 20
checkbox 173 231 234 10 12 "" Iconstsw[17]
editbox 174 242 234 55 12 Stext[17] 30
checkbox 175 303 234 10 12 "" icsvcolsw[17]
combobox 176 314 234 60 60 DROPDOWNLIST Slist0 Scsvftx[17]
checkbox 177 381 234 25 12 "Rtn" Ientersw[17]
checkbox 178 408 234 40 12 "Rtn Until" Iuntilsw[17]
combobox 179 142 234 26 60 DROPDOWNLIST Slist1 Sholdtim[17]
text 180 3 250 10 12 "18" left
combobox 181 75 248 60 60 DROPDOWNLIST Slist0 Scsvfrx[18]
editbox 182 17 248 56 12 Swait[18] 20
checkbox 183 231 248 10 12 "" Iconstsw[18]
editbox 184 242 248 55 12 Stext[18] 30
checkbox 185 303 248 10 12 "" icsvcolsw[18]
combobox 186 314 248 60 60 DROPDOWNLIST Slist0 Scsvftx[18]
checkbox 187 381 248 25 12 "Rtn" Ientersw[18]
checkbox 188 408 248 40 12 "Rtn Until" Iuntilsw[18]
combobox 189 142 248 26 60 DROPDOWNLIST Slist1 Sholdtim[18]
pushbutton 200 274 307 42 12 "Execute" OK
pushbutton 201 214 308 42 10 "Quit" Cancel
editbox 202 5 296 194 12 Srowdata[0] 64
editbox 203 329 296 194 12 Swindes1 64
pushbutton 204 342 310 42 11 "Open File"
pushbutton 205 403 310 42 11 "Save As"
pushbutton 206 462 310 42 11 "Clear All"
pushbutton 207 10 310 42 11 "Open File"
pushbutton 208 100 310 42 11 "Show File"
checkbox 209 145 310 53 12 "Header Row" IHeadRowsw
text 210 77 312 20 12 smaxrow left
pushbutton 211 274 290 42 10 "Options"
pushbutton 212 214 290 42 10 "Terminal"
groupbox 213 2 265 200 60 " Open File .csv (Excel File saved as .csv(msdos))"
groupbox 214 327 267 200 60 " Open/Save - User Defined Script Files (.uds)"
text 216 5 275 194 18 Sfilecsv center
text 217 329 275 194 18 Sfileopen center
text 218 55 312 20 12 "Rows:" left
pushbutton 219 274 272 42 10 "Extra Lines"
pushbutton 220 214 272 42 10 "Help && Tips"
radiogroup 500 Ilpstrt
radiobutton 501 456 10 32 12 "SL 01"
radiobutton 502 456 24 32 12 "SL 02"
radiobutton 503 456 38 32 12 "SL 03"
radiobutton 504 456 52 32 12 "SL 04"
radiobutton 505 456 66 32 12 "SL 05"
radiobutton 506 456 80 32 12 "SL 06"
radiobutton 507 456 94 32 12 "SL 07"
radiobutton 508 456 108 32 12 "SL 08"
radiobutton 509 456 122 32 12 "SL 09"
radiobutton 510 456 136 32 12 "SL 10"
radiobutton 511 456 150 32 12 "SL 11"
radiobutton 512 456 164 32 12 "SL 12"
radiobutton 513 456 178 32 12 "SL 13"
radiobutton 514 456 192 32 12 "SL 14"
radiobutton 515 456 206 32 12 "SL 15"
radiobutton 516 456 220 32 12 "SL 16"
radiobutton 517 456 234 32 12 "SL 17"
radiobutton 518 456 248 32 12 "SL 18"
endgroup
radiogroup 600 Ilpend
radiobutton 601 492 10 32 12 "EL 01"
radiobutton 602 492 24 32 12 "EL 02"
radiobutton 603 492 38 32 12 "EL 03"
radiobutton 604 492 52 32 12 "EL 04"
radiobutton 605 492 66 32 12 "EL 05"
radiobutton 606 492 80 32 12 "EL 06"
radiobutton 607 492 94 32 12 "EL 07"
radiobutton 608 492 108 32 12 "EL 08"
radiobutton 609 492 122 32 12 "EL 09"
radiobutton 610 492 136 32 12 "EL 10"
radiobutton 611 492 150 32 12 "EL 11"
radiobutton 612 492 164 32 12 "EL 12"
radiobutton 613 492 178 32 12 "EL 13"
radiobutton 614 492 192 32 12 "EL 14"
radiobutton 615 492 206 32 12 "EL 15"
radiobutton 616 492 220 32 12 "EL 16"
radiobutton 617 492 234 32 12 "EL 17"
radiobutton 618 492 248 32 12 "EL 18"
endgroup
enddialog
;*** default window starts
disable DLGCTRL 0 12
disable DLGCTRL 0 188
disable DLGCTRL 0 200
disable DLGCTRL 0 202
disable DLGCTRL 0 208
disable DLGCTRL 0 219,220
dlgupdate 0 0,217
;***** janela swyching control - Hold until EXECUTE is pressed
while 1
dlgevent 0 Event
switch Event
case 0
yield
endcase
;** case 201 - CANCEL WINDOW
case 201
dlgdestroy 0 cancel
usermsg "Operação Cancelada"
call finalize
endcase
;** case 204 - OPEN UDS FILE
case 204
sfiletemp0 = sfileopen
if sdlgfopen "Selecione o ficheiro .uds " sfilespec2 SINGLE sfileopen
call openscript
endif
if nullstr sfileopen
sfileopen = sfiletemp0
elseif nullstr sfileopen
disable DLGCTRL 0 200
elseif ilpstrt > (ilpend - 100)
disable DLGCTRL 0 200
else
enable DLGCTRL 0 200
endif
dlgupdate 0 0,218
endcase
;** case 205 - SAVE .UDS FILE
case 205
call savescript
endcase
;** case 206 - CLEAR WINDOW FIELDS
case 206
call clearjanela
endcase
;** case 207 - select and show csvfile
case 207
if sdlgfopen "Selecione o ficheiro .csv " sfilespec1 SINGLE sfilecsv
call showcsvfile
enable DLGCTRL 0 208
dlgupdate 0 0,217
elseif nullstr sfilecsv
Smaxrow = "0",iheadrowsw = 0
Srowdata[0] = $nullstr
Slist0 = ",00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19"
disable DLGCTRL 0 208
dlgupdate 0 0,218
endif
endcase
;*** cse 208 Show csv file
case 208
call showcsvfile
endcase
;** case 209 Header Row yes or no
case 209
if iheadrowsw == 1
enable DLGCTRL 0 202
imaxrow = imaxrow > 0 ? imaxrow - 1 : 0
if icnvhrsw == 1
call csvnumtonam
endif
else
disable DLGCTRL 0 202
imaxrow = imaxrow > 0 ? imaxrow + 1 : 0
Slist0 = ",00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19"
endif
itoa imaxrow smaxrow
dlgupdate 0 0,218
endcase
;** case 211 options window
case 211
call opcoes
endcase
;** case 212 hide janela
case 212
dlgwin 0 WinID
winowner WinID OwnerID
winfocus OwnerID
winhide WinID
call hidewindow
winfocus WinID
winshow WinID
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 200
elseif nullstr sfileopen
disable DLGCTRL 0 200
else
enable DLGCTRL 0 200
endif
endcase
case 600
if ilpend-100 < ilpstrt
alarm 2
errormsg " End Loop Can't Be Smaller Than Start Loop "
disable DLGCTRL 0 200
elseif nullstr sfileopen
disable DLGCTRL 0 200
else
enable DLGCTRL 0 200
endif
if ilpend == 618
enable DLGCTRL 0 188
else
disable DLGCTRL 0 188
endif
endcase
;** case 200 all ready exit janela & execute UDS
case 200
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 OK
return
endproc ;**************************** end of janela **************************
proc whattosend ;*********************************************************************
;*** Define Variables
integer icntrow,icntrlow,icntrhigh
integer icntcol,icntclow,icntchigh
integer icnt0,itemp0,imincol,imaxcol
integer icntirow,icntirow1,icntilow,icntihigh
integer icntlp,icntllow,icntlhigh
integer irowtemp
;*** definitions
set txpace itxpacing
ilpstrt = ilpstrt - 500
ilpend = ilpend - 600
switch ilpforeversw
case 23 ; all forever
irowtemp = 0
endcase
case 22 ; loop forever
irowtemp = 1
endcase
default
irowtemp = imaxrow > 0 ? imaxrow : imaxcycl
if iheadrowsw == 1
icntrlow = 1
icntrhigh = irowtemp
else
icntrlow = 0
icntrhigh = irowtemp > 0 ? irowtemp - 1 : 0
endif
endcase
endswitch
;* extract col num from scol
;* find maxcol & mincol
itemp0=0,imaxcol=0,imincol=0
for icnt0 = 1 upto 18
atoi Scsvftx[icnt0] itemp0
imaxcol = itemp0 > imaxcol ? itemp0 : imaxcol
imincol = itemp0 < imincol ? itemp0 : imincol
endfor
;*
icntilow = 1
icntihigh = 18
icntclow = imincol
icntchigh = imaxcol
icntllow = ilpstrt
icntlhigh = ilpend
;***no loop send to com item line
for icntirow = icntilow upto icntihigh
;*** Loop Rows or Cycles
if (icntirow >= ilpstrt && icntirow <= ilpend) && irowtemp > 0
for icntrow = icntrlow upto icntrhigh
;*** Read colunm from row
for icntcol = icntclow upto icntchigh
strextract scoldata[icntcol] srowdata[icntrow] Ssepcart icntcol
endfor
;*** Loop (SL/EL)
for icntlp = icntllow upto icntlhigh
if icntlp == icntlhigh & icntrow < irowtemp
icntirow1 = icntllow
else
icntirow1 = icntlp + 1
endif
icntirow = icntlp
if itstmodsw == 1
call sendtotestwindow with icntirow,icntirow1
else
call sendtocom with icntirow,icntirow1
endif
;***loop forever switch
if ilpforeversw == 22 && icntlp == icntlhigh
icntlp = icntllow-1
loopfor
endif
endfor
icntirow = icntirow < icntihigh ? icntirow + 1 : icntihigh
endfor
endif
if icntirow < ilpstrt | icntirow > ilpend | irowtemp == 0
if icntirow > icntihigh
return
else
icntirow1 = icntirow + 1
endif
if itstmodsw == 1
call sendtotestwindow with icntirow,icntirow1
else
call sendtocom with icntirow,icntirow1
endif
;***all forever switch
if ilpforeversw == 23 && icntirow == icntihigh
icntirow = icntilow-1
loopfor
endif
endif
endfor
return
endproc ;*********************************************************************
proc sendtotestwindow ;*** send to message window for testing UDS script *******************
;*** variables definition
param integer icntirow,icntirow1
integer itemp0,itemp1
;*** waitfor swaituntil forever
if iwaitfsw == 1
if not nullstr swaitforever
usermsg "RX waitfor forever (30s)test => % s" swaitforever
waitfor swaitforever 30 ; forever
endif
endif
;*** pause (x)
if not nullstr sholdtim[icntirow]
atoi sholdtim[icntirow] itemp0
usermsg "PAUSE for => %d" itemp0
PAUSE 5
itemp0 = 0
endif
;*** transmit constant
if Iconstsw[icntirow] == 1
usermsg "TX TXT => % s" stext[icntirow]
endif
;*** transmit variable
if icsvcolsw[icntirow] == 1
atoi Scsvftx[icntirow] itemp0
usermsg "TX CSV FIELD => % s" scoldata[itemp0]
endif
;*** transmit one CR
if Ientersw[icntirow] == 1
usermsg "TX SEND CR"
endif
;*** waitfor & transmit CR until next waitfor ; time 1 atencao
if icntirow == 18 ; aqui tinha | icntlp == 18 ** ver ilpend != 18
return
endif
if Iuntilsw[icntirow] == 1
itemp0 = 0,itemp1 = 0
if not nullstr Scsvfrx[icntirow1]
atoi Scsvfrx[icntirow1] itemp1
usermsg "RX SEND CR UNTIL CSV => % s" scoldata[itemp1]
while not waitfor scoldata[itemp1] iwttmunt
itemp0 = itemp0 + 1
if itemp0 == imaxcr
exitwhile
endif
usermsg "TX SEND CR U"
endwhile
else
usermsg "RX SEND CR UNTIL => % s" swait[icntirow1]
while not waitfor swait[icntirow1] iwttmunt
itemp0 = itemp0 + 1
if itemp0 == imaxcr
exitwhile
endif
usermsg "TX SEND CR U"
endwhile
endif
elseif not nullstr swait[icntirow1]
usermsg "RX WAITFOR => % s" swait[icntirow1]
waitfor swait[icntirow1] iwttmwf
elseif not nullstr Scsvfrx[icntirow1]
itemp1 = 0
atoi Scsvfrx[icntirow1] itemp1
usermsg "RX WAITFOR CSV => % s" scoldata[itemp1]
waitfor scoldata[itemp1] iwttmunt
endif
return
endproc ;*********************************************************************