Fluoride Posted April 27, 2007 Posted April 27, 2007 (edited) 1. I have a webbased html/php program and want to alow access through an IECreateEmbedded however I want to hide the source and especially want to hide access to "properties" found in the right mouse click menu. I don't want people to discover the link to the source of the content as I want to restrict access to only the IECreateEmbedded. How can I change the options that display on the menue when the right mouse button is clicked or if I cant change how can I disable? 2. Also it seems that when I try to access a webpage through IECreateEmbedded that requires a directory user name and password I get a "not found error". Thanks Edited April 27, 2007 by Fluoride
DaleHohm Posted April 27, 2007 Posted April 27, 2007 For 1) see the example in the helpfile for _IEHeadInsertEventScript I don't understand 2) 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
Fluoride Posted April 27, 2007 Author Posted April 27, 2007 Thanks for the tip on _IEHeadInsertEventScript. That worked for a simple html page. It did not provide protection in the areas where there was an iframe however. The code within the iframe obviously did not receive the header insert. (I did not test this on standard frames yet.) I wonder if there is a way to control the context menu through means other than the browser context? In regards to my initial question 2. I set up a password protected directory on my Linux server. When accessing through IE or Mozilla a popup appears requesting the user name and password. _IECreateEmbedded however rejects the page as Not Found. If I cant solve this problem I would have to move the content to a non password protected directory and create some other form of protection. I would hope there is a solution to this within IE.au3?
DaleHohm Posted April 27, 2007 Posted April 27, 2007 Thanks for the tip on _IEHeadInsertEventScript.That worked for a simple html page. It did not provide protection in the areas where there was an iframe however. The code within the iframe obviously did not receive the header insert. (I did not test this on standard frames yet.)Each frame has its own document, so yes, this method is required multiple times when there are frames (and when a document is reloaded unless you include it in the document source).I wonder if there is a way to control the context menu through means other than the browser context?Perhaps, but not my forte.In regards to my initial question 2. I set up a password protected directory on my Linux server. When accessing through IE or Mozilla a popup appears requesting the user name and password. _IECreateEmbedded however rejects the page as Not Found.If I cant solve this problem I would have to move the content to a non password protected directory and create some other form of protection. I would hope there is a solution to this within IE.au3?_IECreateEmbedded uses a WebBrowser object as opposed to the InternetExplorer object in the full browser. In almost all areas (except things like status bars and other elements that only make sense in the browser) they are identical. You'll need to do some more testing and create a reproducer to take this further.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
Fluoride Posted April 27, 2007 Author Posted April 27, 2007 Ok without some other solution (which I still hope to find) aside from the browser object can you advice me of how I might force each and every frame to receive the header information (aside from including it directly in the source) inside the IECreateEmbedded? Here is the small code I am using including the IEHeadInsertEventScript you advised me of: (by the way... thanks for you help so far Dale) #include <GUIConstants.au3> #include <IE.au3> $oIE = _IECreateEmbedded () GUICreate("Test", 640, 580, _ (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 510) GUISetState() _IENavigate ($oIE, "thewebpage.htm") _IEHeadInsertEventScript ($oIE, "document", "oncontextmenu", "alert('Use Ctrl C to COPY | Use Ctrl v to PASTE');return false") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Exit
DaleHohm Posted April 27, 2007 Posted April 27, 2007 You'll need to use _IEFrameGetObjByName or _IEFrameGetCollection to get a reference to each frame and then use _IEHeadInsertEventScript just as you have above. 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
Fluoride Posted April 27, 2007 Author Posted April 27, 2007 well... this is not working out with the frames... as one link leads to the next I guess the full script would have to run again in order to fill each new header with the javascript... so my script below is not working for my needs... I sure wish there was a way to block the context menu through some other method??? Anyone? This is what I was last testing... I may not even have the code correct: #include <GUIConstants.au3> #include <IE.au3> $oIE = _IECreateEmbedded () GUICreate("Test", 640, 580, _ (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 510) GUISetState() $test=_IENavigate ($oIE, "webpage.htm") _IEHeadInsertEventScript ($oIE, "document", "oncontextmenu", "alert('Use Ctrl C to COPY | Use Ctrl v to PASTE');return false") $oFrames = _IEFrameGetCollection ($test) $iNumFrames = @extended For $i = 0 to ($iNumFrames - 1) $oFrame = _IEFrameGetCollection ($oIE, $i) MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "locationurl")) Next While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Exit
DaleHohm Posted April 28, 2007 Posted April 28, 2007 Try placing the following where you have your Fram Info message box: _IEHeadInsertEventScript ($oFrame, "document", "oncontextmenu", "alert('Use Ctrl C to COPY | Use Ctrl v to PASTE');return false") If the frames have frames in them you'll need to keep drilling with that loop however. 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
gsb Posted April 30, 2007 Posted April 30, 2007 I realize that this is an AutoIt forum, but... I have a similar situation where all the pages I display are my own so I control the content of each. I added this code to HTML of each page: <script type="text/javascript" event="oncontextmenu" for="document"> window.event.cancelBubble = true; window.event.returnValue = false; </script> It seems to solve the problem also including my dynamic iFrames and the iFrame content navigation - back, refresh and the like. You can even take it a step further and substitute an AutoIt context menu of your own making. gsb "Did you ever stop to think? ...and forget to restart!"
aymhenry Posted November 27, 2009 Posted November 27, 2009 This _IECreateEmbedded issue I would like to share with you this feedback, it takes weeks to get the root cause !! . I was suffering that my script do not response with default key when pressing Enter, Esc or TAB keys. My code was some like that :- I have to change the focus only #include <GUIConstants.au3> #include <IE.au3> #include <ButtonConstants.au3> $oIE = _IECreateEmbedded () GUICreate("Test", 600, 400, 10,10) $GUIActiveX = GUICtrlCreateObj($oIE, 1, 1, 598, 300) $Button01 = GUICtrlCreateButton("Button1", 10, 320, 100, 30, $BS_DEFPUSHBUTTON) $Button02 = GUICtrlCreateButton("Button2", 120, 320, 100, 30) $Button03 = GUICtrlCreateButton("Button3", 230, 320, 100, 30) ;$Button04 = GUICtrlCreateButton("Button4", 340, 320, 100, 30) $txt = GUICtrlCreateInput ("terxt", 340, 320, 100, 30) ;================================================ ;-- I add that to let my code react with Enter, Esc or TAB Key. That simple GUICtrlSetState ($txt, $GUI_FOCUS ) ;================================================ GUISetState() _IENavigate ($oIE, "about:blank") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button01 MsgBox (0,"", "Button1") Case $msg = $Button02 MsgBox (0,"", "Button2") Case $msg = $Button03 MsgBox (0,"", "Button3") EndSelect Wend Exit
vadim123 Posted May 3, 2013 Posted May 3, 2013 In my script I use:_IENavigate($oIE, "http://www.webpage.com", 0)_IEHeadInsertEventScript($oIE, "document", "oncontextmenu", "alert('No Context Menu');return false") I get the following error:C:\..\AutoIt\Include\ie.au3 (2191) : ==> Variable must be of type "Object".:Local $o_head = $o_object.document.all.tags("HEAD").Item(0)Local $o_head = $o_object.document^ ERRORIf I don't use the option 0 to wait for page load to complete before returning to gui tevrything works ok but slower.Any idea to overcome this delay on wait for the page to load ?
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