×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Any improvement in this code

Any improvement in this code

Any improvement in this code

(OP)

  Const Dest$= "T"
  Const Lstr$ = "L"
 

  Dim i As Integer

  i = 1
  
  J11flr$ ="4N11,4E11,"
  
  J10flr$ ="4N10,4S10,4E10,"
  
  J09flr$ ="4N09,4S09,4E09,"
  
  J8Yflr$ ="4N07,4E08U,4E08LB,4E08LC,4S08U,4S07LD," '7NORTH & 7S (Y floor)
  
  J08flr$ ="4E08LA,4S07," 'Medical 8th floor
  
  J7Wflr$ ="4E07" '"4W07,"
  
  J04flr$ ="5N04,5W04,"
  
  J03flr$ ="5W03,"
  
 
  J02flr$ ="5W02,"
               
  LocStr$=J11flr$ + J10flr$ + J09flr$ + J8Yflr$ + J08flr$ + J7Wflr$ + J04flr$ + J03flr$ + J02flr$

 
 ' Start JKJZ  
  MyScn.Sendkeys("<Reset><Clear>")    
  MyScn.WaitHostQuiet(g_HostSettleTime)

  MyScn.Sendkeys("JKJZ<Enter>")    
  MyScn.WaitHostQuiet(g_HostSettleTime)
    

  GetL$ = UCase(MyScn.GetString(3, 64, 1)) 'Get L

  RetStr$ =GetField(LocStr$,i,",")
  If GetL$ = "L" then
       Do While RetStr$ <> ""
        
        
        MyScn.PutString RetStr$, 7,64 "Out floor location
        MyScn.PutString Dest$, 10, 64 'Print output
        
        MyScn.Sendkeys("<Enter>")    
    MyScn.WaitHostQuiet(g_HostSettleTime)
        
        MyScn.Sendkeys("<Reset><Clear>")
        MyScn.WaitHostQuiet(g_HostSettleTime)
    
        MyScn.Sendkeys("JKJZ<Enter>")    
    MyScn.WaitHostQuiet(g_HostSettleTime)
 
        i = i + 1
        RetStr$ =GetField(LocStr$,i,",")
        Loop
        
       GoTo AllDone:

 
   End If
       
'-----------------------------------L Needed-
       Do While RetStr$ <> ""
       
        MyScn.PutString Lstr$, 3,64
        MyScn.PutString RetStr$, 7,64
        MyScn.PutString Dest$, 10, 64
        
        MyScn.Sendkeys("<Enter>")    
    MyScn.WaitHostQuiet(g_HostSettleTime)
        
        MyScn.Sendkeys("<Reset><Clear>")
        MyScn.WaitHostQuiet(g_HostSettleTime)
    
        MyScn.Sendkeys("JKJZ<Enter>")    
    MyScn.WaitHostQuiet(g_HostSettleTime)
        i = i + 1
        RetStr$ =GetField(LocStr$,i,",")
     
       Loop
        
        
'GOTO Back to startpage   
AllDone:  

   
        MyScn.Sendkeys("<Reset><Clear>")    
    MyScn.Sendkeys("XKMS<Enter>")    
    MyScn.WaitHostQuiet(g_HostSettleTime)

  
    System.TimeoutValue = OldSystemTimeout
End Sub

RE: Any improvement in this code

Mostly just coding preferences, but I'd make "<Reset><Clear>" and "<Enter>" constants.  This makes it easy to change these later if you ever need to.

Also, I'd get rid of GoTos.  It's easier to read if you you if then else (which it looks like what you were wanting to do) or subroutines/functions instead of gotos.

CODE

Const Dest$= "T"
Const Lstr$ = "L"
Const RnC$ = "<Reset><Clear>"
Const Ent$ = "<Enter>"
Dim i As Integer

i = 1
J11flr$ ="4N11,4E11,"
J10flr$ ="4N10,4S10,4E10,"
J09flr$ ="4N09,4S09,4E09,"
J8Yflr$ ="4N07,4E08U,4E08LB,4E08LC,4S08U,4S07LD," '7NORTH & 7S (Y floor)
J08flr$ ="4E08LA,4S07," 'Medical 8th floor
J7Wflr$ ="4E07" '"4W07,"
J04flr$ ="5N04,5W04,"
J03flr$ ="5W03,"
J02flr$ ="5W02,"
LocStr$=J11flr$ + J10flr$ + J09flr$ + J8Yflr$ + J08flr$ + J7Wflr$ + J04flr$ + J03flr$ + J02flr$

