Jump to content

find specific piece of link in web page

Recommended Posts

Hi everyone, hope you are doing fine :)

Well, I'm currently writing a small script that goes to a certain web page, finds the first link of a specified section and download the file associated to this link.

Depending on the computer that the tool is launched, the script gets the computer model and search in the (provided here) ini file which link to follow.

At first, Dell was kind enough to provide only one link but now, they provide two of them. The first one is now a .txt file ( :( ) whereas my script has been designed to download only the fist and latest link released for the BIOS Update.


Here's the current code which is working with only the first and latest link of the BIOS category:

#include <String.au3>
#include <Array.au3>
#include <Date.au3>
#include <InetConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <WinAPISys.au3>
#include <TrayConstants.au3>
#include <ProgressConstants.au3>
#include <ScreenCapture.au3>
#include <StaticConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
#include <File.au3>
#Include <FontConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <GuiListView.au3>
#include <GuiMenu.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <ColorConstants.au3>
#include <ComboConstants.au3>
#include <ListBoxConstants.au3>
#include <AD.au3>
#Include <EditConstants.au3>
#include <WinAPISys.au3>
#include <IE.au3>

;Script Options
Opt("GUIOnEventMode", 1)

;Variable and path declaration / Creation
Global  $a2LinksBIOS, $sModel, $sLinksBIOS, $sBIOSName, $sIniPath, $aSectionsNames, $sURL, $g_DownloadProgress

DirCreate ("C:\SAC_IS\SEE_BIOS_AUTO_UPDATE\Resources\")
FileCopy ("\\xxx\euc_scripts\Resources\SEE.ico", "C:\SAC_IS\SEE_BIOS_AUTO_UPDATE\Resources\SEE.ico", 1)
FileCopy ("\\xxx\euc_scripts\Resources\SAClogo.jpg", "C:\SAC_IS\SEE_BIOS_AUTO_UPDATE\Resources\SAClogo.jpg", 1)
FileCopy ("\\xxx\euc_scripts\Resources\SEE_BIOS_LINKS.ini", "C:\SAC_IS\SEE_BIOS_AUTO_UPDATE\Resources\SEE_BIOS_LINKS.ini", 1)
$sImages = "C:\SAC_IS\SEE_BIOS_AUTO_UPDATE\Resources\"

;Model recognition
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
   $sModel = $objItem.Name
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ComputerSystemProduct" )


While 1

Func f_BatteryCheck()
   $aData = _WinAPI_GetSystemPowerStatus() ;Collect current power status
   If @error Then Return
   If BitAND($aData[1], 8) Then $aData[1] = "Charging"
   If BitAND($aData[1], 128) Then $aData[0] = "Not present"
   If  $aData[0] = "No Power Source" Then ;If not connect to power, display error message
      Msgbox (16, "No Power", "The Laptop must be connected to Power Source!" & @CRLF & "Plug the Laptop to a Power Supply and then relaunch this Tool." & @CRLF & @CRLF & "Program will now exit...")

Func f_INI()
    $idMsgBox = MsgBox (49, "Attention required", "This tool will automatically download and install the BIOS for this computer." & @CRLF & @CRLF & "This proccess cannot be undone and the computer will be automatically rebooted" & @CRLF & @CRLF & "Click the OK button to go on" & @CRLF & @CRLF & "Click the CANCEL button to save any work in progress. You will have to launch the tool again")
    If $idMsgBox = 2 then Exit
    ;Ini file reading and BIOS download link generation
    $aSectionsNames = IniReadSectionNames ($sInipath) ;Reading all sections in the .ini file
    If Not @Error Then ;If reading was fine
        Local $iPosInArray = _ArraySearch ($aSectionsNames, $sModel) ;Searching for the model in the .ini file
    If @Error  Then ;If model not found
        MsgBox(16, "MODEL DOES NOT MATCH", "The BIOS cannot be downloaded for the " & $sModel & " model!" & @CRLF & @CRLF & "Please contact Enterprise Computing to add it." & @CRLF & @CRLF & "Program will now exit!" & @CRLF & @CRLF & "Error Code: 6 - Model was not found in array") ;Error Message
        Exit ;Program exits
    Else ;If Model found
        If $sModel = "Latitude E7250" Then f_E7250BIOS()
        ; If $sModel = "Latitude 5480" Then f_5480BIOS()
        $sURL = IniRead ($sInipath, $aSectionsNames[$iPosInArray], "URL", "Not found") ;Collecting the download URL in a variable
        $oIE = _IECreate($sURL, 0, 1, 0) ;Creating the URL in an Internet Explorer Object
        Do ;Getting Rid of the Security Popup
        $hWin = WinGetHandle("Security Alert")
        If Not @error Then
        Until _IELoadWait($oIE, 0, 100) ;Waiting for the page to be loaded
        _IEQuit($oIE ) ;Closing IE Object
        $sRead = InetRead($sURL) ;Reading the URL
        $aDataBIOS = _StringBetween(BinaryToString($sRead), 'Type: BIOS', 'Category: ') ;Putting data in an array among the BIOS category
        $aLinksBIOS = _StringBetween($aDataBIOS[0], '<TR><TD>', '</TD></TR>') ;Putting data in an array from page source code
        $slinksBIOS = ""
        DirCreate ("C:\Drivers\" & $sModel) ;Creating the download destination folder
        For $i = 0 To UBound($aLinksBIOS) - 1
        If StringInStr($aLinksBIOS[$i], "System BIOS") Then ;Looking in the array the the specified string
            $a2LinksBIOS = _StringBetween($aLinksBIOS[$i], '<A HREF="/', '"><IMG')
            $sLinksBIOS = 'http://downloads.dell.com/' & $a2LinksBIOS[0] ;Creating the BIOS download link
            $sBIOSName = _StringBetween ($a2LinksBIOS[0], "1/", "", $STR_ENDNOTSTART) ;Getting the proper BIOS name

;BIOS Download function
Func f_BIOSDownload()
   $s_Totalsize = 0
   $g_DownloadProgress = GUICreate($sModel & " BIOS", 350, 300) ;Creating the GUI
   GUISetBkColor ($Color_White) ;Setting GUI backgroung color to "White"
   GUISetIcon ($sImages & "\SEE.ico") ;Setting the GUI icon
   GUICtrlCreatePic ($sImages & "\SAClogo.jpg", 80, 27, 183, 59) ;Setting a picture in the GUI
   $label1 = GUICtrlCreateLabel ("Downloading the " & $sModel & " latest BIOS", 10, 120, 290, 20) ;Creating first label
   $Label2 = GUICtrlCreateLabel ("", 10, 210, 200, 20) ;Creating an empty label for %age
   $Label3 = GUICtrlCreateLabel ("Filename is: " & ">>> " & $sBIOSName[0] & " <<<", 10, 150, 290, 20)
   $Progress1 = GUICtrlCreateProgress (10, 170, 330, 20) ;Creating the Progress Bar
   $idCancelBtn = GuiCtrlCreateButton ("Cancel Download and Exit Program", 80, 240, 200, 50) ;Creating the "Locate BIOS" button
   GUICtrlSetOnEvent ($idCancelBtn, "_exit")
   GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
   GUISetState() ;Displaying the BIOS download GUI.
   $url= $sLinksBIOS
   $dir= "C:\Drivers\" & $sModel & "\" & $sBIOSName[0]
   $download = InetGet($url, $dir, 1, 1) ;Downloading the BIOS
   While Not InetGetInfo($download, 2)
      $mbGot = Round(InetGetInfo($download, 0) / 1048576, 2) ;Getting the BIOS size in MB
      If $mbGot > 0 Then
         If $s_Totalsize = 0 Then
            $s_Totalsize = Round(InetGetInfo($download, 1) / 1048576, 2)
         $percentage = Round($mbGot / $s_Totalsize * 100) ;Calculating %age left
         GUICtrlSetData($Progress1, $percentage) ;Making the Progress bar progressing
         GUICtrlSetData($label2, $mbGot & " MB out of " & $s_Totalsize & " MB --> " & $percentage & " %") ;Displaying MB left to download
         If $percentage >= 100 Then
            Sleep (1000)

Func f_E7250BIOS()
$oIE = _IECreate("http://downloads.dell.com/published/pages/latitude-e7250-ultrabook.html", 0, 0, 1, 0)
    _IEQuit ( $oIE )
    $sRead = InetRead('http://downloads.dell.com/published/pages/latitude-e7250-ultrabook.html')
    $aDataBIOS = _StringBetween(BinaryToString($sRead), 'Type: BIOS', 'Category: ')
    $aLinksBIOS = _StringBetween($aDataBIOS[0], '<TR><TD>', '</TD></TR>')
    $slinksBIOS = ""
    DirCreate ("C:\Drivers\E7250")
    For $i = 0 To UBound($aLinksBIOS) - 1
        If StringInStr($aLinksBIOS[$i], "E7250 System BIOS") Then
            $a2LinksBIOS = _StringBetween($aLinksBIOS[$i], '<A HREF="/', '"><IMG')
            $sLinksBIOS = 'http://downloads.dell.com/' & $a2LinksBIOS[0]
            $sBIOSName = _StringBetween ($a2LinksBIOS[0], "1/", "", $STR_ENDNOTSTART)

;Execute Function
Func f_Execute()
   GUISetState (@SW_HIDE, $g_DownloadProgress)
   Local Const $sFilePath = "C:\Drivers\" & $sModel & "\" & $sBIOSName[0]
   Run(@Comspec & " /c" & FileGetShortName($sFilePath), "", @SW_HIDE)
   WinWaitActive ("BIOS Update Program")

;Exit Function
Func _exit()


So the question is: 

In the case of double links like shown in the picture above, how it is possible to tell the script to download only the link containing an the .exe file?

Of course, I could have changed the array result to [1] instead of [0] [which is working] but it seems that Dell does that randomly and that I deal with a lot of computer models.

Thanks for the help you can provide, 




Edited by 31290
removed server names

~~~ Doom Shall Never Die, Only The Players ~~~

Share this post

Link to post
Share on other sites

You should be able to do this with the standard IE UDF commands. Here's an example --

#include <ie.au3>


Func Example()
    Local $oIE = _IECreate("http://downloads.dell.com/published/pages/latitude-12-5280-laptop.html", 1)
    Local $oDiv = _IEGetObjById($oIE, "Drivers-Category.BI")
    Local $oTable = _IETagNameGetCollection($oDiv, "Table", 0)
    Local $oRow = _IETagNameGetCollection($oTable, "TR", 1)
    Local $oCell = _IETagNameGetCollection($oRow, "TD", 5)

    Local $oLinks = _IETagNameGetCollection($oCell, "A")

    ConsoleWrite("Found " & $oLinks.length & " links!" & @CRLF)

    For $oLink In $oLinks
        ConsoleWrite($oLink.href & @CRLF)
EndFunc   ;==>Example


Share this post

Link to post
Share on other sites

Hi all, 

Thanks a lot for your inputs :)

To check whether this is a .exe ending link or not, I've simply added 


For $oLink In $oLinks
      If StringInStr($oLink.href, ".exe") Then
         ConsoleWrite("Debug: Match!  " & $oLink.href & @LF)
  ;~    Else
  ;~     Do other stuff

But, taking my InetGet from what was working in my first post code, this is now not working anymore.

$download = InetGet('$oLink.href', $dir, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ;Downloading the BIOS

Do I have to somehow transform the "$oLink.href" variable to something else (string or so?) to make that work?

Edited by 31290

~~~ Doom Shall Never Die, Only The Players ~~~

Share this post

Link to post
Share on other sites
10 minutes ago, Danp2 said:

@31290 Remove the quotes around '$oLink.href' and your InetGet should work. :)


Yes, this is true, no need to add the quotes, my bad :)
How could I have missed that.

Many thanks for your help, all of you!


~~~ Doom Shall Never Die, Only The Players ~~~

Share this post

Link to post
Share on other sites

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

  • Similar Content

    • By robertcollier4
      Choose a directory of link files to replace substring paths.
      Also gives you a full display (text) of your LNK files.

      #include <Array.au3> #include <_RecFileListToArray.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #Include <GUIEdit.au3> Local $dirToSearchDefault = @ProgramsCommonDir ; Local $dirToSearchDefault = "D:\testdir" Local $dirToSearch = InputBox("Select directory", "In which directory are your LNK files?", $dirToSearchDefault, "", 520, 320) If $dirToSearch = "" Then Exit EndIf Local $listFiles = _RecFileListToArray($dirToSearchDefault, "*", 1, 1, 0, 2) If (Not IsArray($listFiles)) and (@Error=1) Then MsgBox (0,"","No files found in search path, exiting") Exit EndIf ;--------------------------------------------------------------- ;Displaying list of Link LNK in GUI Editbox Local $ThisTodisplayList = "LNK Files Found In: " & $dirToSearch & @CRLF & @CRLF $ThisTodisplayList &= "========================" & @CRLF Local $ThisTodisplayDrive = "", $ThisTodisplayDir = "", $ThisTodisplayFilename = "", $ThisTodisplayExtension = "" For $i = 1 To $listFiles[0] Local $listFilesPathSplit = _PathSplit($listFiles[$i], $ThisTodisplayDrive, $ThisTodisplayDir, $ThisTodisplayFilename, $ThisTodisplayExtension) If(StringCompare(".lnk", $ThisTodisplayExtension, 2) == 0) Then ;Local $ThisTodisplayLNK = f$listFiles[$i] Local $thisToDisplayLNKArray = FileGetShortcut($listFiles[$i]) If(NOT @error) Then If($thisToDisplayLNKArray[0] <> "") Then ;_ArrayDisplay($thisToDisplayLNKArray) ;$ThisTodisplayLNKtarget = $thisToDisplayLNKArray[0] ;$ThisTodisplayLNKargs = $thisToDisplayLNKArray[2] ;$ThisTodisplayLNKworkingdir = $thisToDisplayLNKArray[1] $ThisTodisplayList &= "LNK: " & $ThisTodisplayDrive & $ThisTodisplayDir & $ThisTodisplayFilename & $ThisTodisplayExtension & @CRLF $ThisTodisplayList &= "Target: " & $thisToDisplayLNKArray[0] & " " & $thisToDisplayLNKArray[2] & @CRLF $ThisTodisplayList &= "Workingdir:" & $thisToDisplayLNKArray[1] & @CRLF $ThisTodisplayList &= @CRLF $ThisTodisplayList &= "========================" & @CRLF EndIf EndIf EndIf Next ; _ArrayDisplay($listFiles, "$aFileList") $GuiTodisplay = GUICreate("Summary of LNK Files Found In: " & $dirToSearch, 1152, 864) ; Local $idTreeview = GUICtrlCreateTreeView(6, 6, 1152, 1046, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $hEdit = GUICtrlCreateEdit($ThisTodisplayList, 4, 4, 1144, 772, BitOr($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) $hButtonContinue = GUICtrlCreateButton("Continue", 4, 776, 1144, 80) GUICtrlSetState($hButtonContinue ,$GUI_DEFBUTTON) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GuiDelete($GuiTodisplay) ExitLoop Case $hButtonContinue GuiDelete($GuiTodisplay) ExitLoop EndSwitch WEnd ;Displaying list of Link LNK in GUI Editbox ;--------------------------------------------------------------- $modalSimulMode = MsgBox (3, "Simulated mode?" ,"Would you like to perform this substring replacement of link files in simulated mode? In simulated mode you will see what would have happened in a file named" & @CRLF & "LNKSubstringReplacer Results.txt" & @CRLF & @CRLF & "but no changes will be made" & @CRLF & @CRLF & "Yes - simulated mode, no changes will be made" & @CRLF & "No - resaving mode, changes will be made") If $modalSimulMode = 2 Then Exit ElseIf $modalSimulMode = 6 Then $saveAgain = False ElseIf $modalSimulMode = 7 Then $saveAgain = True ElseIf MsgBox(0, "ERROR", "Error with asking simulated mode, exiting") EndIf Local $StrToSearch = InputBox("Specify substring to search for", "What substring would you like to be replaced for link target and link working directory?", "", "", 520, 320) ; If $StrToSearch = "" Then ; allow empty input in case just want to resave and fix all links If @error = 1 Then Exit EndIf Local $StrToReplace = InputBox("Specify substring to replace with", "All occurrences of" & @CRLF & $StrToSearch & @CRLF & @CRLF & "Contained in links in the directory " & @CRLF & $dirToSearch & @CRLF & @CRLF & "Should be replaced with what?", $StrToSearch, "", 520, 320) ; If $StrToSearch = "" Then ; allow empty input in case just want to resave and fix all links If @error = 1 Then Exit EndIf ; Processing ; Write simulated results to a text file $dateNow = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & @MIN & @SEC $fileLnkPath = @ScriptDir & "\" & $dateNow & " LNKSubstringReplacer Results.txt" FileDelete($fileLnkPath) Local $fileTextList = FileOpen($fileLnkPath, $FO_APPEND) If $fileTextList = -1 Then MsgBox(0, $fileLnkPath, "FileOpen Error, exiting") Exit EndIf FileWrite($fileTextList, "---------------------------------------" & @CRLF) FileWrite($fileTextList, "Link file to scan" & @CRLF) FileWrite($fileTextList, "Link target" & @CRLF) FileWrite($fileTextList, "Link working directory" & @CRLF) Local $thisExtension = "" Local $sDrive = "", $sDir = "", $ThisTodisplayLNKFilename = "" For $i = 1 To $listFiles[0] ; Only do LNK extension Local $listFilesPathSplit = _PathSplit($listFiles[$i], $sDrive, $sDir, $ThisTodisplayLNKFilename, $thisExtension) ; MsgBox(0, $i, $listFiles[$i] & " , " & $thisExtension) If(StringCompare(".lnk", $thisExtension, 2) == 0) Then ; If(NOT StringCompare(".lnk", $thisExtension, 2)) Then Local $thislnkArray = FileGetShortcut($listFiles[$i]) If(NOT @error) Then If($thislnkArray[0] <> "") Then ; _ArrayDisplay($lnkArray) If( StringInStr($thislnkArray[0], $StrToSearch) Or StringInStr($thislnkArray[2], $StrToSearch) Or StringInStr($thislnkArray[1], $StrToSearch) ) Then FileWrite($fileTextList, @CRLF & "---------------------------------------" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) ; FileWrite($fileTextList, $thislnkArray[0] & @CRLF) ; FileWrite($fileTextList, $thislnkArray[2] & @CRLF) FileWrite($fileTextList, $thislnkArray[0] & $thislnkArray[2] & @CRLF) FileWrite($fileTextList, $thislnkArray[1] & @CRLF) ; Allow empty $StrToSearch or empty $strToReplace just to fix and resave all links If( ($StrToSearch = "") OR ($StrToReplace = "") ) Then $newLinkTarget = RemoveSurrQuotes($thislnkArray[0]) $newLinkTargetArgs = $thislnkArray[2] $newLinkWorkingDir = RemoveSurrQuotes($thislnkArray[1]) Else $newLinkTarget = RemoveSurrQuotes(StringReplace($thislnkArray[0], $StrToSearch, $StrToReplace)) $newLinkTargetArgs = StringReplace($thislnkArray[2], $StrToSearch, $StrToReplace) $newLinkWorkingDir = RemoveSurrQuotes(StringReplace($thislnkArray[1], $StrToSearch, $StrToReplace)) EndIf ; Remove ending backslash from working dir While (StringRight($newLinkWorkingDir, 1) = "\") $newLinkWorkingDir = StringTrimRight($newLinkWorkingDir, 1) WEnd If($saveAgain) Then FileWrite($fileTextList, @CRLF & "found " & @CRLF & "Resaved:" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) FileWrite($fileTextList, $newLinkTarget & " " & $newLinkTargetArgs & @CRLF) FileWrite($fileTextList, $newLinkWorkingDir & @CRLF) $saveResult = FileCreateShortcut( _ $newLinkTarget, _ $listFiles[$i], _ $newLinkWorkingDir, _ $newLinkTargetArgs, _ $thislnkArray[3], _ $thislnkArray[4], _ "", _ $thislnkArray[5], _ $thislnkArray[6] _ ) If(NOT $saveResult) Then FileWrite($fileTextList, "ERROR Unable to resave: " & $listFiles[$i] & @CRLF) EndIf Else FileWrite($fileTextList, @CRLF & "found " & @CRLF & "Simulated Resave:" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) FileWrite($fileTextList, $newLinkTarget & " " & $newLinkTargetArgs & @CRLF) FileWrite($fileTextList, $newLinkWorkingDir & @CRLF) EndIf EndIf Else FileWrite($fileTextList, @CRLF & "---------------------------------------" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) FileWrite($fileTextList, "Found empty link target, skipping " & @CRLF) EndIf Else FileWrite($fileTextList, @CRLF & "---------------------------------------" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) FileWrite($fileTextList, "FileGetShortcut Error, skipping " & @CRLF) Exit EndIf ;Else ; FileWrite($fileTextList, @CRLF & "---------------------------------------" & @CRLF) ; FileWrite($fileTextList, $listFiles[$i] & @CRLF) ; FileWrite($fileTextList, "Skipping not a link file" & @CRLF) EndIf Next FileClose($fileTextList) MsgBox (64,"Done - Check Log for details","Done - Check Log for details of what was done:" & @CRLF & @CRLF & $fileLnkPath) ;--------------------------------------------------------------- Func RemoveSurrQuotes($myString) Return StringReplace($myString, '"', '') EndFunc ;---------------------------------------  
      LNKSubstringReplacer.au3 _RecFileListToArray.au3
    • By Blueman
      Hi all,
      I was wondering if you can help me with the function called; InetRead().
      My scripts are using this function a lot for several conditions and everything works fine!
      But sometimes when the server is a little bit buggy of simply not available my script is hanging.
      It takes about 90sec before this function returns a Timeout, when i adjust the parameter it still is hanging about 90sec.
      The following script is a example where the script is hanging for aprox. 90sec;
      ; Set Timeout to 2sec AutoItSetOption ("TCPTimeout", 2000) ; Read Website InetRead("http://www.geenverbinding.nl/",1) ; Show Msgbox before Ending Script. Msgbox(64,"","Finished")  
      The following script is a example where the script show the Msgbox pretty fast;

      ; Set Timeout to 2sec AutoItSetOption ("TCPTimeout", 2000) ; Read Website InetRead("http://www.google.nl/",1) ; Show Msgbox before Ending Script. Msgbox(64,"","Finished")  
      My question now is, what am i doing wrong and/or is there a other way to prevent Hanging the script?
      Thanks all
    • By Robdog1955
      I'm trying to click a button on a web page. I have added a couple of MsgBox lines to allow me to watch what happens on the page. As you can see the first half of my script enters data into text boxes on the page. I have no problem there. I just cannot click on the region buttons. The "set focus" line causes an outline to appear around the EU button and the "click button" line causes the "Pick a Region" text to disappear. Here is the code I have so far.
      #include <IE.au3> Local $oIE = _IECreate("http://questchecker.com/") Local $iQuestID = "123456" Local $sCharacterName = "CharacterName" Local $colForms = _IEFormGetCollection($oIE) $iCount = 0 For $oForm In $colForms $oFormElements = _IEFormElementGetCollection($oForm) For $oFormElement In $oFormElements $iCount = $iCount + 1 Local $sTagName = StringLower($oFormElement.tagName) Local $sElementType = $oFormElement.type Local $sElementName = $oFormElement.name Switch $iCount Case 6 _IEFormElementSetValue($oFormElement, "MyRealm", 0) ; realm Case 7 _IEFormElementSetValue($oFormElement, $sCharacterName, 0) Case 8 _IEFormElementSetValue($oFormElement, $iQuestID, 0) EndSwitch Next Next Local $oButtons = _IEGetObjByName($oIE, "questForm") For $oButton In $oButtons If _IEFormElementGetValue($oButton) = "US" Then MsgBox(0, "", "Click Okay to set focus") _IEAction($oButton, "focus") MsgBox(0, "", "Click Okay to click button") _IEAction($oButton, "click") ExitLoop EndIf Next MsgBox(0, "", "Click Okay to quit") _IEQuit($oIE) Exit  
    • By zenocon
      Hi, After scouring the forums for many hours, I'm trying to compile the most up to date / recent information on the options available for integrating with JavaScript / DOM -- as it relates to scraping + automation of web pages.
      It's my understanding there is IE.au3 script for automation of IE through a COM interface.  But I believe this only works with IE and won't work with Edge, correct?  Is there a COM interface that works with Edge, or any other options for integrating with Edge (other than IUIAuatomation?)
      I know there was also a FF.au3 UDF, but Mozilla abandoned the support for their mozrepl in favor of Web Extensions, and my understanding is that the FF.au3 UDF no longer works, is that correct?
      There was also a Chrome.au3 UDF, but my read on the forums indicate that this also broke many Chrome releases past.
      Which leaves IUIAutomation which I have been using to automate / scrape Windows apps, but when I am trying it on a website, it is not as useful.  For example, if I know the exact DOM id / class, I can get at it and do whatever I need to in JavaScript very simply.  With IUIAutomation, the DOM properties are not available, and most tags / elements in DOM have no useful defining characteristics to be able to get at them reliably (if they are targetable at all).  Some things might be able to be done with IUIAutomation, but I see it's value in targeting website automation / scraping as fairly limited.
      At this point, it seems like my best option is to use IE.au3, but that forces users on IE, which is probably a showstopper.
      Is there another way to bridge into the DOM?  I have written Web Extensions for Chrome and Firefox before.  They can communicate with external processes via AJAX or messaging.  I'm wondering if I can build what I need in a WebExtension and then trigger it from AutoIT Script, and gather up the results somewhere.
      I know there was the ISimpleDOM.au3 and some Microsoft Accessability scripts, but they seem to only be partially supported in browsers, and I didn't have a lot of luck getting those examples to run correctly.
    • By nacerbaaziz
      please i need to link a progress bar with a time can you help me?
      i want to set a progress bar for 10 sec
      am waiting for your answers
      thank you.
  • Create New...