Jump to content

Recommended Posts

Posted

Yes Jos, Thanks for your response & really forget that some people only win by comments. :) Cheers

I generated my thread in details (snapshot also shared / some of code also) with hope to be guided with right way to script but it seems that i need to figure the solution at my own.

Thanks for pointing out _IELinkClickByText or _IELinkClickByIndex or _IETagNameGetCollection but didn't worked for my case.

  • Developers
Posted
29 minutes ago, Imranimi said:

Thanks for your response & really forget that some people only win by comments.

That is not really what I meant as I do believe he was trying to help you but the communication wasn't smooth from either side.

... moving on.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

 

@Nine Please, can you help me that what i am doing mistake in the following code: (I am new to scripting) Thanks :)

 

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


if $IE = _IE_Example("http://repl.flexlink.com/os/products.htm?clicktype=A") Then
    _IELinkClickByIndex($IE, 2)

    Send("+{F10}")
    Send("{down 1}")

    Sleep(1000)
    Send("{Enter}")

ElseIf _IELinkClickByIndex($IE, 2) Then

    Send("+{F10}")
    Send("{down 1}")

    Send("{Enter}")

    Send("{TAB}")
Else
    Send("{TAB}")
    Send("+{F10}")
    Send("{down 1}")

     Send("{Enter}")

EndIf

Posted
#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IE_Create ("http://repl.flexlink.com/os/products.htm?clicktype=A")
Local $oInputs = _IETagNameGetCollection($oIE, "a")
Local $sTxt = ""
For $oInput In $oInputs
    $sTxt &= $oInput.innerText & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Tag A", $sTxt)

_IEQuit($oIE)

To start you.  It should display all the products. $oInput are objects in the collection.  You can do whatever you want with object.

Posted

@Nine, Thanks for your prompt reply, i am trying with the following code but its not working, can you rectify that what i am doing wrong.


Local $oIE = _IE_Create ("http://repl.flexlink.com/os/products.htm?clicktype=A")
If Local $oInputs = _IETagNameGetCollection($oIE, "More information") Then
Local $sTxt = ""
$oInput In $oInputs
    $sTxt &= $oInput.innerText & @CRLF

    ;Hot-Key to Mouse Right-Click from Keyboard
    Send("+{F10}")
    Sleep(1000)

    ; Scroll down 2 time
    Send("{down 1}")

    ; select the option
    Sleep(1000)
    Send("{Enter}")

Posted

After giving control to hypertext by pressing TAB, i need to detect/read hypertext and then open it in new-tab.

Please note that Autoit-Help has supported me too much in my previous script but for this script i need to be more specific.

