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

google search doesn't work

Status
Not open for further replies.

link99sbc

Technical User
Apr 8, 2009
141
US
Trying to copy a line in attachmate and paste in the google search line. Sometimes it works sometimes it don't.
anybody have a better way?
[]
Sub Main()

Dim Sys As Object, Sess As Object, MyScreen As Object, MyArea As Object

Set Sys = CreateObject("EXTRA.System")
Set Sess = Sys.ActiveSession
Set MyScreen = Sess.Screen

Set MyArea = MyScreen.Area(11, 14, 11, 50)
MyArea.Select
MyArea.Copy



Dim oIE as object
Dim oElements as object
Dim oElement as object

Set oIE = CreateObject("InternetExplorer.Application")
sURL = "
oIE.navigate(sURL)
oIE.visible = True


While oIE.Busy
'Do Nothing
Wend

Sendkeys "^v"
Sendkeys "{Enter}"

End Sub
 
Code:
Sendkeys "^v"
Sendkeys "{Enter}"

it seems the problem is probably with the control caret. you might want to assign the value from your extra session and then send that variable to IE.....additionally dont things like the 'enter' key need to be surrounded by <> instead of {}

Code:
'gets the data from extra
variable = sess0.screen.area(1,1,1,10).value
'puts it in IE
IEsess.SendKeys(variable)\
 
also, it wouldnt hurt to have your program 'find' the search box by name (look at the HTML of the rendered page) and put the string from EXTRA there instead of just hoping that the cursor is going to be in the text box already
there are some really good posts on IE automation in the forum but unfortunately im running out of time on my break so i will have to put them all together and link them here later, keep me posted and let me know how things are going
 
Thanks I figured it out. Working fine now.
 
This is another way which may be cleaner since it deals with the Google page elements without sending keys

Code:
Sub Main()
   
   Dim Sys as Object, Sess As Object    
   Set Sys = CreateObject("Extra.System")   
    If Sys is Nothing then
        MsgBox ("Could not create Extra!.System...is E!PC installed in this machine?")
        Exit Sub
    End If   
    Set Sess = Sys.ActiveSession   
    If Sess Is Nothing then 
        MsgBox ("No Session Available...Stopping Macro playback.")
        Exit Sub
    End If
	
    Dim IE as Object

    Set IE = CreateObject("InternetExplorer.Application")  
        With IE
            .AddressBar = False
            .StatusBar = True
            .MenuBar = False
            .Toolbar = 0
            .Visible = True
            .Navigate "[URL unfurl="true"]http://www.google.com/"[/URL]        
        End With
        While IE.Busy
        'Do Nothing
    
    
    Wend
        While IE.Document.ReadyState <> "complete"
        'AgaIn Do Nothing
        Wend
        ExtraInfo =  Sess.Screen.GetString(1, 2,4)
        IE.Document.Forms.f.q.value = ExtraInfo
        IE.Document.Forms.f.submit
        Set IE = Nothing

End Sub
 
I use this
[]
Dim objIE As Object, i As Integer

Set objIE = CreateObject("InternetExplorer.Application")

With objIE
.Visible = True
.Navigate "

End With

Call Wait(objIE)


objIE.Document.All("q").Value = Sess0.Screen.GetString(11,14,40)
objIE.Document.All("btnG").Click


Call Wait(objIE)
End Sub

Private Sub Wait(objIE As Object)
While objIE.Busy
DoEvents
Wend

While objIE.Document.ReadyState <> "complete"
DoEvents
Wend
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top