N
njack217
I have an access database that I'm using along with vba to gather and
analyze some data from a couple of sources. I am using Reflections for
windows to telnet in and run reports and then transfer them to the
local machine and eventually in to the databases tables but, while
each function will run individualy if I attempt to run them in series
they fail by the second or third report. I posted some code to give an
example of what exactly is going on. Please any ideas even bad ones
are welcome.
first here is an example of how I am running the reports. If I run
this function from the immediate window everyting goes off without a
hitch.
Public Function kam5001()
Dim CR As String
Dim ESC As String
'On Error GoTo error_handeler
Call Login
Const NEVER_TIME_OUT = 0
CR = Chr(13)
ESC = Chr(27)
With Session
.Transmit "kam5001"
.StatusBar = "Waiting for Prompt: 06/29/07 10:26
BPICS (BPI) KAM5001"
.WaitForString ESC & "[2;71H", NEVER_TIME_OUT,
rcAllowKeystrokes
.StatusBar = ""
.TransmitTerminalKey rcVtEnterKey
.StatusBar = "Waiting for Prompt: As-of Date:"
.WaitForString "H" & ESC & "[24;79H" & ESC & "[3;36H",
NEVER_TIME_OUT, rcAllowKeystrokes
.StatusBar = ""
.TransmitTerminalKey rcVtEnterKey
.StatusBar = "Waiting for Prompt: Report Output:"
.WaitForString "9H" & ESC & "[4;36H", NEVER_TIME_OUT,
rcAllowKeystrokes
.StatusBar = ""
.TransmitTerminalKey rcVtDownKey
.StatusBar = "Waiting for Prompt: Memo:"
.WaitForString " " & ESC & "[24;79H" & ESC & "[6;37H",
NEVER_TIME_OUT, rcAllowKeystrokes
.StatusBar = ""
.TransmitTerminalKey rcVtDownKey
.WaitForString "H" & ESC & "[7;37H", NEVER_TIME_OUT,
rcAllowKeystrokes
.TransmitTerminalKey rcVtDownKey
.WaitForString "H" & ESC & "[8;37H", NEVER_TIME_OUT,
rcAllowKeystrokes
.Transmit CR
.StatusBar = "Waiting for Prompt: Report Destination:"
.WaitForString "8H" & ESC & "[24;79H" & ESC & "[5;36H",
NEVER_TIME_OUT, rcAllowKeystrokes
.StatusBar = ""
.Transmit "kam5001.txt"
.Transmit CR
.StatusBar = "Waiting for Prompt: From Product Line:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: To Product Line:"
.WaitForString "H" & ESC & "[9;36H", NEVER_TIME_OUT,
rcAllowKeystrokes
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: Container Type:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: Download Format:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: Actual DC's:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: Master DC's:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: (D)etail/(S)ummary:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: Ac <"
.WaitForString "H" & ESC & "[24;79H" & ESC & "[12;36H",
NEVER_TIME_OUT, rcAllowKeystrokes
.StatusBar = ""
.Transmit CR
.Transmit CR
.StatusBar = "Waiting for Prompt: Press space bar to
continue."
.WaitForString "." & ESC & "[24;79H", NEVER_TIME_OUT,
rcAllowKeystrokes
.StatusBar = ""
.Transmit " "
.StatusBar = "Waiting for Prompt: Press space bar to
continue."
.WaitForString "." & ESC & "[24;79H", NEVER_TIME_OUT,
rcAllowKeystrokes
.StatusBar = ""
.Transmit " "
.WaitForString "4H" & ESC & "[24;79H" & ESC & "[2;64H",
NEVER_TIME_OUT, rcAllowKeystrokes
pf_ind = pf_ind + 100000
pfind = 1
Pause (10)
Call killreflections
End With
Exit Function
error_handeler:
killreflections
pfind = 0
End Function
now here is the part where stuff gets screwy. this is the way that I
am running through the reports. A report or two will run but then I
start getting an error of "Run-time error '462': The remote server
machine does not exist or is unavailable" even thought I can see the
active terminal window sitting there waiting for input. so I'm like !@$
$#%WTF!!!!.
Public Function bpics()
Dim times As Single
times = 0
Do Until pf_ind = 11111111
If pf_ind > 11111111 Then pf_ind = 0
times = 0
Do Until pf_ind >= 1 Or times = 3
Call prm5003
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 10 Or times = 3
Call kam5012
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 100 Or times = 3
Call inm57st
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 1000 Or times = 3
Call inm57in
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 10000 Or times = 3
Call inm57bk
times = times + 1
Exit Do
Loop
Call seevals
Do Until pf_ind >= 100000 Or times = 3
Call kam5001
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 1000000 Or times = 3
Call SCM5051
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 10000000 Or times = 3
Call pum5060
times = times + 1
Exit Do
Loop
Call seevals
Call reset
Exit Do
Loop
Call reset
Call Login
Call xferem
End Function
Please help out if you can or ask me if you think you can help but
need more info.
statikf
analyze some data from a couple of sources. I am using Reflections for
windows to telnet in and run reports and then transfer them to the
local machine and eventually in to the databases tables but, while
each function will run individualy if I attempt to run them in series
they fail by the second or third report. I posted some code to give an
example of what exactly is going on. Please any ideas even bad ones
are welcome.
first here is an example of how I am running the reports. If I run
this function from the immediate window everyting goes off without a
hitch.
Public Function kam5001()
Dim CR As String
Dim ESC As String
'On Error GoTo error_handeler
Call Login
Const NEVER_TIME_OUT = 0
CR = Chr(13)
ESC = Chr(27)
With Session
.Transmit "kam5001"
.StatusBar = "Waiting for Prompt: 06/29/07 10:26
BPICS (BPI) KAM5001"
.WaitForString ESC & "[2;71H", NEVER_TIME_OUT,
rcAllowKeystrokes
.StatusBar = ""
.TransmitTerminalKey rcVtEnterKey
.StatusBar = "Waiting for Prompt: As-of Date:"
.WaitForString "H" & ESC & "[24;79H" & ESC & "[3;36H",
NEVER_TIME_OUT, rcAllowKeystrokes
.StatusBar = ""
.TransmitTerminalKey rcVtEnterKey
.StatusBar = "Waiting for Prompt: Report Output:"
.WaitForString "9H" & ESC & "[4;36H", NEVER_TIME_OUT,
rcAllowKeystrokes
.StatusBar = ""
.TransmitTerminalKey rcVtDownKey
.StatusBar = "Waiting for Prompt: Memo:"
.WaitForString " " & ESC & "[24;79H" & ESC & "[6;37H",
NEVER_TIME_OUT, rcAllowKeystrokes
.StatusBar = ""
.TransmitTerminalKey rcVtDownKey
.WaitForString "H" & ESC & "[7;37H", NEVER_TIME_OUT,
rcAllowKeystrokes
.TransmitTerminalKey rcVtDownKey
.WaitForString "H" & ESC & "[8;37H", NEVER_TIME_OUT,
rcAllowKeystrokes
.Transmit CR
.StatusBar = "Waiting for Prompt: Report Destination:"
.WaitForString "8H" & ESC & "[24;79H" & ESC & "[5;36H",
NEVER_TIME_OUT, rcAllowKeystrokes
.StatusBar = ""
.Transmit "kam5001.txt"
.Transmit CR
.StatusBar = "Waiting for Prompt: From Product Line:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: To Product Line:"
.WaitForString "H" & ESC & "[9;36H", NEVER_TIME_OUT,
rcAllowKeystrokes
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: Container Type:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: Download Format:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: Actual DC's:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: Master DC's:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: (D)etail/(S)ummary:"
.StatusBar = ""
.Transmit CR
.StatusBar = "Waiting for Prompt: Ac <"
.WaitForString "H" & ESC & "[24;79H" & ESC & "[12;36H",
NEVER_TIME_OUT, rcAllowKeystrokes
.StatusBar = ""
.Transmit CR
.Transmit CR
.StatusBar = "Waiting for Prompt: Press space bar to
continue."
.WaitForString "." & ESC & "[24;79H", NEVER_TIME_OUT,
rcAllowKeystrokes
.StatusBar = ""
.Transmit " "
.StatusBar = "Waiting for Prompt: Press space bar to
continue."
.WaitForString "." & ESC & "[24;79H", NEVER_TIME_OUT,
rcAllowKeystrokes
.StatusBar = ""
.Transmit " "
.WaitForString "4H" & ESC & "[24;79H" & ESC & "[2;64H",
NEVER_TIME_OUT, rcAllowKeystrokes
pf_ind = pf_ind + 100000
pfind = 1
Pause (10)
Call killreflections
End With
Exit Function
error_handeler:
killreflections
pfind = 0
End Function
now here is the part where stuff gets screwy. this is the way that I
am running through the reports. A report or two will run but then I
start getting an error of "Run-time error '462': The remote server
machine does not exist or is unavailable" even thought I can see the
active terminal window sitting there waiting for input. so I'm like !@$
$#%WTF!!!!.
Public Function bpics()
Dim times As Single
times = 0
Do Until pf_ind = 11111111
If pf_ind > 11111111 Then pf_ind = 0
times = 0
Do Until pf_ind >= 1 Or times = 3
Call prm5003
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 10 Or times = 3
Call kam5012
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 100 Or times = 3
Call inm57st
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 1000 Or times = 3
Call inm57in
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 10000 Or times = 3
Call inm57bk
times = times + 1
Exit Do
Loop
Call seevals
Do Until pf_ind >= 100000 Or times = 3
Call kam5001
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 1000000 Or times = 3
Call SCM5051
times = times + 1
Exit Do
Loop
Call seevals
times = 0
Do Until pf_ind >= 10000000 Or times = 3
Call pum5060
times = times + 1
Exit Do
Loop
Call seevals
Call reset
Exit Do
Loop
Call reset
Call Login
Call xferem
End Function
Please help out if you can or ask me if you think you can help but
need more info.
statikf