This one is not working for me :(

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IE_Example("form")
Local $oInputs = _IETagNameGetCollection($oIE, "input")
Local $sTxt = ""
For $oInput In $oInputs
    $sTxt &= $oInput.type & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Form Input Type", "Form: " & $oInput.form.name & @CRLF & @CRLF & "         Types :" & @CRLF & $sTxt)

_IEQuit($oIE)
Posted

@Imranimi here an example of how to create a new tab :

#include <IE.au3>

Opt ("MustDeclareVars", 1)

Global Const $ie_new_in_tab = 0x0800

Local $oIE1 = _IECreate ("www.autoitscript.com/forum")

Local $oInputs = _IETagNameGetCollection($oIE1, "a")
For $oInput In $oInputs
  if $oInput.innerText = "AutoIt Help and Support" then ; it can be title or some other reference...
    Local $oIELink = $oInput
    ExitLoop
  endif
Next

MsgBox($MB_SYSTEMMODAL, "Tag A", $oIELink.href)
Local $oIE2 = _IECreateTab ($oIE1, $oIELink.href)

Func _IECreateTab (ByRef $oIE, $url)
Local $Count = 0, $oIE2

  $oIE.Navigate ($url, $ie_new_in_tab)

  While 1
    $oIE2 = _IEAttach($url, "url")
    If IsObj($oIE2) Then ExitLoop
    $Count += 1
    if $Count > 100 then Exit MsgBox (0,"Error","Load expired")
    Sleep (50)
  WEND

  _IELoadWait ($oIE2, 300)
  return $oIE2

EndFunc

 

Posted
On 2/7/2019 at 5:15 PM, Nine said:
#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IE_Create ("http://repl.flexlink.com/os/products.htm?clicktype=A")
Local $oInputs = _IETagNameGetCollection($oIE, "a")
Local $sTxt = ""
For $oInput In $oInputs
    $sTxt &= $oInput.innerText & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Tag A", $sTxt)

_IEQuit($oIE)

To start you.  It should display all the products. $oInput are objects in the collection.  You can do whatever you want with object.

 

16 hours ago, Nine said:

@Imranimi here an example of how to create a new tab :

#include <IE.au3>

Opt ("MustDeclareVars", 1)

Global Const $ie_new_in_tab = 0x0800

Local $oIE1 = _IECreate ("www.autoitscript.com/forum")

Local $oInputs = _IETagNameGetCollection($oIE1, "a")
For $oInput In $oInputs
  if $oInput.innerText = "AutoIt Help and Support" then ; it can be title or some other reference...
    Local $oIELink = $oInput
    ExitLoop
  endif
Next

MsgBox($MB_SYSTEMMODAL, "Tag A", $oIELink.href)
Local $oIE2 = _IECreateTab ($oIE1, $oIELink.href)

Func _IECreateTab (ByRef $oIE, $url)
Local $Count = 0, $oIE2

  $oIE.Navigate ($url, $ie_new_in_tab)

  While 1
    $oIE2 = _IEAttach($url, "url")
    If IsObj($oIE2) Then ExitLoop
    $Count += 1
    if $Count > 100 then Exit MsgBox (0,"Error","Load expired")
    Sleep (50)
  WEND

  _IELoadWait ($oIE2, 300)
  return $oIE2

EndFunc

 

Waow, Bundle of thanks for solving my issue to detect the href & give action. (Really Thanks as i was struck to this from last few days), i am totally new to Autoit & unaware of proper functions & i appreciate your patience & replies.

Posted (edited)

@Nine, really bundles of thanks, i have done my task because of your help.

One question please, how can we inspect the below source-code of image & then send our required command, same which you have done before with the href.

 

<img style="vertical-align: middle;" src="images/information38.png">

 

 

image.png

Edited by Imranimi
wrong posted
Posted
5 hours ago, Imranimi said:

how can we inspect the below source-code of image & then send our required command

I am not sure what you mean.  But I doubt that it would the way to do it, image don't tell much.  I think my first code I gave you is more in line with what you want to do...where product name and code number are easier to manage.

Posted

@Nine Thanks, I am getting the href link to display message but i need to open that hypertext in new tab as there are hundreds them on that site & by completing one process on the newly opened tab it will close & need to open the next hypertext which are in sequence. My target is that sending 3-TABS are working fine till limited number but in some cases 2 or 4 tabs are required so its difficult to figure the exact TABS as there are 450+ Products/hypertext.

So my main target is that when a tab send it should examine the control after sending TAB if its hypertext if yes then open in new-tab otherwise send TAB key until unless it will find the next hypertext in the sequence.

Kindly note that the hypertext is obviously changing on every product (its normal) so for specific product it is possible but how can i do it for the list of different href.

image.png.60e668e654cc1d5a0603e104df464e5b.png

Please note that TITLE is same in all products on mouse-over or control.

#include <IE.au3>
#include <Excel.au3>

Global $oExcel = _Excel_Open()
Global $oWorkbook = _Excel_BookOpen($oExcel, "C:\Users\Admin\Desktop\Chains&Accessories.xlsx")

Sleep(3000)

; open Flexlink Website in Internet Explorer
$oIE1 = _IECreate("http://repl.flexlink.com/os/producttypes.htm")
Sleep(3000)

;send WIN+LEFT keystroke
Send("#{LEFT}", 0)
;Send("{enter}")


; To Shift from Excelsheet IE
Sleep(500)
Send("{Alt down}")
Sleep(500)
Send("{TAB}")
Sleep(500)
Send("{Alt up}")
; All the settings are at Zoom-Level = 75% of browser
Sleep(3000)
;Click on "Chains & Accessories"
MouseClick("left", 160, 221, 1)

Sleep(4000)
;Right-Click on "Product NAme" in & select Open in New-Tab
MouseClick("right", 185, 290, 1)
Sleep(500)
Send("{down 2}")
Sleep(500)
Send("{Enter}")

; Switch to New Opened Tab in IE
Sleep(1000)
Send("^{TAB}")

; --------------- Initial Steps to create the play-ground -----------------------------

For $count = 1 To 456     ; Loop for 456 Times

    Sleep(1500)
    ; Select the text area of Product-Name to use in Image-Name
    MouseClickDrag("left", 256, 307, 392, 307)
    Sleep(500)
    Send("^c")
    Sleep(1000)


    ; Select the text area of Product-Name to use in Image-Name
    MouseClickDrag("left", 256, 332, 402, 332)
    Sleep(1500)
    Send("^c")
    Send("^c")

    Sleep(12000)
    ;RightClick on "Product-Pic"
    MouseClick("right", 133, 277, 1)

    Sleep(1000)
    ;Select "Save Image As..."
    Sleep(1000)
    Send("{down 7}")
    Sleep(1000)
    Send("{Enter}")

    ;Paste the Product-Name copied in Clipboard
    $title = WinGetTitle("Save As")
    Sleep(2000)
    Send("^v")
    Send("-2")
    Sleep(2000)
    ; To click Save Button on messagebox
    $title = WinGetTitle("Save As")
    $handle = WinGetHandle($title)
    ControlClick($title, "", "Button")
    Send("{Enter}")

    Sleep(2000)
    ;To Save Second Picture
    MouseClick("right", 350, 276, 1)
    Sleep(1000)
    ;Select 2nd "Save Image As..."
    Sleep(500)
    Send("{down 7}")
    Sleep(500)
    Send("{Enter}")
    Sleep(2000)

    ; To click Save Button on messagebox - 2nd Image
    $title = WinGetTitle("Save As")
    $handle = WinGetHandle($title)
    Sleep(1000)
    Send("^v")
    Sleep(1000)
    ;Paste the Product-Name copied in Clipboard
    ControlClick($title, "", "Button")
    Send("{Enter}")


    Sleep(2000)    ; Select the text area of Product-Description
    MouseClickDrag("left", 133, 357, 504, 433)
    ;Copy
    Send("^c")

    ; To Shift from IE      to Excelsheet
    Sleep(2000)
    Send("{Alt down}")
    Sleep(500)
    Send("{TAB}")
    Sleep(500)
    Send("{Alt up}")
    Sleep(1000)

    ; Paste the Product Description to Excelsheet -- Copied from Chrome
    Sleep(3000)
    Send("^v")

    ; Save the Pasted Data the Selected data from webpage
    Sleep(2000)
    Send("^s")


    ; Press Down-Arrow Key 10-Times
    Sleep(3000)
    Send("{down 10}")

    ; To Shift from Excelsheet to Chrome Window
    Sleep(3000)
    Send("{Alt down}")
    Sleep(500)
    Send("{TAB}")
    Sleep(500)
    Send("{Alt up}")

    Sleep(2000)
    ; Close the Current-Tab
    Send("^w")


    Do
        Send("{tab}")

    Local $oInputs = _IETagNameGetCollection($oIE1, "a")
    For $oInput In $oInputs
        If $oInput.innerText = "More Information" Then
            Local $oIELink = $oInput
            ExitLoop
        EndIf
    Next

    Until $oInput = $oInput.innerText


Next


Func Terminate()
    Exit 0

EndFunc   ;==>Terminate

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

The text in BLUE-Color needs some correction, Please do help me out. :)

 

 

  

 

 

 

