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

Finding a spasific word on an Extra screen

Status
Not open for further replies.

iSPOK

IS-IT--Management
Aug 6, 2006
17
0
0
GB
Please help am new at this,
1) My problem is, am trying to write a macro thet can look for a word (B10331) on an Extra screen. (It can be anywhere on the screen)
2) If the word is on the screen copy it into an excell cell,
3) If not on the first screen, then PF8 to go to the next page,
4) However if the word cannot be found and there are no further pages, (page end at position, 23, 02) at the bottom of the screen, then write 'not found' back to excell,....

P.S. I have searched the forum for examples but I cannot get then to work.....
I would be extreemly greatfull if someone can help.....
Many thanks in advance

 
Hi,

This is code I use to search for a named session called CICSA on PC's were some people have it under different PF keys to log on:

Code:
Set MyArea = MyScreen.Search("CICSA")
        MyScreen.Moveto MyArea.Bottom, MyArea.Left - 29
        PFKey = MyScreen.GetString(MyArea.Bottom, MyArea.Left - 29, 3)
        Sess0.Screen.WaitHostQuiet (g_hostsettletime)
        GoTo pf1
        
pf1:
        If PFKey = "PF1" Then Sess0.Screen.SendKeys ("<Pf1>") Else GoTo pf2
        Sess0.Screen.WaitHostQuiet (g_hostsettletime): GoTo loggedin
pf2:
        If PFKey = "PF2" Then Sess0.Screen.SendKeys ("<Pf2>") Else GoTo pf3
        Sess0.Screen.WaitHostQuiet (g_hostsettletime): GoTo loggedin
pf3:
        If PFKey = "PF3" Then Sess0.Screen.SendKeys ("<Pf3>") Else GoTo pf4
        Sess0.Screen.WaitHostQuiet (g_hostsettletime): GoTo loggedin
pf4:
        If PFKey = "PF4" Then Sess0.Screen.SendKeys ("<Pf4>") Else GoTo pf5
        Sess0.Screen.WaitHostQuiet (g_hostsettletime): GoTo loggedin
pf5:
        If PFKey = "PF5" Then Sess0.Screen.SendKeys ("<Pf5>") Else GoTo pf6
        Sess0.Screen.WaitHostQuiet (g_hostsettletime): GoTo loggedin
pf6:
        If PFKey = "PF6" Then Sess0.Screen.SendKeys ("<Pf6>") Else GoTo pf7
        Sess0.Screen.WaitHostQuiet (g_hostsettletime): GoTo loggedin
pf7:
        If PFKey = "PF7" Then Sess0.Screen.SendKeys ("<Pf7>") Else GoTo pf8
        Sess0.Screen.WaitHostQuiet (g_hostsettletime): GoTo loggedin
pf8:
        If PFKey = "PF8" Then Sess0.Screen.SendKeys ("<Pf8>") Else GoTo pf9
        Sess0.Screen.WaitHostQuiet (g_hostsettletime): GoTo loggedin
pf9:
        If PFKey = "PF9" Then Sess0.Screen.SendKeys ("<Pf9>") Else GoTo pf10
        Sess0.Screen.WaitHostQuiet (g_hostsettletime): GoTo loggedin
pf10:
        If PFKey = "PF10" Then Sess0.Screen.SendKeys ("<Pf10>") Else Sess0.Screen.WaitHostQuiet (g_hostsettletime)
        Sess0.Screen.WaitHostQuiet (g_hostsettletime): GoTo loggedin

Hope this helps
 
Dee0612

Thank a million. for your post....But am still confused..
sorry...
This is the script am trying to adapt for my search..So I can do the steps below....
) My problem is, am trying to write a macro thet can look for a word (B10331) on an Extra screen. (It can be anywhere on the screen)
2) If the word is on the screen copy it into an excell cell,
3) If not on the first screen, then PF8 to go to the next page,
4) However if the word cannot be found and there are no further pages, (page end at position, 23, 02) at the bottom of the screen, then write 'not found' back to excell,....



Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim SearchComplete As Object
Dim MySelection
Dim MyArea As 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 = 30 ' 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)


'Check for "Prod Total" (for multiple pages) outputting each page to file
'First page
Set SearchComplete = Sess0.Screen.Search("PROD TOTAL")
If SearchComplete="" Then
Set MyArea = Sess0.Screen.Area(7,1,22,79,,2)
Else
Set MyArea = Sess0.Screen.Area(7,1,SearchComplete.Bottom,79,,2)
End If

' This section of code contains the recorded events
Sess0.Screen.Sendkeys("dcs <Tab>")
Sess0.Screen.Paste
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("dcrd<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

'While loop for subsequent pages
While SearchComplete=""
Sess0.Screen.Sendkeys("<PF8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Set SearchComplete = Sess0.Screen.Search("B10331")
Set MyArea = Sess0.Screen.Area(7,1,22,79,,2)
If SearchComplete="" Then
Set SearchComplete = Sess0.Screen.Search("NO QUEUE RECORDS")
Set MyArea = Sess0.Screen.Area(7,1,22,79,,2)
If SearchComplete="" Then
Set MyArea = Sess0.Screen.Area(7,1,22,79,,2)
Else
Set MyArea = Sess0.Screen.Area
End If
Else
Set MyArea = Sess0.Screen.Area(7,1,SearchComplete.Bottom,79,,2)
End If

Wend

End Sub
 
Check the help files for the Search object. It will search the entire screen for what you tell it to. You can then determine if it was found.

calculus
 
Calculas....

Thanks for the pointer...
can you give me an example script, for doing this from my code....cheers

 
Check the help files and you'll see some examples.

Here's one.

Code:
Set MyArea = MyScreen.Search("==>")
MyScreen.MoveTo MyArea.Bottom, MyArea.Right + 2

calculus
 
calculus...

Thanks for the sample search......perfect..
Now I need to find a script that if there is no "B10331" on first page it will move to the next page....But not all records have the "B10331"... So now the search will need to look for "PROD TOTAL" at the bottom of the page...(This indicates the are no more pages to advance to, so we exit the loop)....


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top