Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple scripts 3

Status
Not open for further replies.

johnpoole

Programmer
May 26, 2004
19,375
US
Most techs know that scripts is usually my first choice for a lot of things. if you haven't used them, your missing a very powerful tool.. here is one that i built, like most of my scripts, for a single project. Now i use it almost every week. anytime you have a list of tn's you need to print, if the switch will give you a list, this script will print it. when i prt an acd group, or ld 81, lst by feature etc.. i grab that list, usually open it in excel, delete the unused columns, save it as a tab delimited and paste that into the aspect editor...

Code:
Proc main

  
   
   
   string tn
  	
   
   integer count
   string szline
   fopen 0 "tnb.wud" read

   while not feof 0
   SZLINE = "1"
   fgets 0 szline

   strtok tn szline "t"  1  
  			  
   set txpace 50
   capture on
   transmit "prt^M"
   waitfor "TYPE: "
   transmit "tnb^M"
  pause 1
   transmit tn
   transmit "^M"
  waitfor "DATE "
   transmit "^M"
   waitfor "PAGE "
   transmit "^M"
  waitfor "DES "
   transmit "^M"
   waitfor "NACT " 
   transmit "^M"
   waitfor "REQ: "
 
   
   
  
    count += 1
    endwhile
    fclose 0
    fclose 1
    call main
   capture off
   endproc

needed this yesterday because of a pick up group that was broke due to 10 years of using the copy command.. it had about 110 members is 6 buildings.. so i needed to make a change on each of those sets.. analogs was just a simple change script, but for the digitals i ran this script, captured that then used pepedog's excel macro to put that in columns, that gave me set type and tn, that allowed me to make those changes via another simple script..

to get started if your new to aspect, record a simple change on a set, alt back bracket, make the change, alt backbracket and give it a name... the alt f3 to open the editor, highlight your file then click edit, double click don't work... just delete the line waitfor "TN " and the following line transmit "4 0 0 0^M" and after the nextline, add forever... that means that the script will waitfor that line until it sees it, no timeout and your not rushed...


give it a try, like i've said, it's a great tools for us non typing lazy people

john poole
bellsouth business
columbia,sc
 
Here's a couple more very, very simple scripts:

This one will print a TN:

Code:
proc main

string TN_Input


   sdlginput "TN" "What is the TN:" TN_Input
   strcat TN_Input "^M"
  

   transmit "******^M"
   transmit "ld 20^M"
   waitfor "REQ: "
   transmit "prt^M"
   waitfor "TYPE: "
   transmit "tn^M"
   waitfor "TN   "
   transmit TN_Input
   waitfor "DATE "
   transmit "^M"
   waitfor "PAGE "
   transmit "^M"
   waitfor "DES  "
   transmit "^M"
   
endproc

this one will print a DN

Code:
proc main

string DN_input

   sdlginput "Extension" "What is the Extension:" DN_Input

   strcat DN_input "^M"
   transmit "******^M"
   transmit "LD 20^M"
   waitfor "REQ:"
   transmit "prt^M"
   waitfor "TYPE: "
   transmit "DN^M"
   waitfor "CUST "
   transmit "0^M"
   waitfor "DN   "
   transmit DN_Input
   waitfor "DATE "
   transmit "^M"
   waitfor "PAGE "
   transmit "^M"
   waitfor "DES "
   transmit "^M"
   waitfor "NACT "
   transmit "^M"

endproc

I have others that do all kinds of things. Makes life much easier.

 
that's a decent script, i don't usually use the sdlginput because i am the only one that users my scripts, but they come in handy

john poole
bellsouth business
columbia,sc
 
It's only used by me and the other techs, but I like having the input box b/c I can backspace if I make a mistake. :)

I have another that will print the TN based on just the input of the DN (but it needs two scripts). If there's more than one TN, you'll get a dialog box asking for which one you want to print. I've got another one that will print out the TN then pop up a dialog box with the pertinent info of the phone (I'll put that in another post)


Code:
;*******************************************************************
;*** This script will ask the user for a DN to print.  If there  ***
;*** is only one TN, it will print right away.  If there are     ***
;*** multiple TN's, the user will be given a list of available   ***
;*** TN's to choose from. Selecting the desired TN will print it ***
;*******************************************************************



