×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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!
  • Students Click Here

*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

Jobs

How do I send "string"

How do I send "string"

How do I send "string"

(OP)
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

RE: How do I send "string"

the answer is in part of your code

CODE

Sess0.Screen.SendKeys ("<HOME>mtcc<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

RE: How do I send "string"

(OP)
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

RE: How do I send "string"



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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

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