buymeapc Posted May 16, 2012 Share Posted May 16, 2012 Hi all, I'm trying to set the value of an object on a web page. The object, however, is not specified in the original source, but is referenced in a separate aspx by way of an iFrame. If I open the separate aspx that contains the object in another window, I can interact with it, but how do I get the info I set in it back to the original window? Here's the reference to the iFrame from the original window's source: <IFRAME title="DemoIFrame" id="DemoIFrame" onload="DemoIFrameOnLoad(this);" name="DemoIFrame" src="http://localhost/WebFormDemo.aspx" frameBorder="no" height="1500" style="WIDTH: 100.0%; BORDER-RIGHT: thin inset; BORDER-TOP: thin inset; BORDER-LEFT: thin inset; BORDER-BOTTOM: thin groove;"></IFRAME> Within the WebFormDemo.aspx source, a table contains the id to the object that I can then interact with: id="DropDownPatType" So, if I open the iFrame in a second window and interact with the object, how do I get that information back to the original window so I can continue interacting with the original webpage? Link to comment Share on other sites More sharing options...
JohnOne Posted May 16, 2012 Share Posted May 16, 2012 I don't imagine you need to open another window, just get a reference to the frame, then the object, and set it. I think. Probably help if you posted some code you are trying, or better still the URL is it not super secret. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
buymeapc Posted May 16, 2012 Author Share Posted May 16, 2012 Unfortunately, the URL is internal, so posting it won't really help Here's something I've been trying, but I haven't had much luck with it... $oIE = _IEAttach("example"); - I opened the webpage already, so I can just attach to it $propIE = _IEPropertyGet($oIE, "locationurl") $newProp = StringReplace($propIE, "example.aspx", "WebFormDemo.aspx") $oIE1 = _IECreate($newProp) _IELoadWait($oIE1) $err = _IEHeadInsertEventScript($oIE1, "window", "onchange", "DemoIFrame.GetGroupInfo()") $oPropTxt = _IEGetObjByName($oIE1, "txtDropDownPatType") $oProp = _IEGetObjByName($oIE1, "DropDownPatType") _IEFormElementSetValue($oPropTxt, "02", 1) _IEFormElementOptionSelect($oProp, "Setting2", 1, "byText", 1); Apply Changes To Listbox $oForm = _IEFormGetObjByName($oIE1, "WebFormDemo") ;$oForm.document.parentwindow.execScript("SynchDemo()","javascript") _IEQuit($oIE1) Link to comment Share on other sites More sharing options...
JohnOne Posted May 16, 2012 Share Posted May 16, 2012 I'm not very good with _IE but I think you need a reference to the frame Something like _IEFrameGetObjByName($oIE,"DemoIFrame") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
buymeapc Posted May 16, 2012 Author Share Posted May 16, 2012 Ok, if I reference the frame, how do I then reference the object that I need to interact with? Would the id of the object from the other aspx function this way? Thanks Link to comment Share on other sites More sharing options...
JohnOne Posted May 16, 2012 Share Posted May 16, 2012 I'm not entirely sure, the way I see _IE functions around the forum probably would beGet your $oIE.$oIFrame = _IEFrameGetObjByName($oIE,"DemoIFrame")$oProp = _IEGetObjByName($oIFrame, "DropDownPatType")Then whatever you want to do with it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
buymeapc Posted May 17, 2012 Author Share Posted May 17, 2012 Ok, I've been able to set the control values in the separate window, however I'm not entirely sure how to get these values passed back to the original window. There's a javascript command that I'm trying to use to do this, but I'm not sure if it'll do what I need... _IEErrorHandlerRegister() $oIE = _IEAttach("example") $oIFrame = _IEGetObjByName($oIE, "DemoIFrame") $oIE1 = _IECreate($oIFrame.src) $oProp = _IEGetObjByName($oIE1, "DropDownPatType") _IEFormElementOptionSelect($oProp, "Setting2", 1, "byText", 1); Apply Changes To Listbox $oIE1.document.parentwindow.execScript($oIE&".SynchDemo(txtDropDownPatType)","javascript") Exit Link to comment Share on other sites More sharing options...
buymeapc Posted May 18, 2012 Author Share Posted May 18, 2012 Searching around, I found a reference to "window.top.document.myvariable". Am I on the right track with this type of command? I'm not quite sure where to go from here. How would I be able to get the element id/name from the separate iFrame and use it on the main IE object? 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