Issues updating PCOMM SendKeys macro using a VB 2005 form



Discuss about all tools related to Mainframes but usable in a PC/Computer like Mainframe Simulators, Emulators, Abend Assist etc...

Issues updating PCOMM SendKeys macro using a VB 2005 form

Postby ASHEDL » Mon Sep 01, 2014 9:27 pm

Hello All,

I get numerous requests to push data through Personal Communications. The requests are very sporadic and obviously require different sets of data for each one, which there in-lies the difficulty of the task I am trying to accomplish. I am not a very good programmer, I work in routing and switching mostly but I do try to learn new things that can eventually make life easier.

Anyways I will get a request that has 3 steps:
1. Open the Menu option for step one; fill in the 3 pieces of data to check the status of the data transfer (the first piece of data is the 4 digit identifier, the second 2 pieces of data are the date range which is always that current day for both). If it's all valid and ready, exit that menu option and move on to step 2.

That's enough boring information to give you an idea, I can't really create a keystroke macro because the information is always changing between requests obviously, so I made a keystroke macro and put in generic sets for those 3 pieces of data, but now I need to be able to easily change those 3 pieces of data to quickly run the PCOMM Script that I mapped to ALT+1.(Same thing for steps 2 and 3) Essentially right now I have 3 PCOMM scripts that I made with the keystroke logger of the VT.

Again, not being very good at programming I decided to create a Form Application in Visual Basic 2005; I chose that because it was already on my computer. What I need it to do is take the information that I put into it and replace the generic data sets in the PCOMM script. This may have been the hardest way to do it but the only way I could think of, here is what I have that works but doesn't work. I am able to alter the data sets but when I try to run the PCOMM script afterwards it fails with an error like " PCSKBD400 - The file: OE1 is not a Personal Communications macro/script-file. (I'm not 100% sure that is the exact error, I forgot to write it down but that's pretty dang close to the verbiage. Any suggestions are more than appreciated, but I must note that I don't really do much in this emulator so I don't know my permissions level or anything currently but I can find out if need be..

