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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

small coding issue..else if statement 1

Status
Not open for further replies.

southpaw81

Programmer
Feb 19, 2004
16
0
0
US
The code below is used to grab information off customer accounts in our attachmate sessions. I am trying to figure out the correct code to put in the marked section below, that will tell the macro, if you dont see (V1, L1, etc) then hit enter to go to the next page, and repeat your search, do this x amount of times, if nothing matches then end. I marked the code section with *****'s

I also dont understand the histep command, can someone explain that for me, a friend wrote that part in for me trying to help, and I dont understand how it functions.



' Global Subroutine Declarations
Declare Sub GetSystem
Declare Sub AddToMacroLog

' Global variable declarations
Global g_HostSettleTime%
Global Session As Object
Global System As Object
Global Screen As Object
Global Sess0 As Object
Global MacroName As String

Sub Main()
Dim ListsList(100) as String
GetSystem
' AddToMacroLog

Begin Dialog newdlg 175, 53
TextBox 15, 25, 90, 15, .TextBox1
OkButton 115, 10, 50, 14
CancelButton 115, 25, 50, 14
Text 15, 10, 85, 10, "Enter H1 or L1 account ID"
End Dialog
Dim dMain as newdlg

iDone = FALSE
While iDone = FALSE
nRet = Dialog(dMain)
Select Case nRet
Case -1
iDone = TRUE
AcctID = dMain.TextBox1
Filenum% = Freefile
Filename$ = "c:\" + acctID + "_VACFList.txt"
Open Filename$ for Output as Filenum%
Print # Filenum%, "Account ID ;Account Name ;List ID ;Code ;Status"
Close Filenum%
Sess0.Screen.Row = 21
Sess0.Screen.Col = 8
Sess0.Screen.Sendkeys(AcctID)
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
'changing from (6, 56, 6, 57)
acctType = Sess0.Screen.Area(6, 56, 6, 57)
If ((acctType = "VN") or (acctType = "TC") or (acctType = "VC") or (acctType = "L9") or (acctType = "V1")) then
acctType = "L1"
End If
Select Case acctType
Case "H1"
Sess0.Screen.Row = 22
Sess0.Screen.Col = 18
Sess0.Screen.Sendkeys("HIER<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
'here its messing up
h1Count = 0
hiEnd = FALSE
While hiEnd = FALSE
For hiStep = 8 to 19
acType = Sess0.Screen.Area(hiStep, 18, hiStep, 19)
If ((acType = "VN") or (acType = "TC") or (acType = "VC") or (acType = "L9") or (acType = "V1")) then
acType = "L1"


End IF
************************
***********Here is where I need an else if after it searches
*********************

Select Case acType
Case "H1"
h1Count = h1Count + 1
If h1Count > 1 then
hiEnd = TRUE
hiStep = 19
End If
Case " "
hiEnd = TRUE
hiStep = 19
Case "L1"
Sess0.Screen.Row = hiStep
Sess0.Screen.Col = 4
Sess0.Screen.Sendkeys("M<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
 
You can do this with a simple Label.

At the location you want:
Else
Sess0.Screen.SendKeys ("Enter")
Do while Sess0.Screen.OIA.XStatus <> 0 'Will wait until the "x status" is gone
Doevents
Loop
Goto ReSearch:




Now put the tag "ReSearch:" where you want to go start the research.


While hiEnd = FALSE
Research:
For hiStep = 8 to 19



You will need to put an "exit" line that will exit this "loop" when it finds the end of your file. I'd put a check under the ReSearch tag and tell it to go to a new Tag called Exithere or something to that effect.

calculus
 
Your a genius!

It worked great!

Thanks for your time, Ryan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top