Start JKJZ
MyScn.Sendkeys(RnC$)
MyScn.WaitHostQuiet(g_HostSettleTime)
MyScn.Sendkeys("JKJZ" & Ent$)    
MyScn.WaitHostQuiet(g_HostSettleTime)
    
GetL$ = UCase(MyScn.GetString(3, 64, 1)) 'Get L

RetStr$ =GetField(LocStr$,i,",")
If GetL$ = "L" then
    Do While RetStr$ <> ""
        MyScn.PutString RetStr$, 7,64 "Out floor location
        MyScn.PutString Dest$, 10, 64 'Print output
        MyScn.Sendkeys(Ent$)    
        MyScn.WaitHostQuiet(g_HostSettleTime)
        MyScn.Sendkeys(RnC$)
        MyScn.WaitHostQuiet(g_HostSettleTime)
        MyScn.Sendkeys("JKJZ" & Ent$)    
        MyScn.WaitHostQuiet(g_HostSettleTime)
 
        i = i + 1
        RetStr$ = GetField(LocStr$,i,",")
    Loop
Else
'-----------------------------------L Needed-
    Do While RetStr$ <> ""
        MyScn.PutString Lstr$, 3,64
        MyScn.PutString RetStr$, 7,64
        MyScn.PutString Dest$, 10, 64
        MyScn.Sendkeys(Ent$)    
        MyScn.WaitHostQuiet(g_HostSettleTime)
        MyScn.Sendkeys(RnC$)
        MyScn.WaitHostQuiet(g_HostSettleTime)
        MyScn.Sendkeys("JKJZ" & Ent$)    
        MyScn.WaitHostQuiet(g_HostSettleTime)

        i = i + 1
        RetStr$ = GetField(LocStr$,i,",")
    Loop
End If        
        
MyScn.Sendkeys(RnC$)
MyScn.Sendkeys("XKMS" & Ent$)    
MyScn.WaitHostQuiet(g_HostSettleTime)
System.TimeoutValue = OldSystemTimeout

Looking at the code and how often you sendkeys then waithostquiet, I'd probably write a Sub for it.

CODE

Sub SendNWait(sSendKeys$)
    myScn.SendKeys(sSendKeys$)
    myScn.WaitHostQuiet(g_HostSettleTime)
End Sub

Then all you have to do is:
SendNWait Ent$
SendNWait RnC$
SendNWait "JKJZ" & Ent$

Another thing, mostly just to make coding faster, is I like to write a simple sub for object.putstring to shorten it just to PutStr.  It doesn't add anything other than to make it a lot shorter for you to type.

CODE

Sub PutStr(sString$, row%, col%)
    myScr.PutString sString$, row%, col%
End Sub

Then all you have to do is:
PutStr Lstr$,3,64
PutStr RetStr$,7,64
PutStr Dest$,10,64


One last thing, unless you use these variables seperately I'd do this:

CODE

LocStr = "4N11,4E11," & _ 'J11 Floor
    "4N10,4S10,4E10," & _ 'J10 Floor
    "4N09,4S09,4E09," & _ 'J09 Floor
    "4N07,4E08U,4E08LB,4E08LC,4S08U,4S07LD," & _ '7NORTH & 7S (Y floor)
    "4E08LA,4S07," & _ 'Medical 8th Floor
    "4E07" '"4W07," & _ 'J7W Floor
    "5N04,5W04," & _ 'J04 Floor
    "5W03," & _ 'J03 Floor
    "5W02," & _ 'J02 Floor

RE: Any improvement in this code

(OP)
Thanks Skie!!! this ia valuable info for me.

Jackeroo75

RE: Any improvement in this code

(OP)
Sub PutStr(sString$, row%, col%)
    myScn.PutString sString$, row%, col%
End Sub

I added this sub after my main sub and it giving me a "Call Syntax Error"..why???  

RE: Any improvement in this code

Where is your variable myScn declared?  You would need to Dim it outside of a sub or function and before the Sub PutStr.  Let me know if that fixes it.

RE: Any improvement in this code

(OP)
The sub PutStr works, but it takes about 4 sec to complete the task whereas the latter takes only 2 seconds.

I had to put this identical code into my sub putstr...this code is also in my main sub


