Shanheavel Posted November 19, 2011 Share Posted November 19, 2011 Hello, I'm using IE Activex as web browser and I've a little problem - I can't replace javascript code. My code: GUICreate("My browser", 1200, 800) $IE = ObjCreate("Shell.Explorer.2") $Activex = GUICtrlCreateObj($IE, 0, 0, 1200, 800) GUISetState() Example page code: <html> <head> <script type="text/javascript" src="script1.js"> </script> <script type="text/javascript" src="script2.js"> </script> </head> <body> Test </body> </html> How can I replace "script1.js" code? I tried _IE functions but they don't work with Shell Explorer. Link to comment Share on other sites More sharing options...
Shanheavel Posted November 20, 2011 Author Share Posted November 20, 2011 (edited) Now I'm using _IECreateEmbedded as web browser.#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> _IEErrorHandlerRegister () $oIE = _IECreateEmbedded () GUICreate("Embedded Web control Test", 640, 580, _ (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360) $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30) $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30) $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30) $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30) GUISetState() ;Show GUI _IENavigate ($oIE, "http://www.autoitscript.com") ; Waiting for user to close the window While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Home _IENavigate ($oIE, "http://www.autoitscript.com") Case $msg = $GUI_Button_Back _IEAction ($oIE, "back") Case $msg = $GUI_Button_Forward _IEAction ($oIE, "forward") Case $msg = $GUI_Button_Stop _IEAction ($oIE, "stop") EndSelect WEnd GUIDelete() ExitHow can I replace "script1.js" (or script code)? I tried removeChild, replaceChild etc.$oScripts = $oIE.document.scripts $oScripts.removeChild($oScripts.lastChild)but it doesn't work. Edited November 20, 2011 by Shanheavel Link to comment Share on other sites More sharing options...
Shanheavel Posted November 21, 2011 Author Share Posted November 21, 2011 BUMP! Can someone helps me?? Link to comment Share on other sites More sharing options...
lippea Posted January 25, 2013 Share Posted January 25, 2013 I have the same issue. I guess some special chars make the failure, because sample code in below link works fine. 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