tengwer Posted April 21, 2009 Share Posted April 21, 2009 Is there a way to add HTML code to incoming web pages? I would like to add the following code to bible based web sites as they are opened in my browser: <!-- RefTagger from Logos. Visit http://www.logos.com/reftagger. This code should appear directly before the </body> tag. --><script src="http://bible.logos.com/jsapi/referencetagging.js" type="text/javascript"></script><script type="text/javascript"> Logos.ReferenceTagging.lbsBibleVersion = "ESV"; Logos.ReferenceTagging.lbsLinksOpenNewWindow = true; Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark"; Logos.ReferenceTagging.lbsNoSearchTagNames = [ "h1", "h2", "h3" ]; Logos.ReferenceTagging.tag();</script>This code will allow me to click on bible verses within the web page and open them in my Bible program. I experimented with using _IEBodyWriteHTML but even the example scripts did not work properly. Link to comment Share on other sites More sharing options...
Blips Posted April 21, 2009 Share Posted April 21, 2009 (edited) Is there a way to add HTML code to incoming web pages? I would like to add the following code to bible based web sites as they are opened in my browser: <!-- RefTagger from Logos. Visit http://www.logos.com/reftagger. This code should appear directly before the </body> tag. --> <script src="http://bible.logos.com/jsapi/referencetagging.js" type="text/javascript"></script> <script type="text/javascript"> Logos.ReferenceTagging.lbsBibleVersion = "ESV"; Logos.ReferenceTagging.lbsLinksOpenNewWindow = true; Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark"; Logos.ReferenceTagging.lbsNoSearchTagNames = [ "h1", "h2", "h3" ]; Logos.ReferenceTagging.tag(); </script> This code will allow me to click on bible verses within the web page and open them in my Bible program. I experimented with using _IEBodyWriteHTML but even the example scripts did not work properly.yes you could use grease monkey with firefox https://addons.mozilla.org/en-US/firefox/addon/748 or after its loaded could use firebug... you can modify it using autoit if you are building browser too but kinda hard to guess what ya lookin for... Edited April 22, 2009 by Blips [quote name='BrettF' post='673687' date='Apr 24 2009, 07:47 AM']He knows what he's talking about (usually) and a damn sight more than you... So maybe just re read what you said, and go read up on how it is impossible at this stage in pure AutoIt...[/quote]Yet i am only one that helped him? ... while you trolled..http://en.wikipedia.org/wiki/Internet_troll Link to comment Share on other sites More sharing options...
tengwer Posted April 22, 2009 Author Share Posted April 22, 2009 yes you could use grease monkey with firefox https://addons.mozilla.org/en-US/firefox/addon/748or after its loaded could use firebug...you can modify it using autoit if you are building browser too but kinda hard to guess what ya lookin for...Thanks for the reply. I need to do this in Internet explorer. This code needs to be added to whatever web pages I navigate to. In other words, I would create a script that prompts me to go to a web page and then adds this code to the web page as it loads. It may work for it to be added just after it loads. Any ideas? Link to comment Share on other sites More sharing options...
RobertKipling Posted April 22, 2009 Share Posted April 22, 2009 Messing with HTML in webpages isn't fun. (I should know; half of the scripts I write are some kind of mass content-extracting ones.) AutoIt supports a web browser object; could you just download the file with InetGet, change the content, and display it in a GUI form? I know it's not what you're looking for, but IE doesn't let you save changes to documents without a fight. Link to comment Share on other sites More sharing options...
Spiff59 Posted April 22, 2009 Share Posted April 22, 2009 I just went through my first attempt at parsing and dynamically updating a webpage. It was rather interesting. Since I worked out the methods on my own, I may not be going about it in the best or most efficient manner, but it's working nicely. You might glean some info from looking at the source of the link in my signature (the Eye_Candy and Get_Codetags paragraphs particularily). You'll at least get exposure to the Objects and Methods you'll be wanting. Link to comment Share on other sites More sharing options...
tengwer Posted April 22, 2009 Author Share Posted April 22, 2009 I just went through my first attempt at parsing and dynamically updating a webpage.It was rather interesting. Since I worked out the methods on my own, I may not be going about it in the best or most efficient manner, but it's working nicely.You might glean some info from looking at the source of the link in my signature (the Eye_Candy and Get_Codetags paragraphs particularily). You'll at least get exposure to the Objects and Methods you'll be wanting.I'm thinking that the _IEDocInsertHTML is exactly what I need but the example scripts do not work. An autoit web page with an alteration is supposed to pop up but nothing is altered. Can anyone give me an example of this command being used to load a web page and then insert some html? (an example that works of course). Link to comment Share on other sites More sharing options...
DaleHohm Posted April 22, 2009 Share Posted April 22, 2009 (edited) Here you go... I recently wrote this for another project. It will be part of a future IE.au3 release. Just load your script (without the script tags) into a string and insert it with this function. Func IEHeadInsertScript($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.text = $s_script $o_head.appendChild($o_element) Return 1 EndFunc The method used in _IEDocInsertHTML is disallowed for script elements. Dale Update: spelling Edited April 22, 2009 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
tengwer Posted April 22, 2009 Author Share Posted April 22, 2009 Here you go... I recently wrote this for another project. It will be part of a future IE.au3 release. Just load your script (without the script tags) into a string and insert it with this function. Func IEHeadInsertScript($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.text = $s_script $o_head.appendChild($o_element) Return 1 EndFunc The method used in _IEDocInsertHTML is disallowed for script elements. Dale Update: spelling I'm just an amature at this. The code I want to insert is: <!-- RefTagger from Logos. Visit http://www.logos.com/reftagger. This code should appear directly before the </body> tag. --> <script src="http://bible.logos.com/jsapi/referencetagging.js" type="text/javascript"></script> <script type="text/javascript"> Logos.ReferenceTagging.lbsBibleVersion = "ESV"; Logos.ReferenceTagging.lbsLinksOpenNewWindow = true; Logos.ReferenceTagging.lbsAddLibronixDLSLink = true; Logos.ReferenceTagging.lbsLibronixBibleVersion = "NIV"; Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark"; Logos.ReferenceTagging.lbsNoSearchTagNames = [ ]; Logos.ReferenceTagging.tag(); </script> This needs to be inserted just before the end of the body. Could you please put the script together using this code for me. I would really appreciate it! Also I'm not sure how this script will work for what I need. I need a script that will open a web page and insert this script just before the end of the body (just before <body/>. Link to comment Share on other sites More sharing options...
DaleHohm Posted April 22, 2009 Share Posted April 22, 2009 There is no reason to put this in the BODY. It will need a modification to use the src= however. This should work. $sScript = 'Logos.ReferenceTagging.lbsBibleVersion = "ESV";' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsLinksOpenNewWindow = true;' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsAddLibronixDLSLink = true;' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsLibronixBibleVersion = "NIV";' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark";' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsNoSearchTagNames = [ ];' & @CRLF $sScript &= 'Logos.ReferenceTagging.tag();' IEHeadInsertScriptSrc($oIE, "http://bible.logos.com/jsapi/referencetagging.js") IEHeadInsertScript($oIE, $sScript) Func IEHeadInsertScriptSrc($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.src = $s_script $o_head.appendChild($o_element) Return 1 EndFunc Func IEHeadInsertScript($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.text = $s_script $o_head.appendChild($o_element) Return 1 EndFunc Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
tengwer Posted April 22, 2009 Author Share Posted April 22, 2009 There is no reason to put this in the BODY. It will need a modification to use the src= however. This should work. $sScript = 'Logos.ReferenceTagging.lbsBibleVersion = "ESV";' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsLinksOpenNewWindow = true;' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsAddLibronixDLSLink = true;' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsLibronixBibleVersion = "NIV";' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark";' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsNoSearchTagNames = [ ];' & @CRLF $sScript &= 'Logos.ReferenceTagging.tag();' IEHeadInsertScriptSrc($oIE, "http://bible.logos.com/jsapi/referencetagging.js") IEHeadInsertScript($oIE, $sScript) Func IEHeadInsertScriptSrc($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.src = $s_script $o_head.appendChild($o_element) Return 1 EndFunc Func IEHeadInsertScript($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.text = $s_script $o_head.appendChild($o_element) Return 1 EndFunc Dale I tried this and it didn't work: #include <IE.au3> $oIE = _IECreate("http://www.netbiblestudy.net/new_page_9.htm") $sScript = 'Logos.ReferenceTagging.lbsBibleVersion = "ESV";' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsLinksOpenNewWindow = true;' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsAddLibronixDLSLink = true;' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsLibronixBibleVersion = "NIV";' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark";' & @CRLF $sScript &= 'Logos.ReferenceTagging.lbsNoSearchTagNames = [ ];' & @CRLF $sScript &= 'Logos.ReferenceTagging.tag();' IEHeadInsertScriptSrc($oIE, "http://bible.logos.com/jsapi/referencetagging.js") IEHeadInsertScript($oIE, $sScript) Func IEHeadInsertScriptSrc($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.src = $s_script $o_head.appendChild($o_element) Return 1 EndFunc Func IEHeadInsertScript($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.text = $s_script $o_head.appendChild($o_element) Return 1 EndFunc After running the script and the web page opening I saved it as html to see if the script was in there somewhere and it wasn't. Also this script does need to be at the end of the file becasue it searches anything above it for scripture references and when it finds them it hyperlinks them to open in Libronix Bible software. I am assuming that this script should have opened the web page and then inserted the script at the head. Am I correct? But once again if you could modify this so that it puts the script at the end of the body that would be great. Thanks for your time!!! Link to comment Share on other sites More sharing options...
DaleHohm Posted April 22, 2009 Share Posted April 22, 2009 (edited) Saving the page using the browser menu will not capture dynamic content. Suggest you use DebugBar to examine your pages. I've been doing a lot of work with these techniques lately, so this was interesting. Insering a script with src= is not getting sourced. Adding it as text does work. Here is a working example that also uses Ajax to get the remote script source: #include <IE.au3> $oIE = _IECreate("http://www.netbiblestudy.net/new_page_9.htm") $sScript = 'Logos.ReferenceTagging.lbsBibleVersion = "ESV";' $sScript &= 'Logos.ReferenceTagging.lbsLinksOpenNewWindow = true;' $sScript &= 'Logos.ReferenceTagging.lbsAddLibronixDLSLink = true;' $sScript &= 'Logos.ReferenceTagging.lbsLibronixBibleVersion = "NIV";' $sScript &= 'Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark";' $sScript &= 'Logos.ReferenceTagging.lbsNoSearchTagNames = [ ];' $sScript &= 'Logos.ReferenceTagging.tag();' ; Init the Ajax object $oXHR = ObjCreate("MSXML2.XMLHTTP") $oXHR.open("GET", "http://bible.logos.com/jsapi/referencetagging.js", False) $oXHR.Send() IEHeadInsertScript($oIE, $oXHR.responseText) IEEval($oIE, $sScript) Func IEEval($o_object, $s_eval) Return $o_object.document.parentwindow.eval($s_eval) EndFunc ;==>IEEval Func IEHeadInsertScript($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.text = $s_script $o_head.appendChild($o_element) Return 1 EndFunc ;==>IEHeadInsertScript Dale Edit: I just discovered that SciTe Tidy will change .eval into .Eval - Javascript barfs on the capital E. changed back Edited April 22, 2009 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Valuater Posted April 22, 2009 Share Posted April 22, 2009 Nice stuff Dale! .... as always!! 8) Link to comment Share on other sites More sharing options...
tengwer Posted April 22, 2009 Author Share Posted April 22, 2009 Nice stuff Dale!.... as always!!8)Thank you, Thank you, Thank you!!! It works!!! I knew there had to be a way to do this. My plan is to use this script as a basis for being able to have scripture on the web automatically linked to my Libronix Bible program. Link to comment Share on other sites More sharing options...
John117 Posted April 23, 2009 Share Posted April 23, 2009 Saving the page using the browser menu will not capture dynamic content. Suggest you use DebugBar to examine your pages. I've been doing a lot of work with these techniques lately, so this was interesting. Insering a script with src= is not getting sourced. Adding it as text does work. Here is a working example that also uses Ajax to get the remote script source: #include <IE.au3> $oIE = _IECreate("http://www.netbiblestudy.net/new_page_9.htm") $sScript = 'Logos.ReferenceTagging.lbsBibleVersion = "ESV";' $sScript &= 'Logos.ReferenceTagging.lbsLinksOpenNewWindow = true;' $sScript &= 'Logos.ReferenceTagging.lbsAddLibronixDLSLink = true;' $sScript &= 'Logos.ReferenceTagging.lbsLibronixBibleVersion = "NIV";' $sScript &= 'Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark";' $sScript &= 'Logos.ReferenceTagging.lbsNoSearchTagNames = [ ];' $sScript &= 'Logos.ReferenceTagging.tag();' ; Init the Ajax object $oXHR = ObjCreate("MSXML2.XMLHTTP") $oXHR.open("GET", "http://bible.logos.com/jsapi/referencetagging.js", False) $oXHR.Send() IEHeadInsertScript($oIE, $oXHR.responseText) IEEval($oIE, $sScript) Func IEEval($o_object, $s_eval) Return $o_object.document.parentwindow.eval($s_eval) EndFunc ;==>IEEval Func IEHeadInsertScript($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.text = $s_script $o_head.appendChild($o_element) Return 1 EndFunc ;==>IEHeadInsertScript Dale Edit: I just discovered that SciTe Tidy will change .eval into .Eval - Javascript barfs on the capital E. changed back WOW! -That is crazy! Link to comment Share on other sites More sharing options...
tengwer Posted April 23, 2009 Author Share Posted April 23, 2009 Thank you, Thank you, Thank you!!! It works!!! I knew there had to be a way to do this. My plan is to use this script as a basis for being able to have scripture on the web automatically linked to my Libronix Bible program.I just realized there is a little bump in the road. I created a script that allows me to browse the internet from within Libronix. The script you created works great if I create an autoit script to ask for input to go to a particular web page and then it opens IE and everything works as it should but I would like to be able to do this from within Libronix.Is it possible to alter this script so that it works automatically for any page I browse to from within internet Explorer? In other words could it be possible to have a script running in the background that acts on any address I type in the address bar on IE or even any address I click on in a web page? IF so I am guessing that it would also work within Libronix when I browse since Libronix uses IE as its browser. Link to comment Share on other sites More sharing options...
John117 Posted April 23, 2009 Share Posted April 23, 2009 (edited) I wrote something that behaves in a similar way - downloading from online back up for you now. takes a few on wireless wan 15mb back up currently at 26kb sec ;-) I feel like Im downloading ie 10 years ago on dialup :-) Edited April 23, 2009 by Hatcheda Link to comment Share on other sites More sharing options...
DaleHohm Posted April 23, 2009 Share Posted April 23, 2009 I contributed something similar for the AutoIt helpfile.... you may be able to adapt it:http://www.autoitscript.com/forum/index.ph...7259&hl=chmDale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
John117 Posted April 23, 2009 Share Posted April 23, 2009 ok - the script is below. - as set it just unblocks a blocked website. it has a toggle for on an off (ESC) You could simply adapt it to search for one line of you added code. If it does not find it, then the secureaccess section would contain your code to add it. On loop it would find it and stop until you change the page Needs some minor adaptation and maybe a name change or two :-) expandcollapse popup#include <string.au3> #include <IE.au3> Opt("GUIOnEventMode", 1) HotKeySet("{ESC}", "_Toggle") $Access = False ToolTip("Restricted Access", ((@DesktopWidth / 10) * 8), 5) ; ============================================================================ ; Main Loop ; ============================================================================ While 1 If $Access = True Then Global $title = WinGetTitle("[ACTIVE]") Global $oIE = _IEAttach(StringTrimRight($title, 28), "Title") $sHTML = _IEDocReadHTML($oIE) $result = StringInStr($sHTML, "This site is blocked") If $result = 456 Then _SecureAccess() Else EndIf EndIf Sleep(1000) WEnd ; ============================================================================ ; Functions ; ============================================================================ Func _SecureAccess() $Url_1 = _IEPropertyGet($oIE, "locationurl") $Url_2 = StringInStr($Url_1, "HTTPS") If $Url_2 = 0 Then $Url_3 = _StringInsert($Url_1, "s", 4) ;MsgBox(4096, "URL", $Url_3) _IENavigate($oIE, $Url_3) EndIf EndFunc ;==>_SecureAccess Func _Toggle() If $Access = True Then Global $Access = False ToolTip("Restricted Access", ((@DesktopWidth / 10) * 8), 5) Else If $Access = False Then Global $Access = True ToolTip("Enhanced Access", ((@DesktopWidth / 10) * 8), 5) EndIf EndIf EndFunc ;==>_Toggle Link to comment Share on other sites More sharing options...
DaleHohm Posted April 24, 2009 Share Posted April 24, 2009 Since your replies on this topic stopped, I'm guessing you lost steam trying to adapt the other examples. This finishes out what you were trying to do and works as you navigate to different pages: expandcollapse popup#include <IE.au3> Global $oIE, $sScriptSrc $oIE = _IECreate("http://www.netbiblestudy.net/new_page_9.htm") ObjEvent($oIE, "evtWin_", "DWebBrowserEvents2") _IEAction($oIE, "refresh") ; Only needed for initial page to trigger downloadcomplete processing While __IEisObjType($oIE, "browser") ; Stop when browser is closed Sleep(1000) WEnd Exit ;------------------------------------------ ; Functions ;------------------------------------------ Func evtWin_downloadcomplete() Local $s_script If $sScriptSrc = "" Then Local $o_XHR = ObjCreate("MSXML2.XMLHTTP") ; Init the Ajax object $o_XHR.open("GET", "http://bible.logos.com/jsapi/referencetagging.js", False) $o_XHR.Send() $sScriptSrc = $o_XHR.responseText EndIf IEHeadInsertScript($oIE, $sScriptSrc) $s_script = 'Logos.ReferenceTagging.lbsBibleVersion = "ESV";' $s_script &= 'Logos.ReferenceTagging.lbsLinksOpenNewWindow = true;' $s_script &= 'Logos.ReferenceTagging.lbsAddLibronixDLSLink = true;' $s_script &= 'Logos.ReferenceTagging.lbsLibronixBibleVersion = "NIV";' $s_script &= 'Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark";' $s_script &= 'Logos.ReferenceTagging.lbsNoSearchTagNames = [ ];' $s_script &= 'Logos.ReferenceTagging.tag();' IEEval($oIE, $s_script) EndFunc ;==>evtWin_downloadcomplete Func IEEval($o_object, $s_eval) Return $o_object.document.parentwindow.eval($s_eval) EndFunc ;==>IEEval Func IEHeadInsertScript($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.text = $s_script $o_head.appendChild($o_element) Return 1 EndFunc ;==>IEHeadInsertScript Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
DaleHohm Posted April 24, 2009 Share Posted April 24, 2009 Actually, I like this better as it uses no undocumented functions and demonstrated onquit event handling: expandcollapse popup#include <IE.au3> Global $oIE, $sScriptSrc $oIE = _IECreate("http://www.netbiblestudy.net/new_page_9.htm") ObjEvent($oIE, "evtWin_", "DWebBrowserEvents2") _IEAction($oIE, "refresh") ; Only needed for initial page to trigger downloadcomplete processing While True Sleep(1000) WEnd Exit ;------------------------------------------ ; Functions ;------------------------------------------ Func evtWin_onquit() ; Browser run down, exit Exit EndFunc ;==>evtWin_onquit Func evtWin_downloadcomplete() Local $s_script If $sScriptSrc = "" Then Local $o_XHR = ObjCreate("MSXML2.XMLHTTP") ; Init the Ajax object $o_XHR.open("GET", "http://bible.logos.com/jsapi/referencetagging.js", False) $o_XHR.Send() $sScriptSrc = $o_XHR.responseText EndIf IEHeadInsertScript($oIE, $sScriptSrc) $s_script = 'Logos.ReferenceTagging.lbsBibleVersion = "ESV";' $s_script &= 'Logos.ReferenceTagging.lbsLinksOpenNewWindow = true;' $s_script &= 'Logos.ReferenceTagging.lbsAddLibronixDLSLink = true;' $s_script &= 'Logos.ReferenceTagging.lbsLibronixBibleVersion = "NIV";' $s_script &= 'Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark";' $s_script &= 'Logos.ReferenceTagging.lbsNoSearchTagNames = [ ];' $s_script &= 'Logos.ReferenceTagging.tag();' IEEval($oIE, $s_script) EndFunc ;==>evtWin_downloadcomplete Func IEEval($o_object, $s_eval) Return $o_object.document.parentwindow.eval($s_eval) EndFunc ;==>IEEval Func IEHeadInsertScript($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.text = $s_script $o_head.appendChild($o_element) Return 1 EndFunc ;==>IEHeadInsertScript Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now