Get the main system object
    Dim Sessions As Object
    Dim System As Object
    Set System = CreateObject("EXTRA.System")    ' Gets the system object
    If (System is Nothing) Then
        Msgbox "Could not create the EXTRA System object.  Stopping macro playback."
        STOP
    End If
    Set Sessions = System.Sessions

    If (Sessions is Nothing) Then
        Msgbox "Could not create the Sessions collection object.  Stopping macro playback."
        STOP
    End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
    g_HostSettleTime = 1000        ' milliseconds

    OldSystemTimeout& = System.TimeoutValue
    If (g_HostSettleTime > OldSystemTimeout) Then
        System.TimeoutValue = g_HostSettleTime
    End If

' Get the necessary Session Object
    Dim Sess0 As Object, MyScn As Object
 
    Set Sess0 = System.ActiveSession
        Set MyScn = Sess0.Screen
        
    If (Sess0 is Nothing) Then
        Msgbox "Could not create the Session object.  Stopping macro playback."
        STOP
    End If
    If Not Sess0.Visible Then Sess0.Visible = TRUE
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

RE: Any improvement in this code

(OP)
Here is my complete code..I can't seem to change the dialog dimension...it just gives me an error...Not sure how to fix this.



Function dlgMyFunc(identifier$, action, suppvalue)

  dlgMyFunc = True
   
  Select Case action
  Case 1 'Dialogbox loaded
   setflag =1
   dlgValue "CkFloor11", setflag
   dlgValue "CkFloor10", setflag
   dlgValue "CkFloor09", setflag
   dlgValue "CkFloor8Y", setflag
   dlgValue "CkFloor8M", setflag
   dlgValue "CkFloorInf", setflag
   dlgValue "CkFloor04", setflag
   dlgValue "CkFloor03", setflag
   dlgValue "CkFloor02", setflag
     
 
  Case 2 'Button clicked or value changed
    Select Case identifier$
    Case "btnUnSel","btnSelAll"
        If identifier$ = "btnUnSel" Then
           setflag = 0
        Else
           setflag = 1
        End If
        dlgValue "CkFloor11", setflag
        dlgValue "CkFloor10", setflag
        dlgValue "CkFloor09", setflag
        dlgValue "CkFloor8Y", setflag
        dlgValue "CkFloor8M", setflag
        dlgValue "CkFloorInf", setflag
        dlgValue "CkFloor04", setflag
        dlgValue "CkFloor03", setflag
        dlgValue "CkFloor02", setflag

    Case "btnOK"  , "ButCancel"
   dlgMyFunc = FALSE
   
   End Select
 End Select
 
End Function

  
 

  
 
Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
    Dim Sessions As Object
    Dim System As Object
    Set System = CreateObject("EXTRA.System")    ' Gets the system object
    If (System is Nothing) Then
        Msgbox "Could not create the EXTRA System object.  Stopping macro playback."
        STOP
    End If
    Set Sessions = System.Sessions

    If (Sessions is Nothing) Then
        Msgbox "Could not create the Sessions collection object.  Stopping macro playback."
        STOP
    End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
    g_HostSettleTime = 1000        ' milliseconds

    OldSystemTimeout& = System.TimeoutValue
    If (g_HostSettleTime > OldSystemTimeout) Then
        System.TimeoutValue = g_HostSettleTime
    End If

' Get the necessary Session Object
    Dim Sess0 As Object, MyScn As Object
 
    Set Sess0 = System.ActiveSession
        Set MyScn = Sess0.Screen
        
    If (Sess0 is Nothing) Then
        Msgbox "Could not create the Session object.  Stopping macro playback."
        STOP
    End If
    If Not Sess0.Visible Then Sess0.Visible = TRUE
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

'----------------------------------------------------------------------------------------------------------------------               
'1.  11TH FLR                     4N11, 4E11    
'2.  10TH FLR                         4N10, 4S10, 4E10
'3.   9TH FLR                    4N09, 4S09, 4E09
'4.   7 & 8TH FLR (PSYCH)             4N07, 4E08EU, 4E08ELB, 4E08ELC, 4S07U,  4S07LD
'5.   7 & 8TH FLR (Medical)              4E08LA, 4S07L Note: 4S07L is printed to capture it all in one page
'6.   Infirmary                                 4E07," 'Infirmary has moved to 7 East
'7.   4TH FLR                     5N04, 5W04
'8.   3RD FLR                    5W03
'9.   2ND FLR                    5W02    
'-----------------------------------------------------------------------------------------------------------------------     
    
