John117 Posted December 19, 2007 Share Posted December 19, 2007 (edited) 1. is it possible to create buttons to select items from map controls with out showing that portion of the webpage. (written in java) The only thing I find in the source is the gif. 2. If you click a road you get a popup. I would like the info from these popups to populate labels on the gui. I know how to get the info I need from the popups. I don't know how to do this and not show the popup (block the popup from view, I guess. Can this be done? (perhaps with gui always on top the popups could just be behind then closed as a last resort?) expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> Global Const $WM_LBUTTONDOWN = 0x0201 ;Global Const $WM_SYSCOMMAND = 0x0112 HotKeySet("{ESC}", "_Toggle") $Show = False _IEErrorHandlerRegister () $oIE = _IECreateEmbedded () ;GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] ) $GUI = GUICreate("", 1024, 600, Default, Default, $WS_POPUPWINDOW) ;$GUI = GUICreate("", 840, 600, Default, Default) ;GUICtrlCreateObj ( $ObjectVar, left, top [, width [, height ]] ) $GUIActiveX = GUICtrlCreateObj($oIE, -176, -130, 800, 800) $GUI_Button_Back = GUICtrlCreateButton("Back", 650, 20, 60, 20) $GUI_Button_Forward = GUICtrlCreateButton("Forward", 650, 50, 60, 20) $GUI_Button_Home = GUICtrlCreateButton("Home", 650, 80, 60, 20) $GUI_Button_Stop = GUICtrlCreateButton("Stop", 650, 110, 60, 20) _IENavigate ($oIE, "http://traffic.houstontranstar.org/layers/#") GUISetState(@SW_SHOW, $GUI);Show GUI GuiRegisterMsg($WM_LBUTTONDOWN, "_WinMove") ; ============================================================================ ; Main Loop ; ============================================================================ While 1 $msg = GUIGetMsg() $Pos = MouseGetPos() Sleep(10) $Pos2 = MouseGetPos() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Home _IENavigate ($oIE, "http://traffic.houstontranstar.org/layers/#") 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 ; ============================================================================ ; Functions ; ============================================================================ Func _Toggle() If $Show = True Then Global $Show = False GUISetState(@SW_SHOW, $GUI) Else Global $Show = True GUISetState(@SW_Hide, $GUI) EndIf EndFunc ;==>_Toggle Func _WinMove($HWnd, $Command, $wParam, $lParam) If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) EndFunc edit: off to the long haul home. -check back in 90 Edited December 19, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
DaleHohm Posted December 19, 2007 Share Posted December 19, 2007 (edited) OK, it's possible, but will take a lot of messing around. Here's some brainstorming... What you have is an imagemap. All of the links in an imagemap actually are part of the _IELinkGetCollection collection. Your href's look like this: href="java script:showWin('/layers/getinc.aspx?incnum=67945','inc') You could loop through the link collection and rewrite the hrefs to output to a hidden iFrame instead of executing the javasctipt... so change that last one to be .href="/layers/getinc.aspx?incnum=67945" and add a .target="hiddenIFrame' You would first have had to append an <iFrame name="hiddenIFRAME" src="about:blank" height=0 width=0> to your page You'd then have to have an onload event registered for the iFrame to alert you to go read the contents... Interesting, but very complicated. Dale Edit: .target needs to be a seperate attribute from .href Edited December 20, 2007 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...
John117 Posted December 20, 2007 Author Share Posted December 20, 2007 Thanks Ill makes sense of this and try to put it to script as soon as I get back from dinner. -had by brain fried tonight trying to recover a 500gb harddrive. believe it or not it has two malfunctions. One it wouldnt spin (fixed) and the other . . . who knows, wont appear on the computer now but only turns on when I attach the usb to the computer . . . Link to comment Share on other sites More sharing options...
John117 Posted December 20, 2007 Author Share Posted December 20, 2007 I am thinking this is the starter for the first question? if so could you please clarify what you mean by seperate? Also, how would rewriting this affect the auto refresh?Your href's look like this: href="java script:showWin('/layers/getinc.aspx?incnum=67945','inc')You could loop through the link collection and rewrite the hrefs to output to a hidden iFrame instead of executing the javasctipt... so change that last one to be .href="/layers/getinc.aspx?incnum=67945" and add a .target="hiddenIFrame'Edit: .target needs to be a seperate attribute from .hrefand this the second?You would first have had to append an <iFrame name="hiddenIFRAME" src="about:blank" height=0 width=0> to your pageYou'd then have to have an onload event registered for the iFrame to alert you to go read the contents... I follow the first part, but not the onload event. any examples on this or is the untreaded ground . . .Thanks as alwasys. Always a good thing to learn to work with IE. So far I have just auto filled, and parsed. (no source manipulation) Link to comment Share on other sites More sharing options...
DaleHohm Posted December 20, 2007 Share Posted December 20, 2007 I am thinking this is the starter for the first question? if so could you please clarify what you mean by seperate? Also, how would rewriting this affect the auto refresh? and this the second? I follow the first part, but not the onload event. any examples on this or is the untreaded ground . . . Thanks as alwasys. Always a good thing to learn to work with IE. So far I have just auto filled, and parsed. (no source manipulation) For rewriting the links: $oLinks = _IELinkGetCollection($oIE) For $oLink in $oLinks $sHref = String($oLink.href) If StringInStr($sHref, "showWin(") Then $sUrl = blah ; parse the url portion out of the href $oLink.href = $sUrl $oLink.target = "hiddenIFrame" EndIf NextoÝ÷ ØZ+{®Ø§Ø^']zx©ºÇ:"{®ÑÓ0±h®· Ë^®)ඨZuëÞÚ'¶¢¶¦y«¢+ØÀÌØí½%ɵô}%ɵÑ=© å9µ ÀÌØí½%°ÅÕ½Ðí¡¥¹%ɵÅÕ½Ðì¤(ÀÌØí½ÙÑ%ɵô=©Ù¹Ð ÀÌØí½%ɵ°ÅÕ½Ðí}ÙÑ%ɵ|ÅÕ½Ðì¤()Õ¹}ÙÑ%ɵ}=¹1½ ¤(ìÁÉ͹н¸Ñ¡½¹Ñ¹Ñ̽ѡ¥Éµ)¹Õ¹oÝ÷ Øò¢êæj)éj«yúÞ²¬Ê·öYgyçm¢ÇjYh~Øb²êZ¨§Ê·öYgyçm¢)ìz»mè©Ê·öYgyçm¢·°®+^jYh~Ø^)ä³*.綵£DZ·z·§qëh¶¢¶¦y·j붨Ú'z+"ö¥ÖyÖµêíêÞ~·¬*.ßÙe綷Mú Kí ZÚ Again, interesting, but complicated. It will also take a lot of code to make it bullet-proof. Go into this with your eyes open -- it will be a lot of work... 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...
John117 Posted December 20, 2007 Author Share Posted December 20, 2007 (edited) Thanks for the reply! Ok, here is my first attempt to make sense of the below not working. I think the "If" is not true so it is being skipped. - I initially added a msgbox to see if it popped up. -didnt. So I am guessing that "showWin(" is the issue. $oLinks = _IELinkGetCollection($oIE) For $oLink in $oLinks $sHref = String($oLink.href) If StringInStr($sHref, "showWin(") Then $sUrl = blah ; parse the url portion out of the href $oLink.href = $sUrl $oLink.target = "hiddenIFrame" EndIf Next After a few more attempts I learned and added the following. expandcollapse popup_IENavigate ($oIE, "http://traffic.houstontranstar.org/layers/#") $oLinks = _IELinkGetCollection($oIE) Dim $avArray[1] $avArray[0] = "Start" For $oLink in $oLinks $sHref = String($oLink.href) _ArrayAdd( $avArray, $sHref) If StringInStr($sHref, "showWin(") Then $sUrl = "" ;StringTrimLeft(StringTrimRight("Blah", $X), $X) ; parse the url portion out of the href $oLink.href = $sUrl $oLink.target = "hiddenIFrame" EndIf Next _ArrayDisplay( $avArray, "Whole array"oÝ÷ ØÚ0!Ƨ±çébKjh.zË"¶¬¦§´!¢é]mì(®H§Ø^¢w¬Â+azwb%GÇîW(uæÞºÚ"µÍKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKB]]Ò]Ú[ÛËKH ]JB]]Ü^S[YBØÜ[Ý[ÛU[]H]]Ò]ØÜØÙHKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKBÈØÜÝHY[ÝÛÙH[ÝÈBÚ[ÛYH ÑÕRPÛÛÝ[Ë]LÉÝÂÚ[ÛYH ÒQK]LÉÝÂÚ[ÛYH Ð^K]LÉÝÂÛØ[ÛÛÝ ÌÍÕÓWÓUÓÕÓHBÝÙ^TÙ] ][ÝÞÑTÐßI][ÝË ][Ý×ÕÙÙÛI][ÝÊBÌÍÔÚÝÈH[ÙBÒQQÜ[YÚÝ BÌÍÛÒQHHÒQPÜX]Q[XYY BÑÕRPÜX]H ][ÝÝ]I][ÝÈËÚYËZYÚËYËÜËÝ[HË^Ý[HË[WWWWWWH BÌÍÑÕRHHÕRPÜX]J ][ÝÉ][ÝËL Y][Y][ ÌÍÕÔ×ÔÔTÒSÕÊBÑÕRPÝÜX]SØ ÌÍÓØXÝYÜËÚYËZYÚWH BÌÍÑÕRPXÝ]VHÕRPÝÜX]SØ ÌÍÛÒQKLMÍLLÌ BÌÍÑÕRWÐ]ÛÐXÚÈHÕRPÝÜX]P]Û ][ÝÐXÚÉ][ÝË L BÌÍÑÕRWÐ]ÛÑÜØHÕRPÝÜX]P]Û ][ÝÑÜØ ][ÝË L L BÌÍÑÕRWÐ]ÛÒÛYHHÕRPÝÜX]P]Û ][ÝÒÛYI][ÝË L BÌÍÑÕRWÐ]ÛÔÝÜHÕRPÝÜX]P]Û ][ÝÔÝÜ ][ÝË LLL BÒQS]YØ]H ÌÍÛÒQK ][ÝÚËÝYXËÝÝÛ[ÝÜËÛ^YËÈÉ][ÝÊBÌÍÛÓ[ÜÈHÒQS[ÑÙ]ÛÛXÝ[Û ÌÍÛÒQJB[H ÌÍØ]^VÌWBÌÍØ]^VÌHH ][ÝÔÝ ][ÝÂÜ ÌÍÛÓ[È[ ÌÍÛÓ[Ü ÌÍÜÒYHÝ[Ê ÌÍÛÓ[ËYBWÐ^PY ÌÍØ]^K ÌÍÜÒYBYÝ[Ò[Ý ÌÍÜÒY ][ÝÜÚÝÕÚ[ ][ÝÊH[ ÌÍÜÕH ][ÝÉ][ÝÈÔÝ[Õ[SY Ý[Õ[TYÚ ][ÝÐZ ][ÝË ÌÍÖ K ÌÍÖ HÈÙHHÜ[ÛÝ]ÙHY ÌÍÛÓ[ËYH ÌÍÜÕ ÌÍÛÓ[ËÙ]H ][ÝÚY[Q[YI][ÝÂ[Y^Ð^QÜ^J ÌÍØ]^K ][ÝÕÚÛH^I][ÝÈ BÕRTÙ]Ý]JÕ×ÔÒÕË ÌÍÑÕRJNÔÚÝÈÕRBÝZTYÚÝÙÊ ÌÍÕÓWÓUÓÕÓ ][Ý×ÕÚ[[ÝI][ÝÊBÈOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÈXZ[ÛÜÈOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÚ[HB ÌÍÛÙÈHÕRQÙ]ÙÊ BÙ[XÝØÙH ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑB^]ÛÜØÙH ÌÍÛÙÈH ÌÍÑÕRWÐ]ÛÒÛYBÒQS]YØ]H ÌÍÛÒQK ][ÝÚËÝYXËÝÝÛ[ÝÜËÛ^YËÈÉ][ÝÊBØÙH ÌÍÛÙÈH ÌÍÑÕRWÐ]ÛÐXÚÂÒQPXÝ[Û ÌÍÛÒQK ][ÝØXÚÉ][ÝÊBØÙH ÌÍÛÙÈH ÌÍÑÕRWÐ]ÛÑÜØÒQPXÝ[Û ÌÍÛÒQK ][ÝÙÜØ ][ÝÊBØÙH ÌÍÛÙÈH ÌÍÑÕRWÐ]ÛÔÝÜÒQPXÝ[Û ÌÍÛÒQK ][ÝÜÝÜ ][ÝÊB[Ù[XÝÑ[ÈOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÈ[Ý[ÛÂÈOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOB[ÈÕÙÙÛJ BY ÌÍÔÚÝÈHYH[ÛØ[ ÌÍÔÚÝÈH[ÙBÕRTÙ]Ý]JÕ×ÔÒÕË ÌÍÑÕRJB[ÙBÛØ[ ÌÍÔÚÝÈHYBÕRTÙ]Ý]JÕ×ÒYK ÌÍÑÕRJB[Y[[ÈÏOIÝ×ÕÙÙÛB[ÈÕÚ[[ÝJ ÌÍÒÛ ÌÍÐÛÛ[X[ ÌÍÝÔ[K ÌÍÛ[JBY]S Ú[Ù]Ý]J ÌÍÒÛ KÌH[] ÌÍÑÕRWÔSQTÑÂØ[ ][ÝÝÙÌ ][ÝË ][ÝÛÛÉ][ÝË ][ÝÔÙ[YÜØYÙI][ÝË ][ÝÚÛ ][ÝË ÌÍÒÛ ][ÝÚ[ ][ÝË ÌÍÕÓWÔÖTÐÓÓSPS ][ÝÚ[ ][ÝËK ][ÝÚ[ ][ÝË B[[ Edit; whats up with the funny symbols when I try to edit lately? Edited December 20, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
DaleHohm Posted December 20, 2007 Share Posted December 20, 2007 You misunderstand "blah". It is a technical term that means implementation details left to the student. In this case it means take the $sHref string and do some string parsing magic that pulls out the '/layers/getinc.aspx?incnum=67945' portion of it and puts it into $sUrl. 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...
John117 Posted December 20, 2007 Author Share Posted December 20, 2007 (edited) Yeah I got that. That was my first attempt at completing it. But then I figured that it wasnt getting past If StringInStr($sHref, "showWin(") ThenoÝ÷ Ù*i×^vØ^ë,j£§v÷«øv+H¶§¦V²yÜ"¶Ú®*.±ªëk+-YHb¶¸ Ð¥yªÞuëÞ¯+ax-¢Ö¤z¶¦z˧^jwlµªíyÚ/z¶v)භjºÚÊX§zËayÊ&éíyÚ.¶Ç¶*'Â+anV¡Á«#ºËm¢ÈhÃ^â- ¹Z«¨·Mú°zÞ~«¨·§´bv¯z+bØ^ê'~*쵫mzjmÂ+aÛ¶§»¶©¢)í¡ûaz,·¬¶Þ®'òò,¥u·©àxºÚ"µÍYÝ[Ò[Ý ÌÍÜÒY ][ÝÜÚÝÕÚ[ ][ÝÊH[ according to the array return? Thanks Edited December 20, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
DaleHohm Posted December 20, 2007 Share Posted December 20, 2007 write out $sHref to the console so you can see what it contains... are you intending to set $sUrl to "" or have you just not worked that piece of code yet? 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...
John117 Posted December 20, 2007 Author Share Posted December 20, 2007 (edited) Dale -is it different than what I can see in the array? -if so I will have to learn consoleread. (no example given but I think I can manage if needed) I wrote it out first thing. But then when it didnt pass the 'If/Then' I started over. here it is again, If I am correct in what I did before (or at all) _IENavigate ($oIE, "http://traffic.houstontranstar.org/layers/#") $oLinks = _IELinkGetCollection($oIE) Dim $avArray[1] $avArray[0] = "Start" For $oLink in $oLinks $sHref = String($oLink.href) _ArrayAdd( $avArray, $sHref) If StringInStr($sHref, "showWin(") Then Msgbox(0, "Working", "'showWin(' Found") $sUrl = StringTrimLeft(StringTrimRight($sHref, 8), 23) ; parse the url portion out of the href $oLink.href = $sUrl $oLink.target = "hiddenIFrame" EndIf Next _ArrayDisplay( $avArray, "Whole array" ) -ofcourse the trim is based on what you posted in the initial sring length Edited December 20, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
John117 Posted December 20, 2007 Author Share Posted December 20, 2007 (edited) getting closer . . . expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.9.9 (beta) Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstants.au3> #include <IE.au3> #include <Array.au3> Global Const $WM_LBUTTONDOWN = 0x0201 HotKeySet("{ESC}", "_Toggle") $Show = False _IEErrorHandlerRegister () $oIE = _IECreateEmbedded () ;GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] ) $GUI = GUICreate("", 1024, 600, Default, Default, $WS_POPUPWINDOW) ;GUICtrlCreateObj ( $ObjectVar, left, top [, width [, height ]] ) $GUIActiveX = GUICtrlCreateObj($oIE, -176, -130, 800, 800) $GUI_Button_Back = GUICtrlCreateButton("Back", 650, 20, 60, 20) $GUI_Button_Forward = GUICtrlCreateButton("Forward", 650, 50, 60, 20) $GUI_Button_Home = GUICtrlCreateButton("Home", 650, 80, 60, 20) $GUI_Button_Stop = GUICtrlCreateButton("Stop", 650, 110, 60, 20) _IENavigate ($oIE, "http://traffic.houstontranstar.org/layers/#") ;$oEvtMain = ObjEvent($oIE, "_EvtMain_onload") _EvtMain_onload() _EvtMain_onload() GUISetState(@SW_SHOW, $GUI);Show GUI GuiRegisterMsg($WM_LBUTTONDOWN, "_WinMove") ; ============================================================================ ; Main Loop ; ============================================================================ While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Home _IENavigate ($oIE, "http://traffic.houstontranstar.org/layers/#") 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 ; ============================================================================ ; Functions ; ============================================================================ Func _Toggle() If $Show = True Then Global $Show = False GUISetState(@SW_SHOW, $GUI) Else Global $Show = True GUISetState(@SW_Hide, $GUI) EndIf EndFunc ;==>_Toggle Func _WinMove($HWnd, $Command, $wParam, $lParam) If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) EndFunc Func _EvtMain_onload() $oEvtIFrame = 0 _IEDocInsertHTML($oIE, '<iFrame name="hiddenIFrame" src="about:blank" height=0 width=0>', "afterend") $oIFrame = _IEFrameGetObjByName($oIE, "hiddenIFrame") $oEvtIFrame = ObjEvent($oIFrame, "_EvtIFrame_") $oLinks = _IELinkGetCollection($oIE) Dim $avArray[1] $avArray[0] = "Start" For $oLink in $oLinks $sHref = String($oLink.href) If StringInStr($sHref, "showWin(") Then ;Msgbox(0, "Working", "'showWin(' Found") $sUrl = StringTrimLeft(StringTrimRight($sHref, 10), 20) ; parse the url portion out of the href _ArrayAdd( $avArray, $sUrl) $oLink.href = '.href="' & $sUrl $oLink.target = "hiddenIFrame" EndIf Next _ArrayDisplay( $avArray, "Whole array" ) EndFunc Func _EvtIFrame_onload() ; parse and act on the contents of the iFrame $oIE2 = _IEAttach("hiddenIFrame") $oTables = _IETagNameGetCollection($oIE2, "table") $index = 0 For $oTable in $oTables _IETagNameGetCollection($oTable, "table") If Not @extended Then $aTable = _IETableWriteToArray($oTable2, True) _ArrayDisplay($aTable, "Table index: " & $index) EndIf $index += 1 Next EndFunc Edited December 20, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
John117 Posted December 20, 2007 Author Share Posted December 20, 2007 ok, its able to get the link! probs: 1. the onload stuff isnt working so I am running it twice in the beginning. 2. its visible 3. Still not sure how to simulate clicking the 'cameras', 'signs' or other checkboxes on the origional webpage. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.9.9 (beta) Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstants.au3> #include <IE.au3> #include <Array.au3> Global Const $WM_LBUTTONDOWN = 0x0201 HotKeySet("{ESC}", "_Toggle") $Show = False _IEErrorHandlerRegister () $oIE = _IECreateEmbedded () ;GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] ) $GUI = GUICreate("", 1024, 600, Default, Default, $WS_POPUPWINDOW) ;GUICtrlCreateObj ( $ObjectVar, left, top [, width [, height ]] ) $GUIActiveX = GUICtrlCreateObj($oIE, -176, -130, 800, 800) $GUI_Button_Back = GUICtrlCreateButton("Back", 650, 20, 60, 20) $GUI_Button_Forward = GUICtrlCreateButton("Forward", 650, 50, 60, 20) $GUI_Button_Home = GUICtrlCreateButton("Home", 650, 80, 60, 20) $GUI_Button_Stop = GUICtrlCreateButton("Stop", 650, 110, 60, 20) _IENavigate ($oIE, "http://traffic.houstontranstar.org/layers/#") ;$oEvtMain = ObjEvent($oIE, "_EvtMain_onload") _EvtMain_onload() _EvtMain_onload() GUISetState(@SW_SHOW, $GUI);Show GUI GuiRegisterMsg($WM_LBUTTONDOWN, "_WinMove") ; ============================================================================ ; Main Loop ; ============================================================================ While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Home _IENavigate ($oIE, "http://traffic.houstontranstar.org/layers/#") 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 ; ============================================================================ ; Functions ; ============================================================================ Func _Toggle() If $Show = True Then Global $Show = False GUISetState(@SW_SHOW, $GUI) Else Global $Show = True GUISetState(@SW_Hide, $GUI) EndIf EndFunc ;==>_Toggle Func _WinMove($HWnd, $Command, $wParam, $lParam) If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) EndFunc ;href="java script:showWin('/layers/getinc.aspx?incnum=67945','inc') ;.href="/layers/getinc.aspx?incnum=67945" Func _EvtMain_onload() $oEvtIFrame = 0 _IEDocInsertHTML($oIE, '<iFrame name="hiddenIFrame" src="about:blank" height=0 width=0>', "afterend") $oIFrame = _IEFrameGetObjByName($oIE, "hiddenIFrame") $oEvtIFrame = ObjEvent($oIFrame, "_EvtIFrame_") $oLinks = _IELinkGetCollection($oIE) Dim $avArray[1] $avArray[0] = "Start" For $oLink in $oLinks $sHref = String($oLink.href) If StringInStr($sHref, "showWin(") Then ;Msgbox(0, "Working", "'showWin(' Found") $sUrl = StringTrimLeft(StringTrimRight($sHref, 10), 28) ; parse the url portion out of the href _ArrayAdd( $avArray, $sUrl) $oLink.href = $sUrl $oLink.target = "hiddenIFrame" EndIf Next _ArrayDisplay( $avArray, "Whole array" ) EndFunc Func _EvtIFrame_onload() ; parse and act on the contents of the iFrame $oIE2 = _IEAttach("hiddenIFrame") $oTables = _IETagNameGetCollection($oIE2, "table") $index = 0 For $oTable in $oTables _IETagNameGetCollection($oTable, "table") If Not @extended Then $aTable = _IETableWriteToArray($oTable2, True) _ArrayDisplay($aTable, "Table index: " & $index) EndIf $index += 1 Next EndFunc Link to comment Share on other sites More sharing options...
DaleHohm Posted December 20, 2007 Share Posted December 20, 2007 Dale -is it different than what I can see in the array? -if so I will have to learn consoleread. (no example given but I think I can manage if needed) I wrote it out first thing. But then when it didnt pass the 'If/Then' I started over. here it is again, If I am correct in what I did before (or at all) _IENavigate ($oIE, "http://traffic.houstontranstar.org/layers/#") $oLinks = _IELinkGetCollection($oIE) Dim $avArray[1] $avArray[0] = "Start" For $oLink in $oLinks $sHref = String($oLink.href) _ArrayAdd( $avArray, $sHref) If StringInStr($sHref, "showWin(") Then Msgbox(0, "Working", "'showWin(' Found") $sUrl = StringTrimLeft(StringTrimRight($sHref, 8), 23) ; parse the url portion out of the href $oLink.href = $sUrl $oLink.target = "hiddenIFrame" EndIf Next _ArrayDisplay( $avArray, "Whole array" )oÝ÷ ÚÜ¢êìzØ^¶¸¦ÆÚ±çhZ·*.¦-yا¶¢+bj[+x%zx-ú®¢×¶¶§ëaz·ëp À²í«ijÛazÞ~Çè®Ø^²)íçâ®ËZ¦®)íââK¢Y^rب»¶¨ë2¢ìا¶¬yÊ'uÚ'£¨{-y§h~ë"ax¸§Ç(W¶*'r·µæ¢Y^rبíàZƧvÖ¤zØ^±©¦èiÈZ³Ø^)ä°DÈZ½èkyö§vÖ«ëi®^®Ø±«0zYZºÚ"µÍÌÍÛÐXÈHÒQUYÓ[YQÙ]ÛÛXÝ[Û ÌÍÛÒQK ][ÝØXI][ÝÊBÜ ÌÍÛÐXH[ ÌÍÛÐXÂPÛÛÛÛUÜ]J ÌÍÛÐXKY [ÈÔB^ 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...
John117 Posted December 20, 2007 Author Share Posted December 20, 2007 (edited) please see the post above yours and let me know if I still need areas . . . As currently set, my last post requires two passes to get the results I have. edit: swiched out for $oArea in copy. Getting no return in array. off for the long hall home. will check in when I get there. Edited December 20, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
DaleHohm Posted December 21, 2007 Share Posted December 21, 2007 I've made some mods to the code. The onload events are NOT firing as you have observed... plus I am getting flaky link collections that I cannot yet explain. I am worried that the HTML structure has some errors in it and this can sometimes confuse the DOM (see the DebugBar HTML Check tab). Anyway, see some of the changes I implemented: expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> #include <Array.au3> ;#AutoIt3Wrapper_run_debug_mode=Y Global Const $WM_LBUTTONDOWN = 0x0201 Global $oIE, $oIFrame HotKeySet("{ESC}", "_Toggle") $Show = False _IEErrorHandlerRegister() $oIE = _IECreateEmbedded() $GUI = GUICreate("", 1024, 600, Default, Default, $WS_POPUPWINDOW) $GUIActiveX = GUICtrlCreateObj($oIE, -176, -130, 800, 800) $GUI_Button_Back = GUICtrlCreateButton("Back", 650, 20, 60, 20) $GUI_Button_Forward = GUICtrlCreateButton("Forward", 650, 50, 60, 20) $GUI_Button_Home = GUICtrlCreateButton("Home", 650, 80, 60, 20) $GUI_Button_Stop = GUICtrlCreateButton("Stop", 650, 110, 60, 20) GUISetState(@SW_SHOW, $GUI);Show GUI GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove") $oEvtMain = ObjEvent($oIE, "EvtMain_") _IENavigate($oIE, "http://traffic.houstontranstar.org/layers/#") EvtMain_onload() ; ============================================================================ ; Main Loop ; ============================================================================ While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Home _IENavigate($oIE, "http://traffic.houstontranstar.org/layers/#") 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 ; ============================================================================ ; Functions ; ============================================================================ Func EvtMain_onload() ConsoleWrite("----> In EvtMain_onload()" & @CR) $oEvtIFrame = 0 $oBody = _IETagNameGetCollection($oIE, "body", 0) _IEDocInsertHTML($oBody, '<iFrame name="hiddenIFrame" src="about:blank" height=0 width=0>', "afterbegin") $oIFrame = _IEFrameGetObjByName($oIE, "hiddenIFrame") $oEvtIFrame = ObjEvent($oIFrame, "EvtIFrame_") $oMaps = _IETagNameGetCollection($oIE, "map") ConsoleWrite(@extended & @CR) Dim $avArray[1] For $oMap In $oMaps $oLinks = _IETagNameGetCollection($oMap, "area") ReDim $avArray[1] $avArray[0] = "Start" For $oLink In $oLinks $sHref = String($oLink.href) ConsoleWrite("----> " & $sHref & @CR) If StringInStr($sHref, "showWin(") Then ConsoleWrite("----> Working, showWin( Found " & $sHref & @CR) $sUrl = StringTrimLeft(StringTrimRight($sHref, 10), 28) ; parse the url portion out of the href _ArrayAdd($avArray, $sUrl) $oLink.href = $sUrl $oLink.target = "hiddenIFrame" EndIf Next _ArrayDisplay($avArray, "Whole array") Next EndFunc ;==>EvtMain_onload Func EvtIFrame_onload() ConsoleWrite("----> In EvtIFrame_onload()" & @CR) ; parse and act on the contents of the iFrame ;$oIE2 = _IEFrameGetObjByName($oIE, "hiddenIFrame") ConsoleWrite(_IEDocReadHTML($oIFrame) & @CR) $oTables = _IETagNameGetCollection($oIFrame, "table") $index = 0 For $oTable In $oTables _IETagNameGetCollection($oTable, "table") If Not @extended Then $aTable = _IETableWriteToArray($oTable, True) _ArrayDisplay($aTable, "Table index: " & $index) EndIf $index += 1 Next EndFunc ;==>EvtIFrame_onload Func _Toggle() If $Show = True Then Global $Show = False GUISetState(@SW_SHOW, $GUI) Else Global $Show = True GUISetState(@SW_HIDE, $GUI) EndIf EndFunc ;==>_Toggle Func _WinMove($HWnd, $Command, $wParam, $lParam) If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) EndFunc ;==>_WinMove 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...
John117 Posted December 21, 2007 Author Share Posted December 21, 2007 First, -Thanks for looking at this so early in the morning! I am doing a side by side right now to see the differences. First thing noticed is that links cause a ie shutdown and error. As soon as I finish adapting my code to yours line by line and understand all the changes I till get back with the outcome and any more progress. Thanks! Link to comment Share on other sites More sharing options...
John117 Posted December 21, 2007 Author Share Posted December 21, 2007 how weird! My posted code that worked yesterday is not working now, nor is yours. whats the deal here? -worked, but suddenly doesn't? Are they changing the source. Is it just a bug as you mentioned. . . Link to comment Share on other sites More sharing options...
DaleHohm Posted December 21, 2007 Share Posted December 21, 2007 I think it may be a good idea to put together a proof of concept with a different site (simpler and more stable) and then move back to your initial site after the conceptual issues are all understood. Too many variables. 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...
John117 Posted December 21, 2007 Author Share Posted December 21, 2007 yeah, I can do that. I just wish I understood why I could use the code yesterday, but today the code (unchanged) does not work. Link to comment Share on other sites More sharing options...
John117 Posted December 21, 2007 Author Share Posted December 21, 2007 It appears that the issue with both scripts in that the page fails to fully load before the execution of Evtmain_ Reason for working today and not yesterday: my internet connection is slower today. $oEvtMain = ObjEvent($oIE, "EvtMain_")oÝ÷ ÙÚ³ +»ç²Ú+º{pǺÚ"µÍÒQS]YØ]J ÌÍÛÒQK ][ÝÚËÝYXËÝÝÛ[ÝÜËÛ^YËÈÉ][ÝÊB×ÒQSØYØZ] ÌÍÛÒQJBÛY L BÌÍÛÑ]XZ[HØ][ ÌÍÛÒQK ][ÝÑ]XZ[É][ÝÊB]XZ[ÛÛØY load wait does not seem to slow it . . . only remain issues are: 1. While click seems to do something, I dont see it. 2. how to select the checkboxes on the origional page (hidden above view of the current gui) 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