string DN_input
string fname		;file name for dn print output capture
string pname		;path name for dn pring output capture
string filename
integer linecount
string lineinfo
string TN
string multiple_TN[10]		;used if more than one TN to print
integer TN_count
integer num
string write_name = "C:\Program Files\Symantec\Procomm Plus\Capture\write_test.txt"   ;file for list box entries
string write_string



proc main
;*******************************************************************************************
;*** Start by setting the filename and path for the capture file, delete it if it exists ***
;*******************************************************************************************

fname = "capture_dn.txt"
pname = "C:\Program Files\Symantec\Procomm Plus\Capture\" 

if isfile "C:\Program Files\Symantec\Procomm Plus\Capture\capture_dn.txt"
   delfile "C:\Program Files\Symantec\Procomm Plus\Capture\capture_dn.txt"
endif

set capture file fname
set capture path pname
   	
;*******************************************************
;*** Dialog box to get input from user, and print DN ***
;******************************************************* 

   sdlginput "Extension" "What is the Extension:" DN_Input
   strcat DN_input "^M"
   clear
   transmit "******^M"
   transmit "LD 20^M"
   capture on
   waitfor "REQ:"
   transmit "prt^M"
   waitfor "TYPE: "
   transmit "DN^M"
   waitfor "CUST "
   transmit "0^M"
   waitfor "DN   "
   transmit DN_Input
   waitfor "DATE "
   transmit "^M"
   waitfor "PAGE "
   transmit "^M"
   waitfor "DES "
   transmit "^M"
   waitfor "NACT "
   transmit "^M"
   
   capture off
 
;****************************************************************************
;*** copy path and file name into new variable so can read from text file ***
;****************************************************************************

strcpy filename pname
strcat filename fname
   
;***********************************
;*** read DN info from text file ***
;***********************************