Posted

@Nine, Code is not working fine, as it is sending TAB key continuously. i am near to close this issue with your help. 

"Please use <> just before emoticon if you post code. "    ------->  Noted :)

 

Posted
Posted (edited)

@Nine, I need to detect the .title of hypertext & then open it in new-tab & complete some process & then again control will search for next hypertext by tab-keys until it find next hypertext with same title.

Below are the exmaple of three hypertext with same title "More Information", i need to open all the three links one by one in new tabs after using tab-keys & detecting the exact hypertext with same title.

 

image.thumb.png.103c798f555877f4c93c32915413628e.png

Edited by Imranimi
Posted
Local $ProductName, $oIE2
Local $oInputs = _IETagNameGetCollection($oIE1, "a")

  For $oInput In $oInputs
    If $oInput.title = "More Information" Then
      Send("{tab}")
      $oIE2 = _IECreateTab ($oIE1, $oInput.href)
      $ProductName = $oInput.innerText
      DoYourStuff ($ProductName)
      _IEQuit ($oIE2)
    Endif
  Next

This is my last attempt.  For now you should be able to complete your work by yourself and with your best friend : the autoit help file.

Posted

<

#include <IE.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>

Global Const $ie_newtab = 0x0800

$oIE1 = _IECreate("http://repl.flexlink.com/os/products.htm?clicktype=A")
Sleep(3000)

