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 Andrzejek 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 a file inside attachmate session 3

Status
Not open for further replies.

southpaw81

Programmer
Feb 19, 2004
16
US
First thank you for your time. I am attempting to send a .txt file into a session extra client screen. When I copy paste the .txt lines (approx 50) into the session it only pastes one line at a time. I need it to paste all of the information like a text box. CMD?

How can i set this up?

Note: the program i am emulating has a (send file) option on the toolbar. You select the .txt file and it copies the entire file onto the active screen


 
Have you tried using the sendfile method?

Sub Main()
Dim Sys As Object, Sess As Object
Set Sys = CreateObject("EXTRA.System")
Set Sess = Sys.ActiveSession
Sess.FileTransferScheme = "Text Default"
Sess.FileTransferHostOS = 0 '0 = CMS
Sent = Sess.SendFile("c:\test.txt","test text")
If Sent Then MsgBox ("Sent Okay.") Else MsgBox ("Error while sending.")
End Sub
 
I agree with brandewie7 the sendfile is the way to go

Sub Main()
Dim Sys As Object, Sess As Object
Set Sys = CreateObject("EXTRA.System")
' Assumes an open session and your at option 6 for the upload
Set Sess = Sys.ActiveSession
Sess.FileTransferScheme = "Text Default"
Sess.FileTransferHostOS = 1 '1 = TSO

destination=inputbox("Type in the file name that will be upload from the c drive, ie ATDIPR.TXT")
destination1= "c:\" & destination

source=inputbox("Type the data set where file will be uploaded ie jetted.spufi.output.status0" & chr(13) & "***************")
'msgbox source
source1="'" & source & "'"
'source2=""" & source1 & """
msgbox source1

Recv = Sess.sendFile(destination1, source1 )


End Sub
 
Thanks for your help, a little delayed in my response =)

I am back working on this project again, (big sigh) and I have still not figured out this mystery. Basically, they key orders into a TELNET session we call OESOTS. At a certain point in the order process we "SEND FILE" and it prompts me for the location, and then it dumps it in.

So basically I have connected to an ATTACHMATE Session and have been able to go through all the prompts and enter all the order information just like a normal telnet.

EXCEPT for the Send File

I have tried to use your examples, but they dont seem to work for me. I just created a blank macro and cut and paste your code.

my file path is : C:\Test.txt
The session is called: OESOTS.EDP

Any clues?
 
The above methods should work.

Are you using the correct Session object? Most default to "Sess0".

You must have a fileTransferScheme saved on your system, and it must have a valid file name and path. This scheme tells Attachmate how to handle carriage returns and line feeds among many other things. This can be saved in the dialog box that pops up when you try to send the file manually.

If these don't work, try posting some of your code along with specific errors. Also post your Attachmate version.

calculus
 
'***********************************************************
'
' Date: Thursday, February 27, 2003 17:19:10
' DO NOT MODIFY THIS FILE
'
'***********************************************************
Sub Main()
Dim Sys As Object, Sess As Object
Set Sys = CreateObject("OESOTS.ebm")
Set Sess = Sys.ActiveSession
Sess.FileTransferScheme = "Text Default"
Sess.FileTransferHostOS = 1 '1 = TSO

destination=inputbox("Type in the file name that will be upload from the c drive, ie ATDIPR.TXT")
destination1="c:\test.txt"

source=inputbox("Type the data set where file will be uploaded ie jetted.spufi.output.status0" & chr(13) & "***************")
'msgbox source
source1="'" & source & "'"
'source2=""" & source1 & """
msgbox source1

Recv = Sess.sendFile(destination1, source1 )


End Sub


-------------------------------------

This is the code, I maybe handling it wrong, I am not that savvy with the coding yet.
 
Is "Text Default" a valid scheme on the computer running this code?

Click Tools>Transfer File, check the drop down under "Scheme".

Alternately you can look at "C:\Program Files\E!PC\Schemes" and see if the file is saved there as "Text Default.eis".

You may need to revert to recording a macro. Steps are:
1. Tools>Macro>Record
2. Execute the manual code
3. Look at the code - it will be the code you need to make this work on this particular computer.

Good Luck,

calculus
 
Ok, your suggestion of recording the macro was brilliant. My only confussion now is getting the file to send or transfer to the active session. When I pull up the transfer file box it asks for:

Transfer File list name:
Path/Direction/Host/Scheme/
Filename
Host
etc...

I dont know how to fill those boxes in correctly, considering i just want it to send the file to my extra session that is currently open?

//////current code//////////////////////
' Get the main system object
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System is Nothing) Then
Msgbox "Could not create the EXTRA System object. Stopping macro playback."
STOP
End If
Set Sessions = System.Sessions

If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
STOP
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 3000 ' milliseconds

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 "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

' This section of code contains the recorded events
Sess0.SendFile "C:\46EM0674.txt","46EM0674.TXT;1"
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.FileTransferScheme = "<Current settings>"
Sess0.Screen.Sendkeys("test<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("hier<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

System.TimeoutValue = OldSystemTimeout
End Sub
 
This is the section of code with the useful info:

' This section of code contains the recorded events
Sess0.SendFile "C:\46EM0674.txt","46EM0674.TXT;1"
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.FileTransferScheme = "<Current settings>"
Sess0.Screen.Sendkeys("test<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("hier<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

System.TimeoutValue = OldSystemTimeout
End Sub


All the boxes that come up are the critical piece included in the "Default Text.eid" file. It is critical that these are set up. Once done you'll be in good shape.

calculus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top