if fopen 0 filename READ TEXT     ; Open file for read only.
     while not feof 0            ; Loop while not end of file.
        linecount++
        fgets 0 LineInfo        ; Get line from file.
   
        if strsearch LineInfo "TN"
           TN_Count++
           if TN_Count >= 2                               ;determine if more than one TN
             multiple_TN[1] = TN                          ;first copy the first TN info first array
             substr multiple_TN[TN_Count] Lineinfo 5 12   ;and if so, put them into an array
                else
                   substr TN Lineinfo 5 12
            endif    
        endif


     endwhile
     fclose 0                    ; Close file opened for read.
  else
     errormsg "Couldn't open file `"%s`"." Filename
endif

;************************************************************
;*** Create and write to file of all entries in the array ***
;*** so they can be read into the list box later on       ***
;************************************************************
if fopen 0 write_name CREATE        
      for num = 1 upto TN_Count
         strcpy write_string multiple_TN[num]
         strcat write_string "`r`n"
         fputs 0 write_string
      endfor
endif
  
;***************************************************************
;*** Print the phone depending on the situation, if there's  ***
;*** only one TN, print right away, if there's more than one ***
;*** give user list box to pick TN they want to print        ***
;*************************************************************** 
  
if TN_Count < 2
   transmit "^M^M"
   waitfor "REQ: "
   transmit "prt^M"
   waitfor "TYPE: "
   transmit "tn^M"
   waitfor "TN   "
   transmit TN
   transmit "^M"
   waitfor "DATE "
   transmit "^M"
   waitfor "PAGE "
   transmit "^M"
   waitfor "DES  "
   transmit "^M"
   waitfor "NACT"
   transmit "^M"
      else
      
      ;************************************************
      ;***  The 'test-dialog' script must be placed ***
      ;***  in the aspect directory                 ***
      ;************************************************
      
       execute "test_dialog"
endif
   
endproc

This is the script that goes with that...

Code:
;Script to print TN from dialog box

proc main
   string ListItem              ; Item selected from list.
   integer Event                ; Dialog box event.
   string write_name = "C:\Program Files\Symantec\Procomm Plus\Capture\write_test.txt"
   string TN

   ; Display dialog box with list of items. You need
   ; a file called "items.lst" that contains items
   ; to choose from (one on a line).
   ;fileview write_name
   dialogbox 0 0 0 100 120 11 "TN List"
      text 1 5 5 90 12 "Select the TN you wish" CENTER
      text 2 5 15 90 12 "to print." CENTER
      flistbox 5 25 30 55 70 write_name SINGLE ListItem
   enddialog
   while 1
      dlgevent 0 Event          ; Get the dialog event.
      switch Event              ; Evaluate the event.

         case 0                 ; No event occurred.
         endcase
         case 5                 ; Something was chosen.
            TN = ListItem
            exitwhile
            
         endcase
         default                ; Exit case chosen.
            exitwhile           ; Exit the loop.
         endcase
      endswitch
   endwhile
   dlgdestroy 0 CANCEL          ; Destroy the dialog box.
   
   transmit "***"
   transmit "^M^M"
   waitfor "REQ: "
   transmit "prt^M"
   waitfor "TYPE: "
   transmit "tn^M"
   waitfor "TN   "
   transmit ListItem
   transmit "^M"
   waitfor "DATE "
   transmit "^M"
   waitfor "PAGE "
   transmit "^M"
   waitfor "DES  "
   transmit "^M"
   waitfor "NACT"
   transmit "^M"
   
endproc

 
This one pops up a box with the pertinent phone info after printing the TN. I created this b/c I got tired of scrolling back to get the NCOS. ;-)

Code:
;script that shows necessary details when TN is printed out         


string TN_Input
string TN_Info
string filename
string cappath
string lineinfo
string fname
string whattype
string Acquired
string Handsfree
string PHTYPE
string DESI
string NCOS
string QUEUE
string ACD
string EXT1
string EXT2
integer linecount

proc main
filename = "capture_tn.txt"
cappath = "C:\Program Files\Symantec\Procomm Plus\Capture\"
if isfile "C:\Program Files\Symantec\Procomm Plus\Capture\capture_tn.txt"
   delfile "C:\Program Files\Symantec\Procomm Plus\Capture\capture_tn.txt"
endif
set capture path cappath
set capture file filename


when target 0 "SCH0805" call no_prog

   sdlginput "TN" "What is the TN:" TN_Input
   TN_Info = TN_Input
   strcat TN_Input "^M"
   clear  
   capture on
   transmit "******^M"
   transmit "ld 20^M"
   waitfor "REQ: "
   transmit "prt^M"
   waitfor "TYPE: "
   transmit "tn^M"
   waitfor "TN   "
   transmit TN_Input
   waitfor "DATE "
   transmit "^M"
   waitfor "PAGE "
   transmit "^M"
   waitfor "DES  "
   transmit "^M"
   waitfor "NACT"
   transmit "^M"
     
capture off


strcpy fname cappath
strcat fname filename

  
if fopen 0 fname READ TEXT     ; Open file for read only.
     while not feof 0            ; Loop while not end of file.
        linecount++
        fgets 0 LineInfo        ; Get line from file.
        
        ;if nullstr LineInfo 
         ;  exitwhile
        ;endif
       
        if strsearch LineInfo "DES"
           substr DESI Lineinfo 5 6
        endif

        if strsearch LineInfo "TYPE"
           substr PHTYPE Lineinfo 5 5
        endif
        
        if strsearch LineInfo "NCOS"
           substr NCOS Lineinfo 5 1
        endif
        
        
        if strcmp Handsfree "Y"
           ;
              else
                 if strsearch Lineinfo "HFA"
                    Handsfree = "Y"
                       else
                          Handsfree = "N"
                 endif
        endif
               
        
        if strcmp Acquired "Y"
           ;
           else
              if strsearch LineInfo "SFRB"
                 Acquired = "Y"
                    else
                       Acquired = "N"
              endif        
        endif
         
        if strsearch LineInfo "KEY"
           substr whattype lineinfo 8 3
           if strcmp whattype "ACD"
              substr QUEUE Lineinfo 12 4
              substr ACD Lineinfo 20 4
              else
                 substr EXT1 Lineinfo 12 4
            endif
        endif
        
        if strsearch LineInfo "01"
           if strcmp whattype "ACD"
               substr EXT1 Lineinfo 12 4
               else
                  substr EXT2 Lineinfo 12 4
            endif
        endif
        
        
        if strsearch LineInfo "02"
           if strcmp whattype "ACD"
              substr EXT2 Lineinfo 12 4
           endif
        endif
        
     endwhile
     fclose 0                    ; Close file opened for read.
  else
     errormsg "Couldn't open file `"%s`"." Filename