Local $oInputs = _IETagNameGetCollection($oIE1, "a")

        For $oInput In $oInputs
            if $oInput.title = "More information" then
                Global $oIELink = $oInput

            ExitLoop
            endif
        Next

    MsgBox($MB_SYSTEMMODAL, "Product Name", $oIELink.href)

    Global $oIE2 = _IECreateTab ($oIE1, $oIELink.href)

    Func _IECreateTab (ByRef $oIE, $url)
        Local $Count = 0, $oIE2
        $oIE.Navigate ($url, $ie_newtab)
        $oIE2 = _IEAttach($url, "url")
        _IELoadWait ($oIE2, 300)
        return $oIE2
    EndFunc

MsgBox($MB_SYSTEMMODAL, "Product Name", $oInput)
Send("^w")

>

@Nine, Thanks for helping me to crack my required script & i will not forget my best friend also in this "Autoit Help" :)

My last requirement is to make the above script in loop (in specific number of times for example 50-times) to open tab for every next "Product" one by one after closing the tab.

Regards & Thanks again for helping me on my every thread. Cheers :)

Posted

<

$oIE1 = _IECreate("http://repl.flexlink.com/os/products.htm?clicktype=A")
Sleep(3000)

Global $oInputs = _IETagNameGetCollection($oIE1, "a")

        For $oInput In $oInputs
            if $oInput.title = "More information" then
                Global $oIELink = $oInput

            ExitLoop
            endif
        Next

    MsgBox($MB_SYSTEMMODAL, "Product Name", $oIELink.href)

    Global $oIE2 = _IECreateTab ($oIE1, $oIELink.href)

    Func _IECreateTab (ByRef $oIE, $url)
        Local $Count = 0, $oIE2
        $oIE.Navigate ($url, $ie_newtab)
        $oIE2 = _IEAttach($url, "url")
        _IELoadWait ($oIE2, 300)
        return $oIE2
    EndFunc


;send WIN+LEFT keystroke
Send("#{LEFT}", 0)
;Send("{enter}")

MsgBox($MB_SYSTEMMODAL, "Chains and Accessories", "Switch to Next Product")

Send("^w")
Sleep(4000)
Func Terminate()
    Exit 0

EndFunc   ;==>Terminate

>

 

 

 

 

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...