S
statikf
I am attempting to use a terminal program named Reflections to
transfer some data via ftp in to a local directory to use import text
and bring into a table in my database. Reflections automaticaly
generates VBA code from recordable macros, so this should be really
straight forward, but the problem is that when the code is pasted in
to a module in Access it fails to run all of the functions.
The code looks like this I will mark the places the code fails and the
explanations I get throughout the code like this >>>Error(error
message) :
Option Explicit
Dim MyReflectionObject As Object
Sub Login()
' Generated by the Reflection Macro Recorder on 04-02-2007
07:36:51.46.
' Generated by Reflection for ReGIS Graphics 9.0.
Dim Reflection As Object
Dim username As String
Dim password As String
Const NEVER_TIME_OUT = 0
Dim LF As String ' Chr$(rcLF) = Chr$(10) = Control-J
Dim CR As String ' Chr$(rcCR) = Chr$(13) = Control-M
Dim ESC As String ' Chr$(rcESC) = Chr$(27) = Control-[
'>>> Error (previous 3 lines give me a "variable not defined")
LF = Chr$(rcLF)
CR = Chr$(rcCR)
ESC = Chr$(rcESC)
' Create a new instance of Reflection.
Set Reflection = CreateObject("Reflection4.Session")
' Use the statement below instead to attach to an existing
instance of Reflection.
' Set Reflection = GetObject(, "Reflection4.Session")
' Normally the Reflection application will be visible while this
macro is running,
' and will remain open when this macro terminates.
' Delete the following line if you want Reflection to be invisible
and automatically closed.
Reflection.Visible = True
username = "username"
' Password was removed from this macro for security.
' Prompt for (what is assumed to be) a password.
password = Reflection.GetPassword( _
Prompt:="Password:", _
HostUserName:=username)
If password = "" Then Exit Sub
' Do not let Reflection process data communications between API
calls.
Reflection.ProcessDatacomm = False
If Reflection.Connected = False Then
Reflection.ConnectionType = "BEST-NETWORK"
Reflection.ConnectionSettings = "Host bpicsusmfg"
Reflection.ConnectionSettings = "DefaultNetwork TELNET"
End If
If Reflection.Connected = False Then
Reflection.Connect
End If
Reflection.StatusBar = "Waiting for Prompt: login:"
Reflection.WaitForString LF & "login: ", NEVER_TIME_OUT,
rcAllowKeystrokes
'>>> Error (previous line give me a "variable not defined")
Reflection.StatusBar = ""
Reflection.Transmit username & CR
Reflection.StatusBar = "Waiting for Prompt: Password:"
Reflection.WaitForString LF & "Password: ", NEVER_TIME_OUT,
Options:=rcAllowKeystrokes
'>>> Error (previous line give me a "variable not defined")
Reflection.StatusBar = ""
Reflection.Transmit password, Options:=rcDecodePassword
'>>> Error (previous line give me a "variable not defined")
Reflection.Transmit CR
Reflection.StatusBar = "Waiting for Prompt: Enter Your Selection"
Reflection.WaitForString LF & "Enter Your Selection ",
NEVER_TIME_OUT, Options:=rcAllowKeystrokes
'>>> Error (previous line give me a "variable not defined")
Reflection.StatusBar = ""
Reflection.CommitLoginProperties
Reflection.Transmit "6"
' String omitted because it might change:
' Reflection.WaitForString "6", NEVER_TIME_OUT, options:=
rcAllowKeystrokes
Press VtEnter (Simulate pressing the Enter key).
Reflection.TransmitTerminalKey "rcVtEnterKey"
'>>> Error (previous line give me a "variable not defined")
' The following string was not unique:
' Reflection.WaitForString ESC & "[2;64H", NEVER_TIME_OUT,
rcAllowKeystrokes
' Reflection.WaitForString "9H" & ESC & "[2;64H", NEVER_TIME_OUT,
rcAllowKeystrokes
' Resume normal data communications processing.
Reflection.ProcessDatacomm = True
' Recording stopped at 07:37:40.24.
End Sub
Any ideas on why the code will not work would be greatly appreciated.
I dont think that I am missing anything I set up my refrences right
and when all the lines that cause errors are commented out the
application will launch and prompt for a password then hang. Please
help... PS I know this is kind of OT but I think that this may be the
best group to help me out as some of you may have experience with
this.
Thanks agian,
Nate
transfer some data via ftp in to a local directory to use import text
and bring into a table in my database. Reflections automaticaly
generates VBA code from recordable macros, so this should be really
straight forward, but the problem is that when the code is pasted in
to a module in Access it fails to run all of the functions.
The code looks like this I will mark the places the code fails and the
explanations I get throughout the code like this >>>Error(error
message) :
Option Explicit
Dim MyReflectionObject As Object
Sub Login()
' Generated by the Reflection Macro Recorder on 04-02-2007
07:36:51.46.
' Generated by Reflection for ReGIS Graphics 9.0.
Dim Reflection As Object
Dim username As String
Dim password As String
Const NEVER_TIME_OUT = 0
Dim LF As String ' Chr$(rcLF) = Chr$(10) = Control-J
Dim CR As String ' Chr$(rcCR) = Chr$(13) = Control-M
Dim ESC As String ' Chr$(rcESC) = Chr$(27) = Control-[
'>>> Error (previous 3 lines give me a "variable not defined")
LF = Chr$(rcLF)
CR = Chr$(rcCR)
ESC = Chr$(rcESC)
' Create a new instance of Reflection.
Set Reflection = CreateObject("Reflection4.Session")
' Use the statement below instead to attach to an existing
instance of Reflection.
' Set Reflection = GetObject(, "Reflection4.Session")
' Normally the Reflection application will be visible while this
macro is running,
' and will remain open when this macro terminates.
' Delete the following line if you want Reflection to be invisible
and automatically closed.
Reflection.Visible = True
username = "username"
' Password was removed from this macro for security.
' Prompt for (what is assumed to be) a password.
password = Reflection.GetPassword( _
Prompt:="Password:", _
HostUserName:=username)
If password = "" Then Exit Sub
' Do not let Reflection process data communications between API
calls.
Reflection.ProcessDatacomm = False
If Reflection.Connected = False Then
Reflection.ConnectionType = "BEST-NETWORK"
Reflection.ConnectionSettings = "Host bpicsusmfg"
Reflection.ConnectionSettings = "DefaultNetwork TELNET"
End If
If Reflection.Connected = False Then
Reflection.Connect
End If
Reflection.StatusBar = "Waiting for Prompt: login:"
Reflection.WaitForString LF & "login: ", NEVER_TIME_OUT,
rcAllowKeystrokes
'>>> Error (previous line give me a "variable not defined")
Reflection.StatusBar = ""
Reflection.Transmit username & CR
Reflection.StatusBar = "Waiting for Prompt: Password:"
Reflection.WaitForString LF & "Password: ", NEVER_TIME_OUT,
Options:=rcAllowKeystrokes
'>>> Error (previous line give me a "variable not defined")
Reflection.StatusBar = ""
Reflection.Transmit password, Options:=rcDecodePassword
'>>> Error (previous line give me a "variable not defined")
Reflection.Transmit CR
Reflection.StatusBar = "Waiting for Prompt: Enter Your Selection"
Reflection.WaitForString LF & "Enter Your Selection ",
NEVER_TIME_OUT, Options:=rcAllowKeystrokes
'>>> Error (previous line give me a "variable not defined")
Reflection.StatusBar = ""
Reflection.CommitLoginProperties
Reflection.Transmit "6"
' String omitted because it might change:
' Reflection.WaitForString "6", NEVER_TIME_OUT, options:=
rcAllowKeystrokes
Press VtEnter (Simulate pressing the Enter key).
Reflection.TransmitTerminalKey "rcVtEnterKey"
'>>> Error (previous line give me a "variable not defined")
' The following string was not unique:
' Reflection.WaitForString ESC & "[2;64H", NEVER_TIME_OUT,
rcAllowKeystrokes
' Reflection.WaitForString "9H" & ESC & "[2;64H", NEVER_TIME_OUT,
rcAllowKeystrokes
' Resume normal data communications processing.
Reflection.ProcessDatacomm = True
' Recording stopped at 07:37:40.24.
End Sub
Any ideas on why the code will not work would be greatly appreciated.
I dont think that I am missing anything I set up my refrences right
and when all the lines that cause errors are commented out the
application will launch and prompt for a password then hang. Please
help... PS I know this is kind of OT but I think that this may be the
best group to help me out as some of you may have experience with
this.
Thanks agian,
Nate