endif

if strcmp whattype "ACD"
   usermsg "TYPE: %s `n`rTN: %s `n`rDESI: %s `n`rNCOS: %s `n`rQUEUE: %s `n`rACD: %s `n`rEXT1: %s `n`rEXT2: %s `n`rAcquired: %s `n`rHandsfree: %s" PHTYPE TN_Info DESI NCOS QUEUE ACD EXT1 EXT2 Acquired Handsfree
   else
       usermsg "TYPE: %s `n`rDESI: %s `n`rNCOS: %s `n`rEXT1: %s `n`rEXT2: %s `n`rHandsfree: %s" PHTYPE DESI NCOS EXT1 EXT2 Handsfree
endif


;usermsg "I've been through %d lines"  linecount

endproc


proc no_prog
usermsg "No TN programming exists"
capture off
if isfile "C:\Program Files\Symantec\Procomm Plus\Capture\capture_tn.txt"
   delfile "C:\Program Files\Symantec\Procomm Plus\Capture\capture_tn.txt"
endif
exit
endproc


Note: the user must have write rights to C:\Program Files\Symantec\Procomm Plus\Capture
 
Nice! I'll keep them in mind. ;-)

 
John, do you have a web site? Your scripts (and the ones you prompt as you post yours) are too valuable to be archived or overlooked.



~
TEKIMG19K.gif
 
Hi all
I tried to share this one but the link didn't work.

i'ts a bit large but ...

*************************************************
;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 - Compta Sul "

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 ;*********************************************************************

proc sendtocom ;********************* SEND TO COM ***********************************

;*** variables definition

param integer icntirow,icntirow1
integer itemp0,itemp1
set txpace itxpacing
;*** waitfor swaituntil forever
if iwaitfsw == 1
if not nullstr swaitforever
waitfor swaitforever forever
endif
endif



;*** pause (x)

if not nullstr sholdtim[icntirow]
atoi sholdtim[icntirow] itemp0
PAUSE itemp0
itemp0 = 0
endif

;*** transmit constant

if Iconstsw[icntirow] == 1
transmit stext[icntirow]
endif

;*** transmit variable

if icsvcolsw[icntirow] == 1
atoi Scsvftx[icntirow] itemp0
transmit scoldata[itemp0]
endif

;*** transmit one CR

if Ientersw[icntirow] == 1
transmit "^M"
endif

;*** transmit CR until next waitfor

if icntirow == 18
return
endif
if Iuntilsw[icntirow] == 1
itemp0 = 0,itemp1 = 0
if not nullstr Scsvfrx[icntirow1]
atoi Scsvfrx[icntirow1] itemp1
while not waitfor scoldata[itemp1] iwttmunt
itemp0 = itemp0 + 1
if itemp0 == imaxcr
exitwhile
endif
transmit "^M"
endwhile
else
while not waitfor swait[icntirow1] iwttmunt
itemp0 = itemp0 + 1
if itemp0 == imaxcr
exitwhile
endif
transmit "^M"
endwhile
endif
elseif not nullstr swait[icntirow1]
waitfor swait[icntirow1] iwttmwf

elseif not nullstr Scsvfrx[icntirow1]
itemp1 = 0
atoi Scsvfrx[icntirow1] itemp1
waitfor scoldata[itemp1] iwttmunt
endif
return

endproc ;*********************************************************************


proc csvnumtonam ;*********************** Hd Convertion to Display ********************

string Stemp0=""
integer icntcol,icntclow=0,icntchigh=icollimit,icntrow=0

for icntcol = icntclow upto icntchigh
strextract stemp1 slista "," icntcol + 1
strextract scoldata[icntcol] srowdata[icntrow] Ssepcart icntcol
if not nullstr scoldata[icntcol]
strcat stemp0 ","
strcat stemp0 stemp1
strcat stemp0 "-"
strcat stemp0 scoldata[icntcol]
endif
endfor
slist0 = stemp0
return

