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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Atatchmate Solutions 2

Status
Not open for further replies.

thickey

MIS
Nov 22, 2002
6
GB
Hi, Im looking for a program that can read a 7 digit number from a text file into a session screen and retrieve sections of data on the screen and save into a txt file, looping until the eof of 7 digit txt file.

At present can do this easily with dyna comm scripts but strugle with Attatchmate...
 
I use the following piece of code to read in text from an input file 1 line at a time and then output the results. It will loop through each line until it hits the eof.
Code:
' Set the default wait timeout value
	g_HostSettleTime = 20		' 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)
	
 
 close  
'just in case you had any input/ouput files open already this will close them and you can begin afresh

Open "d:\data\dump\ORDERRESULTS.txt" for OUTPUT as 3
'THIS IS THE OUTPUT FILE THE 3 BECOMES TH IDENTIFER FOR IT.   
Open "d:\data\dump\ORDIN2.txt" for input as 2
'THIS IS THE INPUT FILE AGAIN THE 2 BECOMES THIS FILES IDENTIFIER 

Do while not eof (2) 'THIS MAKES THE CODE LOOP UNTIL EOF

line input #2, mystring1$ 'READ IN A LINE OF TXT AND GIVE IT A VARIBLE NAME THIS PICKS UP THE WHOLE LINE. 
ORD$ =   mid(mystring1$,1,8) 'TRIM IT DOWN SO THAT ONLY THE CHARACTERS NEEDED ARE PRESENT (IE NO SPACES ETC)       

   Sess0.Screen.putstring ord$,1,9  'output to the session
   Sess0.Screen.Sendkeys(&quot;<enter>&quot;)  
   Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

COPYAREA = sess0.screen.area(05,47,05,55)' select a section of the screen and allocate to a varible
Print #3, ORD$ + &quot;,&quot; + COPYAREA 'now ouput to our specified file with a comma between my input & ouput data (easier for conversions later ie csv)
loop    'jump back to the top and do it all again.
End Sub

Hope this helps post back if you need any more help



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top