Stilgar Posted March 13, 2009 Share Posted March 13, 2009 Hi Stilgar, thank you very much for this wonderful automation library. I've read your example to write inner HTML directly to the body. Can you give an example of how to write scratch HTML and thus release previous content of a page using FF.au3? I mean [html][...][/...][/html] etc.. Thank you! I must try this. document.write fails of security exceptions and there's no innerHTML for "html", but you can try the innerHTMl of content.document.documentElement. For the other write to the innerHTML of the body, I've made a new function in the current test-version: Test version _FFWriteHTML there's some other new functions, too: - New: _FFWindowClose(ByRef $Socket[, $sSearch = "Mozilla Firefox"[, $sSearchMode = "title"]]) - New: _FFWindowCloseCurrent(ByRef $Socket) - New: _FFWindowSelect(ByRef $Socket[, $sSearch = "MozillaFirefox"[, $sSearchMode = "title"]]) - New: _FFWindowSelectMostRecent(ByRef $Socket) - New: _FFWindowOpen(ByRef $Socket[, $sURL = "about:blank"]) - New: _FFWriteHTML(ByRef $Socket[, $sHTML = ""]) - New: _FFClickXY(ByRef $Socket[, $iX = 0[, $iY = 0[, $bLoadWait = true]]]) jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
Kikkymonk Posted March 16, 2009 Share Posted March 16, 2009 (edited) Stilgar: I must say a big "THANK YOU" for your fantastic UDF for firefox. My German classes in high school are coming in handy! I have read the instructions but can't seem to find how to do what I would like to do. I want to automatically set the zoom to a specific size (the zoom function is what happens when you press ctrl and + and Ctrl and -) I think this can be done by using setget, but I don't know enough of javascript DOM stuff to make it happen. Thanks! Dave Edited March 16, 2009 by Kikkymonk Link to comment Share on other sites More sharing options...
Kikkymonk Posted March 16, 2009 Share Posted March 16, 2009 I think it would be this page:https://developer.mozilla.org/En/Full_page_zoomBut now I have to get it to work with setget Link to comment Share on other sites More sharing options...
Authenticity Posted March 16, 2009 Share Posted March 16, 2009 Wonderful, so it's: #include <FF.au3> Dim $ff = _FFConnect() _FFSetGet($ff, 'var docViewer = gBrowser.selectedBrowser.markupDocumentViewer;' & _ 'docViewer.fullZoom = 1.5;') _FFDisConnect($ff) Link to comment Share on other sites More sharing options...
Stilgar Posted March 16, 2009 Share Posted March 16, 2009 (edited) @Kikkymonk: Thank you! You can do this in a single line, too: #include <FF.au3> Dim $ff = _FFConnect() _FFSetGet($ff, 'gBrowser.selectedBrowser.markupDocumentViewer.fullZoom=1.5;') _FFDisConnect($ff) then you avoid this temp-var, which is created in the context from the current window. Edited March 16, 2009 by Stilgar jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
Kikkymonk Posted March 16, 2009 Share Posted March 16, 2009 (edited) : ( I thought I did everything just like you did but mine didn't work. I did use start instead of connect. Would that not work? BUT, thanks a ton for both your UDF and your tech support!! Well, at least I'm starting to get the DOM stuff. Thanks! Dave Edited March 16, 2009 by Kikkymonk Link to comment Share on other sites More sharing options...
Stilgar Posted March 16, 2009 Share Posted March 16, 2009 That must work with _FFStart, too e.g.: Global $ff = _FFStart("http://www.google.de") _FFSetGet($ff, 'gBrowser.selectedBrowser.markupDocumentViewer.fullZoom=1.5;') _FFDisConnect($ff) do you have any error messages in the console from your editor? jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
Authenticity Posted March 16, 2009 Share Posted March 16, 2009 Heh, managed to get this to write full html. #include <FF.au3> Dim $ff = _FFConnect() If $ff = -1 Then Exit Dim $sHTML = 'java script: content.document.open();content.document.writeln(\"<HTML><HEAD><TITLE>Something</TITLE>' & _ '</HEAD><BODY><B>Something</B></BODY></HTML>\");content.document.close();' _FFSetGet($ff, 'content.document.location.href="' & $sHTML & '";') _FFDisConnect($ff) But it involves "navigating" and content.document.open(); keep throwing exceptions '' Link to comment Share on other sites More sharing options...
trinitrotoluen Posted March 16, 2009 Share Posted March 16, 2009 Hi ! On the older version, After I entered frame by _FFrameEnter, I can use _FFOpenURL to open another URL in the frame. But on this version when I use _FFOpenURL it open URL in the tab (not the frame). How can I do it like older version ? Link to comment Share on other sites More sharing options...
Stilgar Posted March 16, 2009 Share Posted March 16, 2009 (edited) @Authenticity:I can't get this to work without errors.document.open() doesn't work because of security reasons:MDC - document.openYou can try the new version of _FFWriteHTML:_FFWriteHTML($Socket, $sHTML, "html")Hi !On the older version, After I entered frame by _FFrameEnter, I can use _FFOpenURL to open another URL in the frame.But on this version when I use _FFOpenURL it open URL in the tab (not the frame).How can I do it like older version ?Oh this is an error. You can fix it if you replace in _FFOpenURL:StringFormat('try{content.document.location....withStringFormat('try{window.content.document.location....I'll upload a fixed version today. Edited March 16, 2009 by Stilgar jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
Stilgar Posted March 16, 2009 Share Posted March 16, 2009 (edited) I've fixed the bug in _FFOpenURL and uploaded a new version:FF.au3 V0.4.1.2bChangelogUpdated the Fire.fm-UDF to the latest FF.au3:_FF_FireFM.au3 Edited March 16, 2009 by Stilgar jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
trinitrotoluen Posted March 16, 2009 Share Posted March 16, 2009 Hi, Can we run the function even don't need to load the page ? All we do will be through the page source, don't need to load it. Link to comment Share on other sites More sharing options...
Stilgar Posted March 16, 2009 Share Posted March 16, 2009 Hi, Can we run the function even don't need to load the page ? All we do will be through the page source, don't need to load it.If you mean the _FF_FireFM.au3, you don't have to load any page. This UDF controls the FireFox AddOn "Fire.fm".This is an example how to control FF-AddOns via the FF.au3.More AddOn-UDFs are here. jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
trinitrotoluen Posted March 16, 2009 Share Posted March 16, 2009 If you mean the _FF_FireFM.au3, you don't have to load any page. This UDF controls the FireFox AddOn "Fire.fm".This is an example how to control FF-AddOns via the FF.au3.More AddOn-UDFs are here.I didn't mean that. I mean that we only need the page source, then base on the page source we access to the final page we want to surf.For e.gI want search "autoIT" from Google page, I don't need to load competely Google.com, it will waste time.I need the Google page source then base on it I will find out "www.autoitscript.com" because this link will in Google page source.Sorry for my English Link to comment Share on other sites More sharing options...
Stilgar Posted March 16, 2009 Share Posted March 16, 2009 Hi, Can we run the function even don't need to load the page ? All we do will be through the page source, don't need to load it.I think you mean the function from this post.From which function do you are talking about? jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
trinitrotoluen Posted March 16, 2009 Share Posted March 16, 2009 I think you mean the function from this post.From which function do you are talking about?For my above e.g, there may be _FFopenURL and _FFclicklinkBut can you write every function be possible work on the source page ?Can you add a get source function form FF like _INetgetsource then every function will work on the source.Just a little idea Link to comment Share on other sites More sharing options...
Stilgar Posted March 16, 2009 Share Posted March 16, 2009 (edited) For my above e.g, there may be _FFopenURL and _FFclicklink But can you write every function be possible work on the source page ? Can you add a get source function form FF like _INetgetsource then every function will work on the source. Just a little idea This can only work with pure HTML pages. It fails if there is Javascript or with Javascript generated content. E.g _FFClickLink not only opens an URL it fires a click-event on the link. And how would you fill and submit a form with the html-source? Things like _FFXPath can't work without the browser. How should it work with things like AJAX? ... short answer: no [EDIT] And why should I do this? The FF.au3 is an UDF to automate FireFox - that's all. [EDIT2] Added a "zoom" action to _FFAction in the last version: _FFSetGet($ff, 'gBrowser.selectedBrowser.markupDocumentViewer.fullZoom=1.5;') => _FFAction($ff,"zoom",1.5) Edited March 16, 2009 by Stilgar jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
trinitrotoluen Posted March 16, 2009 Share Posted March 16, 2009 (edited) Yes, but it will improve FF.au3 speed. Even I see the _FFsearch func is search through the source so sometimes it returns true but the string hasn't appeared on the page yet. That sometimes is good but sometimes is bad Here is a error in _FFsearch func Details: name: NS_ERROR_INVALID_POINTER result: 2147500035 QueryInterface: function QueryInterface() { [native code] } message: Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMJSwindow.find] filename: chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/trinitro%20toluen/Application%20Data/Mozilla/Firefox/Profiles/t5kkg8jz.TNT/mozrepl.tmp.js lineNumber: 1 columnNumber: 0 location: JS frame :: chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/trinitro%20toluen/Application%20Data/Mozilla/Firefox/Profiles/t5kkg8jz.TNT/mozrepl.tmp.js :: <TOP_LEVEL> :: line 1 inner: null data: null initialize: function initialize() { [native code] } __FFSend: content.find("Waiting ...", false, false, true, false, true, false) __FFRecv: !!! [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMJSwindow.find]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/trinitro%20toluen/Application%20Data/Mozilla/Firefox/Profiles/t5kkg8jz.TNT/mozrepl.tmp.js :: <TOP_LEVEL> :: line 1" data: no] Details: name: NS_ERROR_INVALID_POINTER result: 2147500035 QueryInterface: function QueryInterface() { [native code] } message: Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMJSwindow.find] filename: chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/trinitro%20toluen/Application%20Data/Mozilla/Firefox/Profiles/t5kkg8jz.TNT/mozrepl.tmp.js lineNumber: 1 columnNumber: 0 location: JS frame :: chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/trinitro%20toluen/Application%20Data/Mozilla/Firefox/Profiles/t5kkg8jz.TNT/mozrepl.tmp.js :: <TOP_LEVEL> :: line 1 inner: null data: null initialize: function initialize() { [native code] } __FFSend: content.find("Waiting ...", false, false, true, false, true, false) __FFRecv: !!! [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMJSwindow.find]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/trinitro%20toluen/Application%20Data/Mozilla/Firefox/Profiles/t5kkg8jz.TNT/mozrepl.tmp.js :: <TOP_LEVEL> :: line 1" data: no] Edited March 16, 2009 by trinitrotoluen Link to comment Share on other sites More sharing options...
Authenticity Posted March 16, 2009 Share Posted March 16, 2009 ...I can't get this to work without errors.document.open() doesn't work because of security reasons:....Indeed, it throws exceptions and you get error returning from _FFSetGet but it does work for, I believe, no bigger than 8K byte navigating string.If you can confirm it works for you, even with exceptions and error, it will be nice. ;] Link to comment Share on other sites More sharing options...
Stilgar Posted March 17, 2009 Share Posted March 17, 2009 @Authenticity: Sorry it doesn't work here. The only way is to overwrite the innerHTML from documentContent. @trinitrotoluen: It wouldn't improve the speed, if you must made all the cookie-handling, Javascript-Interpreter ... with AutoIt. But you can try it But the speed limit from the FF.au3 is not FireFox, it's the telnet connection to MozRepl. Every command I have to send and receive takes min. 20ms. Is that error in _FFSearch reproducible? Same error on the same page? Or is this different? jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
Recommended Posts