' This section of code contains the recorded events

  Const Dest$= "T"
  Const Lstr$ = "L"
 

  Dim i As Integer

  i = 1
  
  J11flr$ ="4N11,4E11,"
  
  J10flr$ ="4N10,4S10,4E10,"
  
  J09flr$ ="4N09,4S09,4E09,"
  
  J8Yflr$ ="4N07,4E08U,4E08LB,4E08LC,4S07U,4S07LD," '7NORTH & 7S (Y floor)
  
  J08flr$ ="4E08LA,4S07L," 'Medical 7 & 8th floor
  
  J7Wflr$ ="4E07," 'Infirmary has moved to 7 East
  
  J04flr$ ="5N04,5W04,"
  
  J03flr$ ="5W03,"
  
 
  J02flr$ ="5W02,"
  
               
   
Begin Dialog TankDialog 274, 171, "Tank List", .dlgMyFunc
 
   PushButton    100, 70 , 50, 14, "Print", .btnOK
   PushButton    100, 30, 50, 14, "Select All",   .btnSelAll
   PushButton    100, 50, 50, 14, "UnSelect All", .btnUnSel
   CheckBox  10,  0, 44, 8, "11th Floor",         .CkFloor11
   CheckBox  10, 12, 44, 8, "10th Floor",         .CkFloor10
   CheckBox  10, 24, 44, 8, "9th Floor",          .CkFloor09
   CheckBox  10, 36, 59, 9, "7th/8th-Y",          .CkFloor8Y
   CheckBox  10, 48, 66, 9, "7th/8th-Med",        .CkFloor8M
   CheckBox  10, 60, 44, 8, "Infirmary",          .CkFloorInf
   CheckBox  10, 72, 44, 8, "4th Floor",          .CkFloor04
   CheckBox  10, 84, 44, 8, "3rd Floor",          .CkFloor03
   CheckBox  10, 93, 44, 8, "2nd Floor",          .CkFloor02

    
  
   CancelButton  100, 90, 40, 15, .ButCancel

End Dialog
 
   Dim mydialog as TankDialog
   On Error Resume Next
   Dialog mydialog
   
   If Err = 102 Then
      MsgBox "Tank List canceled."
      Exit Sub
   End If
   
   If mydialog.CkFloor11 = 0 then
   J11flr$=""
   End If
   If mydialog.CkFloor10 =0 then
   J10flr$=""
   End If
   If mydialog.CkFloor09 =0 then
   J09flr$=""
   End If
   If mydialog.CkFloor8M =0 then
   J08flr$=""
   End If
   If mydialog.CkFloor8Y =0 then
   J8Yflr$=""
   End If
   If mydialog.CkFloorInf=0 then
   J7Wflr$=""
   End If
   
   If mydialog.CkFloor04 =0 then
   J04flr$=""
   End If
   If mydialog.CkFloor03 =0 then
   J03flr$=""
   End If
   If mydialog.CkFloor02 =0 then
   J02flr$=""
   End If
   
   
  LocStr$=J11flr$ + J10flr$ + J09flr$ + J8Yflr$ + J08flr$ + J7Wflr$ + J04flr$ + J03flr$ + J02flr$
 
 ' Start JKJZ  
  MyScn.Sendkeys("<Reset><Clear>")    
  MyScn.WaitHostQuiet(g_HostSettleTime)

  MyScn.Sendkeys("JKJZ<Enter>")    
  MyScn.WaitHostQuiet(g_HostSettleTime)
    

  GetL$ = UCase(MyScn.GetString(3, 64, 1)) 'Get L

  RetStr$ =GetField(LocStr$,i,",")
  
'-------------------------------------------------------No L Needed----------------------------------------------------
  If GetL$ = "L" then
       Do While RetStr$ <> ""
       
        
        MyScn.PutString RetStr$, 7, 64
        MyScn.PutString Dest$, 10, 64 'Print destination
        
    
        MyScn.Sendkeys("<Enter>")    
    MyScn.WaitHostQuiet(g_HostSettleTime)
        
        MyScn.Sendkeys("<Reset><Clear>")
        MyScn.WaitHostQuiet(g_HostSettleTime)
    
        MyScn.Sendkeys("JKJZ<Enter>")    
    MyScn.WaitHostQuiet(g_HostSettleTime)
 
        i = i + 1
        RetStr$ =GetField(LocStr$,i,",")
        Loop
        
       GoTo AllDone:

 
   End If
       
