Jump to content

Recommended Posts

Posted

You should read the help file on instances, a real simple example would be:

#include <IE.au3>

;~ This is Instance 1
Local $oIE = _IECreate("https://www.google.com")
_SearchGoogle("Test1", 1)
;~ This is Instance 2
$oIE.Navigate2("https://www.google.com", 0x800)
_SearchGoogle("Test2", 2)
;~ This is Instance 3
$oIE.Navigate2("https://www.google.com", 0x800)
_SearchGoogle("Test3", 3)
;~ This is Instance 4
$oIE.Navigate2("https://www.google.com", 0x800)
_SearchGoogle("Test4", 4)

Func _SearchGoogle($_sSearchValue = "", $_iInstance = 1)
    Sleep(2000) ;~ Wait for page too load, may need to extend depending on your connection
    Local $oIE2 = _IEAttach("https://www.google.com", "url", $_iInstance)
    Local $oForm = _IEFormGetObjByName($oIE2, "f")
    Local $oQuery = _IEFormElementGetObjByName($oForm, "q")
    _IEFormElementSetValue($oQuery, $_sSearchValue)
    _IEFormSubmit($oForm)
EndFunc

 

Posted (edited)
12 hours ago, Subz said:

You should read the help file on instances, a real simple example would be:

#include <IE.au3>

;~ This is Instance 1
Local $oIE = _IECreate("https://www.google.com")
_SearchGoogle("Test1", 1)
;~ This is Instance 2
$oIE.Navigate2("https://www.google.com", 0x800)
_SearchGoogle("Test2", 2)
;~ This is Instance 3
$oIE.Navigate2("https://www.google.com", 0x800)
_SearchGoogle("Test3", 3)
;~ This is Instance 4
$oIE.Navigate2("https://www.google.com", 0x800)
_SearchGoogle("Test4", 4)

Func _SearchGoogle($_sSearchValue = "", $_iInstance = 1)
    Sleep(2000) ;~ Wait for page too load, may need to extend depending on your connection
    Local $oIE2 = _IEAttach("https://www.google.com", "url", $_iInstance)
    Local $oForm = _IEFormGetObjByName($oIE2, "f")
    Local $oQuery = _IEFormElementGetObjByName($oForm, "q")
    _IEFormElementSetValue($oQuery, $_sSearchValue)
    _IEFormSubmit($oForm)
EndFunc

 

@Subz Thanks, but it was not search anything. and Can be used _ieloadwait instead of sleep?

Edited by iamtech
Posted

It works fine for me, so the issue will probably be something to do with the form id and the search input id, you'll need to enter those ids from looking at the source code on your system, the reason it's different I suspect is due to regional differences.  With regards to _IELoadWait, you can try it, it didn't work for me which is why I used the sleep function, you'll find that some sites _IELoadWait will work others, it won't so its better to go with something that works on both.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...