endproc ;*********************************************************************

proc hidewindow ;***** CASE 212 hide window routine***********************************

integer key

usermsg "Press Ctrl + H to Exit Terminal Mode"
set aspect keys ON
while 1
if $KEYHIT
keyget Key
if Key == 0x248
exitwhile
else
termvkey Key
endif
endif
endwhile
set aspect keys OFF
usermsg "Ctrl + H Pressed, Exiting Terminal Mode"
return

endproc ;*********************************************************************

proc opcoes ;************ Case 201 - options *************************************

integer Event;,icsvfilesw,iudsfilesw


dialogbox 2 4 170 522 90 131 "Options"
checkbox 1 10 2 128 11 "Activate Waitfor Forever Input Cell" Iwaitfsw
editbox 2 10 15 17 11 Swttmwf
text 3 29 16 62 11 "Timer For Waitfor" left
editbox 4 10 30 17 11 Swttmunt
text 5 29 31 98 11 "Timer For CR Until Waitfor" left
editbox 6 10 45 17 11 smaxcr
text 7 29 46 98 11 "Max. CR For Until Waitfor" left
checkbox 8 140 2 128 11 "Activate Loops Without CSV Rows" ilpwrsw
radiogroup 9 ilpforeversw
radiobutton 21 140 27 80 11 " (X) Loops SL<>EL"
radiobutton 22 140 37 85 11 " Loop SL<>EL Forever "
radiobutton 23 140 47 80 11 " Loop All Forever "
endgroup
editbox 10 140 15 17 11 smaxcycl
text 11 158 16 110 11 "(X) Number of Loops To Execute" left
checkbox 12 270 2 130 11 "Convert H.Row to Column Name" icnvhrsw
checkbox 13 270 15 130 11 "Save Changed CSV File" isavecsvsw
editbox 14 270 30 17 11 ssepcart
text 31 290 31 114 11 "Separator Character For CSV File" left
editbox 15 270 45 17 11 scollimit
text 16 290 46 130 11 "N. Max de Column in CSV" left
checkbox 17 406 15 130 11 "Save/Open Options to UDS File" iopttoudssw
checkbox 18 406 30 128 11 "Extra more 18 Cmdlines(19-36)" imoreitemsw
checkbox 19 406 2 128 11 "Test Mode - Send to Text Box" itstmodsw
editbox 20 406 45 17 11 stxpacing
text 32 426 46 116 11 "ms Transmit Pacing" left
text 25 187 62 75 11 "CSV Files" left
editbox 26 10 60 170 11 sfilespec1
text 27 298 62 75 11 "UDS Files" left
editbox 28 346 60 170 11 sfilespec2
pushbutton 29 240 61 42 10 "<- Change ->"
groupbox 34 8 54 510 20 ""
text 40 10 77 170 11 "*** Use same directory for UDS and CSV Files" left
pushbutton 30 240 77 42 10 "Close" ok
enddialog

;*** default window starts

itoa iwttmunt swttmunt
itoa iwttmwf swttmwf
itoa imaxcycl smaxcycl
itoa imaxcr smaxcr
itoa itxpacing stxpacing

if ilpwrsw == 1
enable DLGCTRL 2 9,11
else
disable DLGCTRL 2 9,11
endif
disable DLGCTRL 2 13
disable DLGCTRL 2 15
disable DLGCTRL 2 18
dlgupdate 2 0,30

;***** options swtching control

while 1
dlgevent 2 Event
switch Event
case 0
yield
endcase

;** case 1 Activate Waitfor Forever Input Cell

case 1
if Iwaitfsw == 1
enable DLGCTRL 0 12
else
disable DLGCTRL 0 12
endif
dlgupdate 0 12
endcase

;** case 8 Activate Loops Without CSV Rows