'-------------------------------------------------L Needed-------------------------------------------------------------
       Do While RetStr$ <> ""
       
        MyScn.PutString  Lstr$, 3,64
        
        MyScn.PutString  RetStr$, 7,64
        MyScn.PutString  Dest$, 10, 64
        
        MyScn.Sendkeys("<Enter>")    
    MyScn.WaitHostQuiet(g_HostSettleTime)
        
        MyScn.Sendkeys("<Reset><Clear>")
        MyScn.WaitHostQuiet(g_HostSettleTime)
    
        MyScn.Sendkeys("JKJZ<Enter>")    
    MyScn.WaitHostQuiet(g_HostSettleTime)
        i = i + 1
        RetStr$ =GetField(LocStr$,i,",")
     
       Loop
'-----------------------------------------------------------------------------------------------------------------------           
        
'GOTO Back to XKMS   
AllDone:  

   
        MyScn.Sendkeys("<Reset><Clear>")    
    MyScn.Sendkeys("XKMS<Enter>")    
    MyScn.WaitHostQuiet(g_HostSettleTime)

  
    System.TimeoutValue = OldSystemTimeout
 
End Sub

RE: Any improvement in this code

How about this?

CODE

Const SETTLE_TIME = 1000
Const R_C = "<Reset><Clear>"
Const E_ = "<Enter>"
Dim MyScn As Object

Sub SendNWait(sSendKeys$)
  myScn.SendKeys(sSendKeys$)
  myScn.WaitHostQuiet(SETTLE_TIME)
End Sub

Sub PutStr(sString$, row%, col%)
  myScn.PutString sString$, row%, col%
End Sub

Function dlgMyFunc(identifier$, action, suppvalue)
  dlgMyFunc = True
   
  Select Case action
  Case 1 'Dialogbox loaded
    setflag =1
    dlgValue "CkFloor11", setflag
    dlgValue "CkFloor10", setflag
    dlgValue "CkFloor09", setflag
    dlgValue "CkFloor8Y", setflag
    dlgValue "CkFloor8M", setflag
    dlgValue "CkFloorInf", setflag
    dlgValue "CkFloor04", setflag
    dlgValue "CkFloor03", setflag
    dlgValue "CkFloor02", setflag
     
  Case 2 'Button clicked or value changed
    Select Case identifier$
    Case "btnUnSel", "btnSelAll"
        If identifier$ = "btnUnSel" Then
           setflag = 0
        Else
           setflag = 1
        End If
        dlgValue "CkFloor11", setflag
        dlgValue "CkFloor10", setflag
        dlgValue "CkFloor09", setflag
        dlgValue "CkFloor8Y", setflag
        dlgValue "CkFloor8M", setflag
        dlgValue "CkFloorInf", setflag
        dlgValue "CkFloor04", setflag
        dlgValue "CkFloor03", setflag
        dlgValue "CkFloor02", setflag

    Case "btnOK", "ButCancel"
      dlgMyFunc = FALSE
   
   End Select
 End Select
End Function

Sub Main()
  Dim Sessions As Object
  Dim System As Object
  Set System = CreateObject("EXTRA.System")    ' Gets the system object
  If (System is Nothing) Then
    Msgbox "Could not create the EXTRA System object.  Stopping macro playback."
    STOP
  End If
  Set Sessions = System.Sessions

  If (Sessions is Nothing) Then
    Msgbox "Could not create the Sessions collection object.  Stopping macro playback."
    STOP
  End If

  OldSystemTimeout& = System.TimeoutValue
  If (SETTLE_TIME > OldSystemTimeout) Then
    System.TimeoutValue = SETTLE_TIME
  End If

  Dim Sess0 As Object
  Set Sess0 = System.ActiveSession
        
  If (Sess0 is Nothing) Then
    Msgbox "Could not create the Session object.  Stopping macro playback."
    STOP
  End If

  Set MyScn = Sess0.Screen  
  If Not Sess0.Visible Then Sess0.Visible = TRUE
  Sess0.Screen.WaitHostQuiet(SETTLE_TIME)

'----------------------------------------------------------------------------------------------------------------------               
'1.  11TH FLR                    4N11, 4E11    
'2.  10TH FLR                    4N10, 4S10, 4E10
'3.   9TH FLR                    4N09, 4S09, 4E09
'4.   7 & 8TH FLR (PSYCH)        4N07, 4E08EU, 4E08ELB, 4E08ELC, 4S07U,  4S07LD
'5.   7 & 8TH FLR (Medical)      4E08LA, 4S07L Note: 4S07L is printed to capture it all in one page
'6.   Infirmary                  4E07," 'Infirmary has moved to 7 East
'7.   4TH FLR                    5N04, 5W04
'8.   3RD FLR                    5W03
'9.   2ND FLR                    5W02    
'-----------------------------------------------------------------------------------------------------------------------     
    
