Bert Posted July 5, 2007 Share Posted July 5, 2007 (edited) I have 2 problems with this script, and I could use some assistance. Problem one - How do I make it so is a hyperlink appears in my marquee, it will open in a new pane instead of the marquee? Problem two - When my script exits - it closes all my IE windows. I thought I have it so I have a process id on the panes in the viewer so it wouldn't do that. Not sure on how to fix it. expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> #Include <Constants.au3> _IEErrorHandlerRegister() $oIE = _IECreateEmbedded() $oIE2 = _IECreateEmbedded() $w = @DesktopWidth $h = @DesktopHeight $h1 = $h - 150 $w1 = $w - 40 $w2 = $w - 60 $h2 = $h - 25 Dim $ininame, $IniButtonNames, $iniweb _inisettings() $title = $ininame[1][1] $gui = GUICreate($title, $w1, $h1, -1, -1, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN)) ;main pane $label1 = GUICtrlCreateLabel("", 10, 68, $w - 60, $h - 230) GUICtrlSetBkColor(-1, 0xff0000) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetState(-1, $GUI_HIDE) ;marquee pane $label2 = GUICtrlCreateLabel("", 10, 40, $w1 - 20, 23) GUICtrlSetBkColor(-1, $GUI_DISABLE) GUICtrlSetState(-1, $GUI_HIDE) $oIE1 = _IECreate("about:blank", 0, 0) ; creates an invisible instance of a regular browser window $oIE1.AddressBar = 0 ; turn off all four IE Bars - works on 3rd party bars too, mostly. $oIE1.MenuBar = 0 $oIE1.StatusBar = 0 $oIE1.ToolBar = 0 $uID1 = Random(1000, 100000000) ; give it a unique name so we can grab the correct handle and process ID $oIE1.document.title = $uID1 WinWait($uID1) $hoIE1 = WinGetHandle($uID1) $mainwwindow = WinGetHandle($title) $pid1 = WinGetProcess($hoIE1) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hoIE1, "int", -16, "long", $WS_POPUP) DllCall("user32.dll", "int", "SetParent", "hwnd", $hoIE1, "hwnd", $gui) $oIE2 = _IECreate("about:blank", 0, 0) $oIE2.AddressBar = 0 $oIE2.MenuBar = 0 $oIE2.StatusBar = 0 $oIE2.ToolBar = 0 $uID2 = Random(1000, 100000000) $oIE2.document.title = $uID2 WinWait($uID2) $hoIE2 = WinGetHandle($uID2) $pid2 = WinGetProcess($hoIE2) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hoIE2, "int", -16, "long", $WS_POPUP) DllCall("user32.dll", "int", "SetParent", "hwnd", $hoIE2, "hwnd", $gui) repositionIEs() $GUI_Button_CTS_web = GUICtrlCreateButton($IniButtonNames[1][1], 10, 5, 70, 30) GUICtrlSetResizing($GUI_Button_CTS_web, 8) $GUI_Button_Depot_web = GUICtrlCreateButton($IniButtonNames[2][1], 85, 5, 80, 30) GUICtrlSetResizing($GUI_Button_Depot_web, 8) $GUI_Button_SC_web = GUICtrlCreateButton($IniButtonNames[3][1], 170, 5, 80, 30) GUICtrlSetResizing($GUI_Button_SC_web, 8) $GUI_Button_problem_board = GUICtrlCreateButton($IniButtonNames[4][1], 255, 5, 100, 30) GUICtrlSetResizing($GUI_Button_problem_board, 8) $GUI_Button_Service_request = GUICtrlCreateButton($IniButtonNames[5][1], 360, 5, 90, 30) GUICtrlSetResizing($GUI_Button_Service_request, 8) $GUI_Button_SR_Archive = GUICtrlCreateButton($IniButtonNames[6][1], 455, 5, 135, 30) GUICtrlSetResizing($GUI_Button_SR_Archive, 8) $GUI_Button_Field_operations = GUICtrlCreateButton($IniButtonNames[7][1], 595, 5, 90, 30) GUICtrlSetResizing($GUI_Button_Field_operations, 8) $GUI_Input_Search = GUICtrlCreateInput($IniButtonNames[8][1], 695, 10, 200, 20) GUICtrlSetResizing($GUI_Input_Search, 8) $GUI_Button_Search = GUICtrlCreateButton($IniButtonNames[9][1], 910, 5, 50, 30) GUICtrlSetResizing($GUI_Button_Search, 8) $GUI_Button_Search_sub = GUICtrlCreateButton($IniButtonNames[10][1], 970, 5, 65, 30) GUICtrlSetResizing($GUI_Button_Search_sub, 8) AdlibEnable('_marqueecontrol', 15 * 60000) ;AdlibEnable('_marqueecontrol', 30000) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; WinActivate($gui) GUISetState() $oIE1.visible = 1 $oIE2.visible = 1 _marqueecontrol() WinActivate($oIE1) _IENavigate($oIE1, $iniweb[1][1]) While 1 $msg = GUIGetMsg() $trr = WinGetTitle($hoIE1) Select Case $trr = $ininame[3][1] ExitLoop Case $msg = $GUI_EVENT_CLOSE $t1 = $ininame[3][1] $t2 = $ininame[4][1] WinActivate($hoIE1) $trr = WinGetTitle($hoIE1) If $trr = $t1 Then ExitLoop If $trr = $t2 Then ExitLoop WinActivate($hoIE1) Send("!u") Sleep(10) Send('e') Do $trr = WinGetTitle($hoIE1) Sleep(100) Until $trr = $t2 Or $trr = $t1 ExitLoop Case sizeEvent($msg) repositionIEs() ;~ Case $msg = $GUI_EVENT_RESIZED ;possible bug - taken out for the moment to test later ;_ResizeLimit($Title, "",$w - 100, $h - 100, @DesktopWidth, @DesktopHeight) Case $msg = $GUI_Button_CTS_web _IECreate($iniweb[2][1]) WinActivate($oIE1) Case $msg = $GUI_Button_Depot_web _IECreate($iniweb[3][1]) WinActivate($oIE1) Case $msg = $GUI_Button_SC_web _IECreate($iniweb[4][1]) WinActivate($oIE1) Case $msg = $GUI_Button_problem_board _IECreate($iniweb[5][1]) WinActivate($oIE1) Case $msg = $GUI_Button_Service_request _IECreate($iniweb[6][1]) WinActivate($oIE1) Case $msg = $GUI_Button_SR_Archive _IECreate($iniweb[7][1]) WinActivate($oIE1) Case $msg = $GUI_Button_Field_operations _IECreate($iniweb[8][1]) WinActivate($oIE1) Case $msg = $GUI_Button_Search MsgBox(0, "", "Under construction", 5) WinActivate($oIE1) Case $msg = $GUI_Button_Search_sub _IECreate($iniweb[10][1]) WinActivate($oIE1) EndSelect WEnd GUIDelete($gui) While ProcessExists($pid1) ProcessClose($pid1) WEnd While ProcessExists($pid2) ProcessClose($pid2) WEnd Func _ResizeLimit($title, $Text = "", $MinWidth = 150, $MinHeight = 150, $MaxWidth = @DesktopWidth, $MaxHeight = @DesktopHeight) If Not WinExists($title, $Text) Then Return SetError(1, 0, -1) Local $PosArr = WinGetPos($title, $Text), $xPos, $yPos, $wPos, $hPos If IsArray($PosArr) Then $xPos = $PosArr[0] $yPos = $PosArr[1] $wPos = $PosArr[2] $hPos = $PosArr[3] If ($wPos <> $MinWidth And $hPos <> $MinHeight) Or ($wPos <> $MaxWidth And $hPos <> $MaxHeight) Then If $wPos < $MinWidth And $hPos < $MinHeight Then WinMove($title, $Text, $xPos, $yPos, $MinWidth, $MinHeight) If $wPos < $MinWidth And $hPos >= $MinHeight Then WinMove($title, $Text, $xPos, $yPos, $MinWidth, $hPos) If $wPos >= $MinWidth And $hPos < $MinHeight Then WinMove($title, $Text, $xPos, $yPos, $wPos, $MinHeight) If $wPos > $MaxWidth And $hPos > $MaxHeight Then WinMove($title, $Text, $xPos, $yPos, $MaxWidth, $MaxHeight) If $wPos > $MaxWidth And $hPos <= $MaxHeight Then WinMove($title, $Text, $xPos, $yPos, $MaxWidth, $hPos) If $wPos <= $MaxWidth And $hPos > $MaxHeight Then WinMove($title, $Text, $xPos, $yPos, $wPos, $MaxHeight) EndIf EndIf EndFunc ;==>_ResizeLimit Func repositionIEs() $pos1 = ControlGetPos($gui, "", "Static1") $pos2 = ControlGetPos($gui, "", "Static2") WinMove($hoIE1, "", $pos1[0], $pos1[1], $pos1[2], $pos1[3]) WinMove($hoIE2, "", $pos2[0], $pos2[1], $pos2[2], $pos2[3]) EndFunc ;==>repositionIEs Func sizeEvent($event) If $event = $GUI_EVENT_MAXIMIZE Or _ $event = $GUI_EVENT_MINIMIZE Or _ $event = $GUI_EVENT_RESTORE Or _ $event = $GUI_EVENT_RESIZED Then Return True Else Return False EndIf EndFunc ;==>sizeEvent Func _marqueecontrol() Local $htmlfile, $makehtml $htmlfile = @ScriptDir & "\bin\html.txm" FileOpen($htmlfile, 8 + 2) FileWrite($htmlfile, "") FileClose($htmlfile) $makehtml = FileOpen($htmlfile, 8 + 1) $oIEb = _IECreate($iniweb[5][1], 0, 0) $colTables = _IETableGetCollection($oIEb, 1) $avTable = _IETableWriteToArray($colTables) $oLinks1 = _IELinkGetCollection($oIEb, 1) $iNumLinks1 = $oLinks1.href $oLinks2 = _IELinkGetCollection($oIEb, 2) $iNumLinks2 = $oLinks2.href $oLinks3 = _IELinkGetCollection($oIEb, 3) $iNumLinks3 = $oLinks3.href $oLinks4 = _IELinkGetCollection($oIEb, 4) $iNumLinks4 = $oLinks4.href $oLinks5 = _IELinkGetCollection($oIEb, 5) $iNumLinks5 = $oLinks5.href $oLinks6 = _IELinkGetCollection($oIEb, 6) $iNumLinks6 = $oLinks6.href $oLinks7 = _IELinkGetCollection($oIEb, 7) $iNumLinks7 = $oLinks7.href $oLinks8 = _IELinkGetCollection($oIEb, 8) $iNumLinks8 = $oLinks8.href $oLinks9 = _IELinkGetCollection($oIEb, 9) $iNumLinks9 = $oLinks9.href $oLinks10 = _IELinkGetCollection($oIEb, 10) $iNumLinks10 = $oLinks10.href $writehtml = FileWrite($htmlfile, '<body scroll=no topmargin=0 BGCOLOR=LTGREEN><marquee behavior=scroll direction=left scrolldelay=2 scrollamount=2 onmouseover="this.stop()" onmouseout="this.start()") ><span style="background-color: #FFFFFF">******** Solution Center Problem Board Marquee ********</span> ******** 1st >>>>>>>>> <span style="background-color: #FFFF00"><B>Last Update:</b> <a href= "' _ & $iNumLinks1 & '">' & $avTable[0][1] & "</a> <b>Master#</b> " & $avTable[1][1] _ & " <b>Description:</b> " & $avTable[2][1] _ & " <b>Region:</b> " & $avTable[3][1] _ & " <b>Resolve Date:</b> " & $avTable[4][1] & '</span> ******** 2nd >>>>>>>>> <span style="background-color: #FFFF00"><B>Last Update:</b> <a href= "' _ & $iNumLinks2 & '">' & $avTable[0][2] & "</a> <b>Master#</b> " & $avTable[1][2] _ & " <b>Description:</b> " & $avTable[2][2] _ & " <b>Region:</b> " & $avTable[3][2] _ & " <b>Resolve Date:</b> " & $avTable[4][2] & '</span> ******** 3rd >>>>>>>>> <span style="background-color: #FFFF00"><B>Last Update:</b> <a href= "' _ & $iNumLinks3 & '">' & $avTable[0][3] & "</a> <b>Master#</b> " & $avTable[1][3] _ & " <b>Description:</b> " & $avTable[2][3] _ & " <b>Region:</b> " & $avTable[3][3] _ & " <b>Resolve Date:</b> " & $avTable[4][3] & '</span> ******** 4th >>>>>>>>> <span style="background-color: #FFFF00"><B>Last Update:</b> <a href= "' _ & $iNumLinks4 & '">' & $avTable[0][4] & "</a> <b>Master#</b> " & $avTable[1][4] _ & " <b>Description:</b> " & $avTable[2][4] _ & " <b>Region:</b> " & $avTable[3][4] _ & " <b>Resolve Date:</b> " & $avTable[4][4] & '</span> ******** 5th >>>>>>>>> <span style="background-color: #FFFF00"><B>Last Update:</b> <a href= "' _ & $iNumLinks5 & '">' & $avTable[0][5] & "</a> <b>Master#</b> " & $avTable[1][5] _ & " <b>Description:</b> " & $avTable[2][5] _ & " <b>Region:</b> " & $avTable[3][5] _ & " <b>Resolve Date:</b> " & $avTable[4][5] & '</span> ******** 6th >>>>>>>>> <span style="background-color: #FFFF00">') $writehtml2 = FileWrite($htmlfile, ' <B>Last Update:</b> <a href="' & $iNumLinks6 & '">' & $avTable[0][6] & "</a> <b>Master#</b> " & $avTable[1][5] _ & " <b>Description:</b> " & $avTable[2][6] _ & " <b>Region:</b> " & $avTable[3][6] _ & " <b>Resolve Date:</b> " & $avTable[4][6] & '</span> ******** 7th >>>>>>>>> <span style="background-color: #FFFF00"><B>Last Update:</b> <a href= "' _ & $iNumLinks7 & '">' & $avTable[0][7] & "</a> <b>Master#</b> " & $avTable[1][7] _ & " <b>Description:</b> " & $avTable[2][7] _ & " <b>Region:</b> " & $avTable[3][7] _ & " <b>Resolve Date:</b> " & $avTable[4][7] & '</span> ******** 8th >>>>>>>>> <span style="background-color: #FFFF00"><B>Last Update:</b> <a href= "' _ & $iNumLinks8 & '">' & $avTable[0][8] & "</a> <b>Master#</b> " & $avTable[1][8] _ & " <b>Description:</b> " & $avTable[2][8] _ & " <b>Region:</b> " & $avTable[3][8] _ & " <b>Resolve Date:</b> " & $avTable[4][8] & '</span> ******** 9th >>>>>>>>> <span style="background-color: #FFFF00"><B>Last Update:</b> <a href= "' _ & $iNumLinks9 & '">' & $avTable[0][9] & "</a> <b>Master#</b> " & $avTable[1][9] _ & " <b>Description:</b> " & $avTable[2][9] _ & " <b>Region:</b> " & $avTable[3][9] _ & " <b>Resolve Date:</b> " & $avTable[4][9] & '</span> ******** 10th >>>>>>>>> <span style="background-color: #FFFF00"><B>Last Update:</b> <a href= "' _ & $iNumLinks10 & '">' & $avTable[0][10] & "</a> <b>Master#</b> " & $avTable[1][10] _ & " <b>Description:</b> " & $avTable[2][10] _ & " <b>Region:</b> " & $avTable[3][10] _ & " <b>Resolve Date:</b> " & $avTable[4][10] & '</span> </marquee></body>') $fr = FileRead(@ScriptDir & "\bin\html.txm") $makemarquee = _IEDocWriteHTML($oIE2, $fr) FileClose($htmlfile) EndFunc ;==>_marqueecontrol Func _inisettings() ;keeps all websites in ini file. This allows for updates. $iniweb = IniReadSection(@ScriptDir & "\bin\cfgusd.cud", "1") $IniButtonNames = IniReadSection(@ScriptDir & "\bin\cfgusd.cud", "2") $ininame = IniReadSection(@ScriptDir & "\bin\cfgusd.cud", "3") EndFunc ;==>_inisettings Edited July 5, 2007 by Volly The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
mikehunt114 Posted July 5, 2007 Share Posted July 5, 2007 I didn't go through all of your code, but it looks like you are writing some HTML based on some link collections you get. If so, did you try appending something like target="_blank" inside your link tags? My HTML is a bit rusty, but I think that's the syntax for targetting a new window. If that's not quite what you want, I think you should be able to tinker with where you're targetting your links, and get your desired result. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Bert Posted July 5, 2007 Author Share Posted July 5, 2007 I thought of that, but I wonder if there ia a way to set the window so it would do it for ANY hyperlink. This way I wouldn't have to edit the string. If I have to edit the string, thats ok. I just figure it would be somewhat tricky do do. I still am stumped about the first problem - when the script closes, all IE windows will close. Anyone got any thoughts on that? The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted July 5, 2007 Moderators Share Posted July 5, 2007 (edited) I would change this function to look more like this... Func _marqueecontrol() Dim $aLinks[11] Local $htmlfile, $makehtml $htmlfile = @ScriptDir & "\bin\html.txm" FileOpen($htmlfile, 8 + 2) FileWrite($htmlfile, "") FileClose($htmlfile) $makehtml = FileOpen($htmlfile, 8 + 1) $oIEb = _IECreate($iniweb[5][1], 0, 0) $colTables = _IETableGetCollection($oIEb, 1) $avTable = _IETableWriteToArray($colTables) $oLinks = _IELinkGetCollection($oIEb) $iNumLinks = @extended $sHTML = "" $sHTML &= '<body scroll=no topmargin=0 BGCOLOR=LTGREEN>' $sHTML &= '<marquee behavior=scroll direction=left scrolldelay=2 scrollamount=2 onmouseover="this.stop()" onmouseout="this.start()") >' $sHTML &= '<span style="background-color: #FFFFFF">******** Solution Center Problem Board Marquee ********</span>' For $i = 0 To $iNumLinks $sHTML &= ' ******** ' & $i & ' >>>>>>>>> ' $sHTML &= '<span style="background-color: #FFFF00"><B>Last Update:</b>' $sHTML &= '<a href= "' & $oLinks.item ($i).href & '">' & $avTable[0][$i + 1] & "</a> <b>Master#</b> " & $avTable[1][$i + 1] $sHTML &= " <b>Description:</b> " & $avTable[2][$i + 1] $sHTML &= " <b>Region:</b> " & $avTable[3][$i + 1] $sHTML &= " <b>Resolve Date:</b> " & $avTable[4][$i + 1] & '</span>' If $i = 9 Then ExitLoop Next $sHTML &= ' </marquee></body>' $writehtml = FileWrite($htmlfile, $sHTML) $fr = FileRead(@ScriptDir & "\bin\html.txm") $makemarquee = _IEDocWriteHTML($oIE2, $fr) FileClose($htmlfile) EndFunc ;==>_marqueecontrol Edited July 5, 2007 by big_daddy Link to comment Share on other sites More sharing options...
Bert Posted July 5, 2007 Author Share Posted July 5, 2007 That definitely shortens the code. Thanks! I will need to add back in the 's I had for they are the spaces when writting HTML. I suspect I can simply add the _blank to fix the new window problem too. THANKS! Now for the exit problem I have. I'm still stumped on when I close the script, all my IE windows close. Thoughts? The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted July 5, 2007 Moderators Share Posted July 5, 2007 Now for the exit problem I have. I'm still stumped on when I close the script, all my IE windows close. Thoughts?Because of this... While ProcessExists($pid1) ProcessClose($pid1) WEnd While ProcessExists($pid2) ProcessClose($pid2) WEnd Link to comment Share on other sites More sharing options...
Bert Posted July 5, 2007 Author Share Posted July 5, 2007 I was looking at that. From my testing, I can thought this was to rename the IE window:$oIE2.document.title = $uID2When I put a msgbox on it to see how it is naming it, I get a return of "false" The reasoning behind the processclose thing is when I close the GUI, the IE windows will remain until I force close them. (I didn't make that piece. Lod3n is the master of that code The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted July 5, 2007 Author Share Posted July 5, 2007 I think I fixed the IE closing issue. I changed the exit to this: _IEQuit($oIE1) _IEQuit($oIE2) GUIDelete($gui) The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted July 5, 2007 Moderators Share Posted July 5, 2007 You could change this section of code as well. $oIE1 = _IECreate("about:blank", 0, 0) ; creates an invisible instance of a regular browser window $oIE1.AddressBar = 0 ; turn off all four IE Bars - works on 3rd party bars too, mostly. $oIE1.MenuBar = 0 $oIE1.StatusBar = 0 $oIE1.ToolBar = 0 $hoIE1 = _IEPropertyGet($oIE1, "hwnd") $pid1 = WinGetProcess($hoIE1) 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