case 8
if ilpwrsw == 1
enable DLGCTRL 2 9,11
else
disable DLGCTRL 2 9,11
endif
dlgupdate 2 9,20
endcase
;** case 9 loop forever
case 9
if ilpforeversw == 20
disable DLGCTRL 2 10,11
else
enable DLGCTRL 2 10,11
endif
dlgupdate 2 10,11
endcase
;** case 13 test mode
case 13
if isavecsvsw == 1
ssavecsvsw = "OK"
else
ssavecsvsw = "CANCEL"
endif
endcase
;** case 17 save options uds
case 17
if iopttoudssw == 1
iopttoudssw == 0
else
iopttoudssw == 1
endif

endcase
;** case 19 test mode
case 19
itstmodsw = 1
endcase
;** case 20 pace time
case 20
atoi stxpacing itxpacing
dlgsave 0 20
endcase
;** case 26 spec1 file
case 26
endcase
;** case 28 spec2 file
case 28
endcase
;** case 29 save path
case 29
if fopen 2 SFilesav write text
fputs 2 sfilespec1
fputs 2 sfilespec2
endif
fclose 2

endcase

;** case 30 return to janela
case 30
exitwhile
endcase
endswitch
endwhile

atoi swttmunt iwttmunt
atoi swttmwf iwttmwf
atoi smaxcycl imaxcycl
atoi smaxcr imaxcr
atoi stxpacing itxpacing
dlgdestroy 2 OK
return

endproc ;*********************************************************************

proc openscript ;*** janela CASE 204 - OPEN UDS FILE *********************************

integer icnt0

if fopen 1 SFileopen read text ; Open file for read.

fgets 1 stemp1 ;Sfilespec1 ;fputs 2 "Blank line1"
fgets 1 stemp1 ;Sfilespec2 ;fputs 2 "Blank line2"

;** uds
if iudssavsw == 1
fgets 1 Swindes1
for icnt0 = 1 upto 18
fgets 1 Scsvfrx[icnt0]
fgets 1 Swait[icnt0]
fgets 1 Sholdtim[icnt0]
fgets 1 Stext[icnt0]
fgets 1 Scsvftx[icnt0]
fgets 1 Stemp1
atoi Stemp1 Iconstsw[icnt0]
fgets 1 Stemp1
atoi Stemp1 icsvcolsw[icnt0]
fgets 1 Stemp1
atoi Stemp1 Ientersw[icnt0]
fgets 1 Stemp1
atoi Stemp1 Iuntilsw[icnt0]
endfor
fgets 1 Stemp1
atoi Stemp1 Ilpstrt
fgets 1 Stemp1
atoi Stemp1 Ilpend
fgets 1 Stemp1
atoi Stemp1 iopttoudssw
endif
; options
if iopttoudssw == 1
fgets 1 ssepcart
fgets 1 Stemp1
atoi Stemp1 iwttmunt
fgets 1 Stemp1
atoi Stemp1 iwttmwf
fgets 1 Stemp1
atoi Stemp1 imaxcycl
fgets 1 Stemp1
atoi Stemp1 imaxcr
fgets 1 Stemp1
atoi Stemp1 itxpacing
fgets 1 Stemp1
atoi Stemp1 Iwaitfsw
fgets 1 Stemp1
atoi Stemp1 ilpwrsw
fgets 1 Stemp1
atoi Stemp1 Ilpforeversw
fgets 1 Stemp1
atoi Stemp1 Imoreitemsw
fgets 1 Sfilespec1
fgets 1 Sfilespec2
endif
endif

fclose 1
enable DLGCTRL 0 217
dlgupdate 0 0,218
dlgupdate 0 500,600
return

endproc ;*********************************************************************

proc savescript ;*** janela CASE 205 - SAVE WINDOW SCRIPT FILE (.uds)*****************

integer icnt0

if sdlgsaveas "Select de .UDS file name to save " SFileSpec2 SFilesav
if fopen 2 SFilesav write text ; Open file for read.

fputs 2 stemp1
fputs 2 stemp1


