#Region - Start #include dim $f,$LinkMessage, $i, $i1 $RegDir = "HKCU\Software\Professional Grade Macros\PGM Functions\Swap" $DirPath = RegRead($RegDir, "DirPath") $ME3InstallDirectory = FileGetLongName($DirPath) $UseSiteForEmpty=1 $UseSiteForEmpty=InputBox("","Leave as 1 if you want Quicker list made, where empty labels are filled with the Web address(url..); zero or other values means 'empty' values are sought from the Websites to which they are linked; ","1") ;$UseSiteForEmpty=1 ;$ObjIE = ObjCreate ("InternetExplorer.Application") ;_IE_connect("http://www.info2you.com.au/cocoon/websms/websms.xml") _IE_connect("http://www.mme.state.va.us/") ;_IE_connect("http://www.autoitscript.com/forum/index.php?act=UserCP&CODE=01") ;_IE_connect("http://login.passport.net/") With $ObjIE .Visible = True ;.Navigate("http://www.mme.state.va.us/") ; .Navigate("http://rclapp.250free.com/") ; .Navigate("http://login.passport.net") ;.Navigate("http://pgmacros.com/community/index.php?s=a60689feb8594984e31e60294fdae97e&showtopic=548") ;.Navigate("http://afl.com.au/") ;.Navigate("http://www.autoitscript.com/forum/index.php?showtopic=12641") ;pgmacros.com -> Best Practice For Using Macros As Subroutines? - Microsoft Internet Explorer While .ReadyState <> 4 Sleep(50) WEnd $Html1=$ObjIE.document.documentelement.outerHTML $sFilePath1=$ME3InstallDirectory&"\Outerhtml.txt" _FileCreate ( $sFilePath1 ) FileOpen($sFilePath1,1 ) FileWrite($sFilePath1,$Html1 ) FileClose($sFilePath1) $sFilePath=$ME3InstallDirectory&"\html2.txt" _FileCreate ( $sFilePath ) FileOpen($sFilePath,1 ) ConsoleWrite(_IE_IsFrameSet($ObjIE) & @CR) FileWrite($sFilePath,_IE_IsFrameSet($ObjIE) & @CRLF ) ConsoleWrite(_IE_NumFrames($ObjIE) & @CR) FileWrite($sFilePath,_IE_NumFrames($ObjIE)& @CRLF ) EndWith if _IE_IsFrameSet($ObjIE) then ; Loop through the frames and show the URL of each For $i = 1 To _IE_NumFrames($ObjIE) $ObjF = _IE_FrameObj($ObjIE, $i - 1) ConsoleWrite("Frame" & $i & " - " & $ObjF.document.location.href & @CR) FileWrite($sFilePath,"Frame" & $i & " - " & $ObjF.document.location.href & @CRLF ) $LengthObj=$ObjF.document.links().length _IE_clickLinkText($ObjF, "Edit", 20) Next Else ;MsgBox(0,"_IE_IsFrameSet($ObjIE)=",_IE_IsFrameSet($ObjIE)) _IE_clickLinkText($ObjIE, "Edit", 20) ;_IE_form("name=UserName", "randallc"); form number optional _IE_frameform($ObjIE,"name=UserName", "randallc"); form number optional ;_IE_formcheckbox("Privacy") endif FileClose($sFilePath) run("notepad.exe "&$ME3InstallDirectory&"\html2") Exit #EndRegion- Start #Region - Function Clicks Func _IE_IsFrameSet($_obj) ; Returns 1 if the object references a FrameSet page, else 0 ; ; Note: this is more reliable test for a FrameSet than checking the ; number of frames (...frames.length) because an iFrame embedded on a normal ; page is included in the frame collection $_t = $_obj.document.body.tagName If $_t = "FRAMESET" Then Return 1 Else Return 0 EndIf EndFunc ;==>_IE_IsFrameSet Func _IE_NumFrames($_obj) ; Returns the number of frames in a FrameSet or the number of iFrames on a normal page Return $_obj.document.parentwindow.frames.length EndFunc ;==>_IE_NumFrames Func _IE_FrameObj($_obj, $_f) ; Returns an object reference to a window within the specified frame (note that frame collection is 0 based) ; This object can be used in the same manner as the InternetExplorer.Application object If IsObj ($_obj.document.parentwindow.frames.item ($_f)) Then Return $_obj.document.parentwindow.frames.item ($_f) Else MsgBox(0,"$_obj.document.parentwindow.frames.item ($_f)",$_obj.document.parentwindow.frames.item ($_f)) Return 0 EndIf EndFunc ;==>_IE_FrameObj Func _IE_clickLinkText($_obj, $_l, $_i = 1) ; _IE_clickLinkText( $_obj, $_l [, $_i]) ; $_obj - Object Valiable pointing to an InternetExplorer.Application object ; $_l - linkText, the text displayed on the web page for the desired link to click ; [$_i] - if the link text occurs more than once, specify which instance you want to click ; note: instance numbering starts at 1 $doc = $_obj.document $links = $doc.links $found = 0 $f = 0 For $link in $links $linkText = $link.outerText & ""; Append empty string to prevent problem with no outerText (image) links $linkText=StringReplace($linkText,@CRLF," " ) $linkText=StringReplace($linkText,",",";" ) $LinkMessage=$f&"|" & $linkText $LinkMessage=$LinkMessage&"|"&$link.href if $linkText="" or $linkText="0" Then $LinkMessage=_IE_clickLinkIndex($_obj, $f) ;$LinkMessage=_IE_clickLinkIndex($ObjIE, $f) EndIf ;$LinkMessage=$LinkMessage&","&$ObjF.document.links.item($f) ConsoleWrite($LinkMessage& @CR) FileWrite($sFilePath,$LinkMessage & @CRLF ) If $linkText = $_l Then $found = $found + 1 if ($found = $_i) Then ;$result = $link.click ;return 1 return $found EndIf ;Else EndIf $f=$f+1 Next return 0 EndFunc ;==>_IE_clickLinkText Func _IE_clickLinkIndex($_obj, $_i) ; _IE_clickLinkText( $_obj, $_i) ; $_obj - Object Valiable pointing to an InternetExplorer.Application object ; $_i - 0 based index of the link number to click $doc1 = $_obj.document if IsObj($doc1.links($_i)) Then $NoName=$doc1.links($_i) Select Case StringInStr($NoName.href,"04&f") $NoName2="Delete" Case StringInStr($NoName.href,"08&f") $NoName2="Edit" Case StringInStr($NoName.href,"06&f") $NoName2="Quote" Case StringInStr($NoName.href,"02&f") $NoName2="Add Reply" Case StringInStr($NoName.href,"00&f") $NoName2="Add Reply" Case StringInStr($NoName.href,"10&f") $NoName2="New Topic" Case StringInStr($NoName.href,"Track&f") $NoName2="New Poll" Case StringInStr($NoName.href,"AddressCard") $NoName2="AddressCard" Case StringInStr($NoName.href,"Msg&CODE") $NoName2="Personal Message" Case StringInStr($NoName.href,"Mail&CODE") $NoName2="eMail" Case StringInStr($NoName.href,"scroll(0,0)") $NoName2="TOP" Case StringInStr($NoName.href,"topic_open") $NoName2="Show Hide" Case StringInStr($NoName.href,"qr_open") $NoName2="Fast Reply" Case StringInStr($NoName.href,"ShowUser") $NoName2="Show User" Case StringInStr($NoName.href,"emo_pop") $NoName2="Go combo" Case StringInStr($NoName.href,"oldw") $NoName2="View old" Case Else if $UseSiteForEmpty<>1 Then $ObjIE2 = ObjCreate ("InternetExplorer.Application") $ObjIE2.Visible = True $ObjIE2.navigate($NoName.href) Do Sleep(50) Until $ObjIE2.ReadyState = 4 $NoName2 = WinGetTitle("") $NoName2=StringReplace($NoName2," - Microsoft Internet Explorer" ,"" ) WinClose("") Else $NoName2 = $NoName.href EndIf EndSelect $LinkMessage=StringReplace($NoName2,@CRLF," " ) $LinkMessage=StringReplace($NoName2,",",";" ) $LinkMessage=$_i&"|" &$NoName2 return $LinkMessage&"|"&$NoName.href Else return 0 EndIf EndFunc ;==>_IE_clickLinkIndex ;$doc1 = $ObjIE #EndRegion- Function Clicks #Region - Form Data ;$links1 = $doc1.links ;For $i = 1 To ($links1.length-1) ;$ObjF = _IE_FrameObj($ObjIE, $i - 1) ; _IE_clickLinkIndex($ObjIE, $i - 1) ;ConsoleWrite("Frame" & $i & " - " & $ObjF.document.location.href & @CR) ;Next ;_IE_clickLinkText(_IE_FrameObj($ObjIE, 2), "Our Values") ; Click on the third link on the third frame ;_IE_clickLinkIndex(_IE_FrameObj($ObjIE, 2), 2) Func _IE_frameformclick($_obj,$_find,$_form = 0) For $i = 1 To $_obj.document.forms ($_form) .elements () .length - 1 If StringInStr($_obj.document.forms ($_form) .elements ($i) .outerHTML, $_find) > 0 Then $_obj.document.forms ($_form) .elements ($i) .click() else EndIf Next ;MsgBox(0,"$_find=",$_find&"None found?; number loop="&$i) EndFunc _IE_frameformclick ;=============================================================================== ; ; Function Name: _IE_formcheckbox ; Description: Marks element as checked on a form ; Parameter(s): $_find - text to find ; $_form - Number of form element (optional) ; Requirement(s): $ObjIE must be an IE object ; Return Value(s): On Success - marks element as checked ; On Failure - no failure yet ; Author(s): scriptkitty ; ;=============================================================================== ; Func _IE_formframecheckbox($_obj,$_find,$_form = 0) For $i = 1 To $_obj.document.forms ($_form) .elements () .length - 1 If StringInStr($_obj.document.forms ($_form) .elements ($i) .outerHTML, $_find) > 0 Then $_obj.document.forms ($_form) .elements ($i) .checked = true EndIf Next EndFunc ;==>_IE_formframecheckbox ;=============================================================================== ; ; Function Name: _IE_form ; Description: Finds and fills element on a form ; Parameter(s): $_find - text to find ; $_form - Number of form element (optional) ; $_fill - Text to fill into element ; Requirement(s): $ObjIE must be an IE object ; Return Value(s): On Success - fills element on form ; On Failure - no failure yet ; Author(s): scriptkitty ; ;=============================================================================== ; Func _IE_frameform($_obj,$_find, $_fill, $_form = 0) $doc = $_obj.document ;$links = $doc.links $found = 0 $f = 0 ;For $link in $links For $i = 1 To $_obj.document.forms ($_form) .elements () .length - 1 ;If StringInStr($_obj.document.forms ($_form) .elements ($i) .outerHTML, $_find) > 0 Then ;$_obj.document.forms ($_form) .elements ($i) .value = $_fill $FormMessageName=$_obj.document.forms ($_form) .elements ($i) .name $FormMessage=$_obj.document.forms ($_form) .elements ($i) .value ;EndIf ;$linkText = $link.outerText & ""; Append empty string to prevent problem with no outerText (image) links ; $linkText=StringReplace($linkText,@CRLF," " ) ; $linkText=StringReplace($linkText,",",";" ) $FormMessage=$f&"|" & $FormMessageName&"|" & $FormMessage ;$FormMessage=$FormMessage&"|"&$link.href ; if $linkText="" or $linkText="0" Then ; $LinkMessage=_IE_clickLinkIndex($_obj, $f) ;EndIf ConsoleWrite($FormMessage& @CR) FileWrite($sFilePath,$FormMessage & @CRLF ) ;If $FormMessage = $_find Then ; $found = $found + 1 ; if ($found = $_i) Then ;return 1 ; return $found ; EndIf ;Else ;EndIf $f=$f+1 Next return 0 ;Next EndFunc ;==>_IE_frameform ;=============================================================================== ; ; Function Name: _IEdone() ; Description: Checks to see if page is loaded ; Parameter(s): none ; ; Requirement(s): $ObjIE must be an IE object ; Return Value(s): On Success - sleeps until loaded ; On Failure - no failure yet ; Author(s): scriptkitty ; ;=============================================================================== ; Func _IEdone() While $ObjIE.busy Sleep(10) Wend EndFunc ;==>_IEdone Func _MyErrFunc() $HexNumber = Hex($oMyError.number, 8) Global $_IEError= ("We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription, 0, 0) SetError(1); something to check for when this function returns Sleep(100); slight pause EndFunc ;==>_MyErrFunc ;=============================================================================== ; ; Function Name: _IE_connect ; Description: Connects to a page, if URL not called will start one ; Parameter(s): $url - text of substring of URL (optional) ; ; Requirement(s): Internet explorer must be installed ; Return Value(s): On Success - connects and returns IE object ; On Failure - makes new IE object and returns ; Author(s): scriptkitty ; ;=============================================================================== ; Func _IE_connect($url = "www.autoitscript.com") Dim $ObjShell = ObjCreate ("Shell.Application") Dim $ObjShellWindows = $ObjShell.Windows (); collection of all ShellWindows (IE and File Explorer) Global $ObjIE For $Window in $ObjShellWindows If StringInStr($Window.LocationURL, $url) > 0 Then $ObjIE = $Window ExitLoop; We found it... Else $ObjIE = 0 EndIf Next If isObj ($ObjIE) Then ConsoleWrite("--> $ObjIE now points to an IE Instance connected" & @CR) Else $ObjIE = ObjCreate ("InternetExplorer.Application") With $ObjIE .Visible = True .Navigate ($url) Do Sleep(50) Until .ReadyState = 4 EndWith ConsoleWrite("--> No IE instance was found connected so made one" & @CR) EndIf Return $ObjIE EndFunc ;==>_IE_connect Func _IE_formclick($_find,$_form = 0) For $i = 1 To $ObjIE.document.forms ($_form) .elements () .length - 1 If StringInStr($ObjIE.document.forms ($_form) .elements ($i) .outerHTML, $_find) > 0 Then $ObjIE.document.forms ($_form) .elements ($i) .click() else EndIf Next EndFunc Func _IE_formcheckbox($_find,$_form = 0) For $i = 1 To $ObjIE.document.forms ($_form) .elements () .length - 1 If StringInStr($ObjIE.document.forms ($_form) .elements ($i) .outerHTML, $_find) > 0 Then $ObjIE.document.forms ($_form) .elements ($i) .checked = true EndIf Next EndFunc ;==>_IE_formcheckbox #EndRegion- Form Data