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!

How do I send "string"

Status
Not open for further replies.

smiler44

Technical User
Sep 18, 2009
83
GB
I am using microsoft excel to interact with attachmate extra.
The one thing I can not work out how to do is "sendstring". I have a variable that I want to send. Below is my code with the problem line of code, if you can help. The line of code thats wrong is sendstring "anm"

dim anm as string

Private Sub CommandButton1_Click()

anm = "authers name"
Call main
End Sub

Sub main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object


Dim objExcel As Object
Dim objWorkBook As Object
Dim objChart As Object

Set objExcel = GetObject(, "Excel.Application")
If objExcel Is Nothing Then
'If GetObject failed, open a new instance of Excel
Set objExcel = CreateObject("Excel.Application")
If objExcel Is Nothing Then
MsgBox ("Can not open Microsodt Excel.")
Exit Sub
End If
End If

' Make Excel visible on the screen
objExcel.Visible = True
Dim spreadSheet As Object
Set spreadSheet = ActiveWorkbook.ActiveSheet
Set System = CreateObject("EXTRA.System") ' Gets the system session
If (System Is Nothing) Then
MsgBox "Can not open Extra Session. Stopping ."
Stop
End If
Set Sessions = System.Sessions

If (Sessions Is Nothing) Then
MsgBox "Could not create the Session. Stopping ."
Stop
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 75 ' ms

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

' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 Is Nothing) Then
MsgBox "Can not open Session. Stopping."
Stop
End If
If Not Sess0.Visible Then Sess0.Visible = True

getjobs:
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<HOME>mtcc<enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
sendstring "anm"
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<tab><tab><tab><tab><tab>")

end sub

 
the answer is in part of your code
Code:
Sess0.Screen.[blue]SendKeys[/blue] ("<HOME>[blue]mtcc[/blue]<enter>")


use Sendkeys
Code:
Sess0.Screen.SendKeys ("anm")

otherwise, you may use Putstring. See Help file for more information. Use Putstring instead of tabbing to the field to enter your information

hth
za
 
Hi za, thanks for the reply.
mtcc are letters I want to type but anm is a variable string.
Took your advice and looked in the help, something that normally gets me no where but got a resutl. your code of Sess0.Screen.SendKeys ("anm") is almost right but remove the brackets and " to leave Sess0.Screen.SendKeys anm and this will send the variable string assigned to anm. You put me on the right road, thanks
smiler44
 


If you want to send a COMMAND to your emulator, then you use SendKeys.

If you want to put data into your emlatator screen at a particular row/column location, you can use the PutString method of the Screen Object.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top