;** Uds
if iudssavsw == 1
fputs 2 Swindes1
for icnt0 = 1 upto 18
fputs 2 Scsvfrx[icnt0]
fputs 2 Swait[icnt0]
fputs 2 Sholdtim[icnt0]
fputs 2 Stext[icnt0]
fputs 2 Scsvftx[icnt0]
itoa Iconstsw[icnt0] Stemp1
fputs 2 Stemp1
itoa icsvcolsw[icnt0] Stemp1
fputs 2 Stemp1
itoa Ientersw[icnt0] Stemp1
fputs 2 Stemp1
itoa Iuntilsw[icnt0] Stemp1
fputs 2 Stemp1
endfor
itoa Ilpstrt Stemp1
fputs 2 Stemp1
itoa Ilpend Stemp1
fputs 2 Stemp1
itoa iopttoudssw Stemp1
fputs 2 Stemp1
endif
; options
if iopttoudssw == 1
fputs 2 ssepcart
itoa iwttmunt Stemp1
fputs 2 Stemp1
itoa iwttmwf Stemp1
fputs 2 Stemp1
itoa imaxcycl Stemp1
fputs 2 Stemp1
itoa imaxcr Stemp1
fputs 2 Stemp1
itoa itxpacing Stemp1
fputs 2 Stemp1
itoa Iwaitfsw Stemp1
fputs 2 Stemp1
itoa ilpwrsw Stemp1
fputs 2 Stemp1
itoa Ilpforeversw Stemp1
fputs 2 Stemp1
itoa Imoreitemsw Stemp1
fputs 2 Stemp1
endif
endif
fclose 2
endif
enable DLGCTRL 0 217
dlgupdate 0 1,218
return

endproc ;*********************************************************************


proc showcsvfile ; ****** Case 207 Read csvfile and show header and 1'row *************

integer event

dialogbox 400 4 180 522 74 131 "Excel File Saved As *.csv (MSDOS)"
feditbox 1 5 0 512 62 sfilecsv HSCROLL
pushbutton 6 240 64 42 10 "Close" default
enddialog

while 1
dlgevent 400 Event
switch Event
case 0
yield
endcase
case 6
exitwhile
endcase
endswitch
dlgupdate 0 202,217
dlgupdate 4 1 5
endwhile
dlgdestroy 400 ok

;* Read csv file line's and find imaxrow

imaxrow = 0
if fopen 0 sfilecsv READ TEXT
while not feof 0
while 1
fgets 0 srowdata[imaxrow]
;* Stop reading file
if nullstr srowdata[imaxrow]
exitwhile
else
imaxrow = imaxrow + 1
endif
endwhile
endwhile
fclose 0
endif
if iheadrowsw == 1
imaxrow = imaxrow > 0 ? imaxrow - 1 : 0
if icnvhrsw == 1
call csvnumtonam
endif
else
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
dlgupdate 4 1 5
return

endproc ;*********************************************************************


proc settimedate ;********************* Future use sub-scripts ************************************************


string szTime, szDate ; Time and date strings.
string sl1_dia, sl1_mes, sl1_ano, sl1_h, sl1_m, sl1_s
string Sdate,Stime,Sdatetime

ltimestrs $LTIME szDate szTime ;szDate format (dd-mm-yy)
statmsg "%s %s" szDate szTime ;szTime format (hh:mm:ss)

substr sl1_dia szDate 0 2 ;Convert to SL1 format
substr sl1_mes szDate 3 2 ;without "-" and ":"
substr sl1_ano szDate 6 4
substr sl1_h szTime 0 2
substr sl1_m szTime 3 2
substr sl1_s szTime 6 2

; switch selection - format type date & time - furute use - for now default Nortel Format (W/ Space)

strcat Stime sl1_h
strcat Stime " "
strcat Stime sl1_m
strcat Stime " "
strcat Stime sl1_s


strcat Sdate sl1_dia
strcat Sdate " "
strcat Sdate sl1_mes
strcat Sdate " "
strcat Sdate sl1_ano

strcat sdatetime Sdate
strcat sdatetime Stime


endproc ;*********************************************************************


proc finalize ;*********************************************************************

usermsg "Script Stopped"

halt

endproc ;*****************************************************************************



try this ...
 
thanks GH, no i no longer maintain a website.. when i was a consultant i did and it got way to time consuming.. but any script i post is now part of the public domain and you are welcome to include them on your site...

john poole
bellsouth business
columbia,sc
 
Sorry
I couldn't put it all, I'll try later to post in two parts.
sorry again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top