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!

Macro on Personal Communications

Status
Not open for further replies.

jessicatech

Programmer
Oct 24, 2006
19
MY
Hi all,

I am writing a macro ( .mac) to be used in IBM Personal Communications 5.7
emulator for AS/400. The macro is to read text

from a text file (MBRID.TXT) and perform a routine in the macro as follow:

*******************************************************************************
***************************

[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)

REM This line calls the macro subroutine
subSub1_

sub subSub1_()
autECLSession.autECLOIA.WaitForAppAvailable

autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "3"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"

REM *************
REM Maintenance *
REM *************

Open "C:\MBRID.TXT" For Input As #1 ' HITS
HERE!!!!!!!!!!!!!!!!!

While Not EOF(1)
Line Input #1, mbrid
If mbrid <> " " Then

autECLSession.autECLPS.WaitForAttrib 4,27,"00","3c",3,10000

autECLSession.autECLPS.WaitForCursor 4,28,10000

autECLSession.autECLOIA.WaitForAppAvailable

autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[mbrid]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"

autECLSession.autECLPS.WaitForAttrib 5,46,"00","3c",3,10000

autECLSession.autECLPS.WaitForCursor 5,47,10000

autECLSession.autECLOIA.WaitForAppAvailable

autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[tab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[tab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "Y"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[tab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[tab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[tab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "Free-Text"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"
End If
Wend
Close #1

autECLSession.autECLPS.WaitForAttrib 4,27,"00","3c",3,10000

autECLSession.autECLPS.Wait 3114

autECLSession.autECLOIA.WaitForAppAvailable

autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf3]"
end sub

*******************************************************************************
***************************

However, I hit a run-time error at the following line:
Open "C:\MBRID.TXT" For Input As #1

Error message is "Error on line 23. Expected end of statement. Would you like
to edit script?

The MBRID.TXT file exists in the C drive.

Please advise and Thank you.
 
Hi PHV,

Can you give the sample codes for the following:

*********************************************
Open "C:\MBRID.TXT" For Input As #1 ' HITS
HERE!!!!!!!!!!!!!!!!!

While Not EOF(1)
Line Input #1, mbrid
If mbrid <> " " Then
...
...
autECLSession.autECLPS.SendKeys "[mbrid]"
*********************************************
mbrid is the content from the MBRID.TXT file. Is that the correct syntax?

Please advise and Thank you.
 
Hi PHV,
I am using VBScript for "IBM Personal Communications 5.7
emulator for AS/400". Can I still use the FileSystemObject for accessing a text file? I see the emulator macro needs special code like " autECLSession.autECLPS.WaitForAttrib".

*******************************************************
' VBScript
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("c:\testfile.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close
*******************************************************

Open "C:\MBRID.TXT" For Input As #1

Also, how do I access the value in the text file eh?

Please advise and Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top