---------------------------
My PCOMM Script - Named OE1.mac
This is where I need to change the 3 things when I get a new request, the 4 digit identifier (the 1234 in red) and the date range input (the 083114 083114 in red)
---------------------------
[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 "oe0110"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"

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

autECLSession.autECLPS.WaitForCursor 4,26,10000

autECLSession.autECLOIA.WaitForAppAvailable

autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "1234"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "083114 083114 "
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[right]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "b"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"
end sub
---------------------------
As you can see, just step one is drawn out so much and becomes a waste of time/is a waste of time. Again, this is only step 1 there are 2 other macros like this.


In VB 2005 I made a form that is attached.
Update.PNG
Update.PNG

Basically I get the identifier, and the date is already there. I will click the left update button to update my PCOMM macro, and then run my macro. The right side will be filled out after step 2, and then click the right update button to update that information in the PCOMM macro's and then the PUSH button creates my confirmation ticket with the information in the form instead of me copying and pasting everything after.

---------------------------
VB 2005 Code
Here is the code I came up with in VB 2005 for this form; It may be junk but like I said I'm not a programmer.
---------------------------

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Set the Date for today in Text Box 1
'Set the format for the date so it's 082589 instead of the default 08/25/1989
Me.TextBox1.Text = DateTime.Now.ToShortDateString
Me.TextBox1.Text = Format(Now(), "MMddyy")

End Sub

Private Sub UPDATE1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UPDATE1.Click

'
'
'THIS IS JUST TO UPDATE THE IDENTIFIER AND DATE AS NEEDED
'
'
Dim fileReaderROUTE As String
Dim fileReaderDATE As String
Dim RouteInputString As String = Me.TextBox2.Text
Dim DateInputString As String = Me.TextBox1.Text

'--------------------------------OE
'This will look through the file specified and replace all 1234's found with the new ID and save it as the OE1 Macro
fileReaderROUTE = My.Computer.FileSystem.ReadAllText("...\WindowsApplication1\DefaultOE.txt").Replace("1234", RouteInputString)
My.Computer.FileSystem.WriteAllText("...\Emulator\private\OE1.mac", fileReaderROUTE, False)

'This will update the OE1 Macro and replace the old 083114 with the new Date
fileReaderDATE = My.Computer.FileSystem.ReadAllText("...\Emulator\private\OE1.mac").Replace("083124", DateInputString)
My.Computer.FileSystem.WriteAllText("...\Emulator\private\OE1.mac", fileReaderDATE, False)
'--------------------------------

'--------------------------------DT
'Update the DT Macro's Route Number
fileReaderROUTE = My.Computer.FileSystem.ReadAllText("...\WindowsApplication1\DefaultDT.txt").Replace("1234", RouteInputString)
My.Computer.FileSystem.WriteAllText("...\Emulator\private\DT.mac", fileReaderROUTE, False)
'--------------------------------

'--------------------------------SY
'Update the SY Macro's Route Number
fileReaderROUTE = My.Computer.FileSystem.ReadAllText("...\WindowsApplication1\DefaultSY.txt").Replace("1234", RouteInputString)
My.Computer.FileSystem.WriteAllText("...\Emulator\private\SY.mac", fileReaderROUTE, False)
'--------------------------------

'--------------------------------Push Load Form
'Update the Display for the Ticket Template
fileReaderROUTE = My.Computer.FileSystem.ReadAllText("...\WindowsApplication1\PL.txt").Replace("1234", RouteInputString)
My.Computer.FileSystem.WriteAllText("...\WindowsApplication1\Display.txt", fileReaderROUTE, False)
'--------------------------------

End Sub

Private Sub UPDATE2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UPDATE2.Click

'
'
'THIS IS JUST TO UPDATE THE ORIGWH AND ROUTE GROUP AS NEEDED
'
'
Dim fileReaderWH As String
Dim fileReaderGROUP As String
Dim GROUPInputString As String = Me.TextBox4.Text
Dim WHInputString As String = Me.TextBox3.Text

'--------------------------------OrigWH
'Update the SY Macro's OrigWH
fileReaderWH = My.Computer.FileSystem.ReadAllText("...\Emulator\private\SY.mac").Replace("WH", WHInputString)
My.Computer.FileSystem.WriteAllText("...\Emulator\private\SY.mac", fileReaderWH, False)
'--------------------------------

'--------------------------------Route Group
'Update the SY Macro's Route Group
fileReaderGROUP = My.Computer.FileSystem.ReadAllText("...\Emulator\private\SY.mac").Replace("NC6", GROUPInputString)
My.Computer.FileSystem.WriteAllText("...\Emulator\private\SY.mac", fileReaderGROUP, False)
'--------------------------------

'--------------------------------Confirmation
'Update the confirmation template
fileReaderWH = My.Computer.FileSystem.ReadAllText("...\WindowsApplication1\Display.txt").Replace("WH", WHInputString)
My.Computer.FileSystem.WriteAllText("...\WindowsApplication1\Display.txt", fileReaderWH, False)

fileReaderGROUP = My.Computer.FileSystem.ReadAllText("...\WindowsApplication1\Display.txt").Replace("NC6", GROUPInputString)
My.Computer.FileSystem.WriteAllText("...\WindowsApplication1\Display.txt", fileReaderGROUP, False)
'--------------------------------

End Sub

Private Sub PushLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PushLoad.Click

'Open Notepad with Confirmation
System.Diagnostics.Process.Start("notepad.exe", "....\WindowsApplication1\Display.txt")

End Sub

Private Sub Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clear.Click

'Clear the text boxes
'Don't clear TextBox1 since it's the Date and doesn't always need changed
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""

'Reset the Date for TextBox1 if it is missing
If TextBox1.Text = "" Then
Me.TextBox1.Text = DateTime.Now.ToShortDateString
Me.TextBox1.Text = Format(Now(), "MMddyy")
Else
End If

End Sub
End Class

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

Just about everything works the way it is supposed to except when, I'm just guessing, the WriteAllText messes up that macro because I am able to go in and see that everything has been changed but when I try to run the macro in the VT it gives me that file: OE1 is not a Personal Communications macro/script-file.

I have it set up to just replace the information in a mirrored file and then transfer that updated information to the macro so that, for instance, the .Replace("1234", RouteInputString) is always valid and the 1234 is not overwritten and then putting me back at square one; Since it would be over written with the new 3218 for example and my program is still looking to replace 1234, deeming it useless again.

Hopefully this all makes sense, I tried to be as detailed as possible. Hopefully someone out there powered through this giant post and I hope give me the answer to my problem.
I took out the beginning of the file path and replaced it with "..."

Thanks for just looking at my issue, I hope your intrigued and good luck with my mess.
You do not have the required permissions to view the files attached to this post.
ASHEDL
 
Posts: 4
Joined: Mon Sep 01, 2014 8:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Issues updating PCOMM SendKeys macro using a VB 2005 form

 

Re: Issues updating PCOMM SendKeys macro using a VB 2005 for

Postby ASHEDL » Sun Sep 14, 2014 4:31 am

Well thanks for everyone's interest, I figured out how to make it work and I just wanted to let anyone who was interested know. All I did was change all the lines that started with "My.Computer.FileSystem.WriteAllText" to "System.IO.File.WriteAllText".

So I suppose it ended up being an issue with my VB programming and not necessarily an issue with my PCOMM Script like I thought. With the original code I would receive an error that it was not a Personal Communications macro/script-file after I changed something in the script.

Again thanks for everyone's interest, hopefully this will help someone else out down the road.
ASHEDL
 
Posts: 4
Joined: Mon Sep 01, 2014 8:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Issues updating PCOMM SendKeys macro using a VB 2005 for

Postby NicC » Mon Sep 15, 2014 2:40 am

Thank you for posting the resolution.

By-the-by, not everyone uses PCOMM - we certainly do not - and of those who do not all (possibly only a few) write scripts - I never did when I did work somewhere that used PCOMM - so although some people looked maybe none felt qualified to help. That is the downside of forums.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Issues updating PCOMM SendKeys macro using a VB 2005 for

Postby ASHEDL » Mon Sep 15, 2014 12:08 pm

I also don't use PCOMM much outside of this one group of tasks and I know the qualification aspect all too well. I appreciate all the views and interest, it's the though that counts, but I am glad it's all resolved. This annoying task now takes fractions of a minute.

Thanks.
ASHEDL
 
Posts: 4
Joined: Mon Sep 01, 2014 8:03 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Simulators & Emulators

 


  • Related topics
    Replies
    Views
    Last post