' This section of code contains the recorded events

  Const Dest$= "T"
  Const Lstr$ = "L"
 
  Dim i As Integer
  i = 1

  Dim J11flr$, J10flr$, J09flr$, J8Yflr$, J7Wflr$, J04flr$, J03flr$, J02flr$  
  J11flr$ ="4N11,4E11,"
  J10flr$ ="4N10,4S10,4E10,"
  J09flr$ ="4N09,4S09,4E09,"
  J8Yflr$ ="4N07,4E08U,4E08LB,4E08LC,4S07U,4S07LD," '7NORTH & 7S (Y floor)
  J08flr$ ="4E08LA,4S07L," 'Medical 7 & 8th floor
  J7Wflr$ ="4E07," 'Infirmary has moved to 7 East
  J04flr$ ="5N04,5W04,"
  J03flr$ ="5W03,"
  J02flr$ ="5W02,"
  
  Begin Dialog TankDialog 274, 171, "Tank List", .dlgMyFunc
   PushButton    100, 70 , 50, 14, "Print", .btnOK
   PushButton    100, 30, 50, 14, "Select All",   .btnSelAll
   PushButton    100, 50, 50, 14, "UnSelect All", .btnUnSel
   CheckBox  10,  0, 44, 8, "11th Floor",         .CkFloor11
   CheckBox  10, 12, 44, 8, "10th Floor",         .CkFloor10
   CheckBox  10, 24, 44, 8, "9th Floor",          .CkFloor09
   CheckBox  10, 36, 44, 8, "7th/8th-Y",          .CkFloor8Y
   CheckBox  10, 48, 44, 8, "7th/8th-Med",        .CkFloor8M
   CheckBox  10, 60, 44, 8, "Infirmary",          .CkFloorInf
   CheckBox  10, 72, 44, 8, "4th Floor",          .CkFloor04
   CheckBox  10, 84, 44, 8, "3rd Floor",          .CkFloor03
   CheckBox  10, 96, 44, 8, "2nd Floor",          .CkFloor02
   CancelButton  100, 90, 40, 15, .ButCancel
  End Dialog
  
  Dim mydialog as TankDialog
  On Error Resume Next
  Dialog mydialog
   
  If Err = 102 Then
    MsgBox "Tank List canceled."
    Exit Sub
  End If
   
  If mydialog.CkFloor11 = 0 then
    J11flr$=""
  End If
  If mydialog.CkFloor10 =0 then
    J10flr$=""
  End If
  If mydialog.CkFloor09 =0 then
    J09flr$=""
  End If
  If mydialog.CkFloor8M =0 then
    J08flr$=""
  End If
  If mydialog.CkFloor8Y =0 then
    J8Yflr$=""
  End If
  If mydialog.CkFloorInf=0 then
    J7Wflr$=""
  End If
  If mydialog.CkFloor04 =0 then
    J04flr$=""
  End If
  If mydialog.CkFloor03 =0 then
    J03flr$=""
  End If
  If mydialog.CkFloor02 =0 then
    J02flr$=""
  End If

  Dim LocStr$
  LocStr$=J11flr$ + J10flr$ + J09flr$ + J8Yflr$ + J08flr$ + J7Wflr$ + J04flr$ + J03flr$ + J02flr$   

' Start JKJZ
  SendNWait R_C
  SendNWait E_

  GetL$ = UCase(MyScn.GetString(3, 64, 1)) 'Get L
  RetStr$ = GetField(LocStr$,i,",")
  
  Do While RetStr$ <> ""
    If GetL$ <> "L" Then
      PutStr Lstr$, 3, 64
    End If
    PutStr RetStr$, 7, 64        
    PutStr Dest$, 10, 64
    SendNWait E_        
    SendNWait R_C
    SendNWait "JKJZ" & E_

    i = i + 1
    RetStr$ = GetField(LocStr$,i,",")
  Loop

  SendNWait R_C
  SendNWait "XKMS" & E_
  System.TimeoutValue = OldSystemTimeout
End Sub

RE: Any improvement in this code

(OP)
Skie-

Thank you for giving me the support I needed to create this.  You made my code MUCH, MUCH, cleaner and most of the repetitive code isn't there as before!! I'm new to programming and I don't know if I will ever be great but what you have taught me, I can incorporate in my future programs.

Thanks !!!!



Jackeroo75

RE: Any improvement in this code

(OP)
Oh yes..and your code works!!!

RE: Any improvement in this code

No problem.  Glad this is working for you.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close