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

GetString returns garbage

Status
Not open for further replies.

camidon

Programmer
May 9, 2000
268
US
I'm trying to use the following code to automate the process of checking for successors to mainframe jobs which have failed. Here is my code:

Code:
        Dim MyScreen as object
        
        Set MyScreen = Sess0.screen

        CurrentRow = MyScreen.Row
        CurrentCol = MyScreen.Col
 
        JobName = Sess0.Screen.GetString(CurrentRow,CurrentCol,8)
    
	MyScreen.moveto 41,15
 
        Sendkeys "zd succ job " + jobname + " lev *"

When I run the macro, it assigns something strange to Jobname instead of the actual value. I ends up making jobname something like "zd succ job lev *". There appear to be some characters when I add a watch for that variable, but the characters do not represent anything anywhere on the current screen.

I'm truly stumped on this one as I have no clue as to why it won't just grab what's on the screen!

Thanks in advance,

Chris
 
Why don't you just give it the co-ordinates where you want the information extracted from? Is this something that will be changing position? If so, try the search method.

The issue you're having is that it is dependent on the cursor location.

If you want to get the string from 24, 2, then
JobName = Sess0.Screen.GetString(24,2,8)

calculus
 
It's something that will change positions. I after you posted this I found a solution though. Here is the code that saved my day:

Code:
        Dim MyScreen as object
        Dim MyArea as object
        
        Set MyScreen = Sess0.screen

        CurrentRow = MyScreen.Row
        CurrentCol = MyScreen.Col
 
        Set MyArea = MyScreen.Area(CurrentRow,CurrentCol,CurrentRow,CurrentCol+7)
        MyArea.Select
        Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
        MyScreen.Copy
        
        Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
        
	MyScreen.moveto 41,15
 
        Sendkeys "zd succ job "
        Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
        MyScreen.Paste
        Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
        MyScreen.moveto 41,35
        SendKeys " lev *{ENTER}"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top