Sign in to follow this  
Followers 0
Bert

Need advice on making marquee with embedded hyperlinks

13 posts in this topic

#1 ·  Posted (edited)

I'm making a viewer for a web based application. I want to put a marquee on the top of the GUI. So far so good. Here is the trouble.

I want to have the marquee do the following:

  • the data can be updated
  • Data that is in mid scroll won't get wiped when the update occures
  • Data can be a hyperlink. It will allow the user to click on a piece of data in the stream that will open a separate browser window.
  • It needs to scroll from left to right. Currently it scrolls from right to left, and I can't seem to make it switch. :rambo:
  • The scroll makes the Marquee pane push over all the way to the edge of the GUI as the text scrolls.
This is the code I've come up with so far. I suspect I will need to do a IE <marquee> solution, but I find it to be choppy. If that is the direction I need to go, then I'm happy to go that way to solve it. (maybe a applet??? <I have no idea how to work with them>)I know I'm asking for a large amount of help, but I'm stumped. Thoughts? help? :rolleyes:

#include <GUIConstants.au3>
#include <IE.au3>
#Include <Constants.au3>
_IEErrorHandlerRegister ()
$oIE = _IECreateEmbedded ()
$oIE2 = _IECreateEmbedded ()
$w = @DesktopWidth
$h = @DesktopHeight
$title = "Test GUI and Scroll"
$gui = GUICreate($title, $w - 40, $h - 150, -1, -1, BitOr($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
$label1 = GUICtrlCreateLabel ("",10, 68, $w - 60, $h - 230)
GUICtrlSetBkColor ( -1,0xff0000)
GUICtrlSetState ( -1,$GUI_DISABLE)
GUICtrlSetState ( -1,$GUI_HIDE)

$oIE1 = _IECreate ("about:blank",0,0) 
$oIE1.AddressBar = 0 
$oIE1.MenuBar = 0
$oIE1.StatusBar = 0
$oIE1.ToolBar = 0
$uID1 = Random(1000, 100000000) 
$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)

repositionIEs()

;marquee

$size = $w - 60
$my0 = GUICtrlCreateLabel('', 10, 39, $w - 60, 25)
$myl = GUICtrlCreateLabel(' Have a good day!', 10, 39, $w - 60, 25)
guiCTRLsetfont($myl, 12, 900, 0, "ms comic san")
GUICtrlSetColor($myl, 0xffFFFF)
GUICtrlSetBkColor($my0, 0x000000)
GUICtrlSetBkColor($myl, 0x000000)

AdlibEnable('_MoveMarquee', 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WinActivate($gui)
GUISetState()
$oIE1.visible=1

_IENavigate($oIE1,"http://www.msn.com")

While 1
    $msg = GUIGetMsg()
    $trr = WinGetTitle($hoIE1)  
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        case sizeEvent($msg)
            repositionIEs()
            ;I need to have the marquee also resize itself. not sure how.
        Case $msg = $GUI_EVENT_RESIZED              
            _ResizeLimit($Title, "",$w - 100, $h - 100, @DesktopWidth, @DesktopHeight)  
    EndSelect
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

func repositionIEs()
    $pos1 = ControlGetPos($gui, "", "Static1")
    WinMove($hoIE1, "", $pos1[0], $pos1[1], $pos1[2], $pos1[3])
EndFunc

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

Func _MoveMarquee()
    Local $aCpos
    $aCpos = ControlGetPos($title, '', $myl)
    If $aCpos[0] >= $size Then  
        setsize($myl)
        $len = StringLen(GUICtrlRead($myl))
        $lenth = $len * 10    
        $aCpos[0] =  -$lenth     
    endif      
    ControlMove($title, '', $myl, $aCpos[0] + 1, $aCpos[1])
EndFunc

Func setsize($control, $font = 10)
    ;------------------
    $text = "Information from the Problem Board, announcements, or Alerts from management can be put here...."
    ; -----------------
    GUICtrlSetData( $control, $text)
    $info = ControlGetPos($title, "", $control)
    $data = GUICtrlRead($control)
    $lenth = StringLen($data) 
    $len =  $lenth * 10
    ControlMove($title, "", $control, $info[0], $info[1], $len, $info[3])
EndFunc
Edited by Volly

Share this post


Link to post
Share on other sites



Tried that, but you can't do hyperlinks. I plan to have the marquee reference a "problem board" that is layed out in a excel type format. It list all the major issues. I want to get a top 10 from that list, and have them scroll by. Also, the scroll moves the string a letter at a time, not by pixel, so it is very choppy. I'm looking more torward a HTML solution, but that path has the overwrite in the middle of the scroll problem. Maybe I'm looking at the solution you suggest wrong, but if I am looking at wrong, could you give me a example where the scroll is smooth?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I thought of doing a different method, but I'm puzzled on how it works. I need to capture data from a table in a webpage. I know you use _IETableGetCollection, then _IETableWriteToArray. My problem is, how to access the data in the array. I tried this:

#include <IE.au3>
$oIE = _IE_Example ("table")
$oTable = _IETableGetCollection ($oIE)
$aTableData = _IETableWriteToArray ($oTable)
MsgBox(0, "", $aTableData[1][2])

It errors saying non Array variable. I know it should return a 2-dimensional array containing the contents of the Table. :rolleyes:

Edited by Volly

Share this post


Link to post
Share on other sites

I thought of doing a different method, but I'm puzzled on how it works. I need to capture data from a table in a webpage. I know you use _IETableGetCollection, then _IETableWriteToArray. My problem is, how to access the data in the array. I tried this:

#include <IE.au3>
$oIE = _IE_Example ("table")
$oTable = _IETableGetCollection ($oIE)
$aTableData = _IETableWriteToArray ($oTable)
MsgBox(0, "", $aTableData[1][2])oÝ÷ Ø^®º+²Æ²x'¢p+­¬¯j¸nWz0Û!¢é]­ën®v¶v)Ȩ©Z®¶²ríj)âayÊ'µéí²íäÚnW¡º¿ªê-y.¯Mú¡6è¬iÊ%ç-ç¢Ö¬x%zÖæ(º¯zÚ)ºY^iÈmi¹^¡¸èºÚ¶¢Y^rب«­¢+Ø¥¹±Õ±Ðí%¹ÔÌÐì(¥¹±Õ±ÐíÉÉä¹ÔÌÐì((ÀÌØí½%ô}%}áµÁ± ÅÕ½ÐíѱÅÕ½Ðì¤(ÀÌØí½±Q±Ìô}%Q±Ñ
½±±Ñ¥½¸ ÀÌØí½%¤)5Í    ½à ØаÅÕ½ÐíQ±ÌÅÕ½Ðì°ÅÕ½ÐíQ¡ÉÉÅÕ½ÐìµÀìáѹµÀìÅÕ½Ðìѱ̥¸Ñ¡¥ÌÁ¸¸¸ÅÕ½Ðì°Ô¤(ÀÌØí¸ôÀ)½ÈÀÌØí½Q±%¸ÀÌØí½±Q±Ì($ÀÌØíÙQ±ô}%Q±]É¥ÑQ½ÉÉä ÀÌØí½Q±¤(%}ÉÉå¥ÍÁ±ä ÀÌØíÙQ±°ÅÕ½ÐíQ±èÅÕ½ÐìµÀìÀÌØí¸¤(%5Í   ½à ØаÅÕ½ÐíQ±ÌÅÕ½Ðì°ÅÕ½ÐìÀÌØíÙQ±lÉulÉtôÅÕ½ÐìµÀìÀÌØíÙQ±lÉulÉt°Ô¤($ÀÌØí¸¬ôÄ)9áÐ

One thing that's weird is that the row/col seems backwards, like row 2 col 1 of the HTML table has to references as [1][2] in the AutoIt array...?

:rolleyes:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

C:\Program Files\AutoIt3\Include\array.au3 (175) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$sMsg = $sMsg & "[" & $iCounter & "] = " & StringStripCR($avArray[$iCounter]) & @CR

$sMsg = $sMsg & "[" & $iCounter & "] = " & StringStripCR(^ ERROR

+>AutoIT3.exe ended.rc:0

I still can't get what I need.

:rolleyes:

Share this post


Link to post
Share on other sites

C:\Program Files\AutoIt3\Include\array.au3 (175) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$sMsg = $sMsg & "[" & $iCounter & "] = " & StringStripCR($avArray[$iCounter]) & @CR

$sMsg = $sMsg & "[" & $iCounter & "] = " & StringStripCR(^ ERROR

+>AutoIT3.exe ended.rc:0

I still can't get what I need.

:rambo:

If you got that running my script from post #5 you are not running the current production version of AutoIt. In the latest version, _ArrayDisplay() in Array.au3 was re-written to display 2D-arrays in a listview window. Older versions could only display 1D arrays.

Get with the update, Dude!

:rolleyes:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I went to test on the page I want to pull data from. I get a error saying this:

J:\UNPlus3_0\study files\2xbrowserwindow.au3 (12) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

The 2nd table is 5 columns and 45 lines. I suspect this exceeds the limit, and that is my problem. Am I correct on this? If someone wants to see the web page, I will PM the source to the web page. The page is pretty basic, simply showing 2 tables, and I need to reference the second one. I do notice the code will see the first table fine. I did include a screen shot of the web page. (Its censored to keep sensitive info out, but you should get the idea of the page)

Edit: I got it to work when I removed the msgbox, but I now notice a new problem. I notice the rows and columns are backwards. What should be a row is a column, and vis-versa. How do I fix that?

Edited by Volly

Share this post


Link to post
Share on other sites

I'll take a look after I get back from lunch if you want to pm me the source.

Share this post


Link to post
Share on other sites

Run this code with the source you pm'd me and see if it makes any more sense.

#include <IE.au3>
#include <GUIConstants.au3>
#Include <GuiListView.au3>

Opt("GuiOnEventMode", True)

$GUI = GUICreate("Table Data", 620, 370)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$ListView1 = GUICtrlCreateListView("Last Update|Master#|Description|Region|Resolve Date", 10, 10, 600, 350)
GUISetState(@SW_SHOW)

_EnumTable()

While 1
    Sleep(10)
WEnd

Func _EnumTable()
    _GUICtrlListViewDeleteAllItems($ListView1)

    $oIE = _IECreate(@ScriptDir & "\test.html", 0, 0)
    $oTable = _IETableGetCollection($oIE, 1)
    $aResults = _IETableWriteToArray($oTable)
    _IEQuit($oIE)

    For $i = 1 To UBound($aResults, 2) - 1
        $sLastUpdate = $aResults[0][$i]
        $sMaster = $aResults[1][$i]
        $sDesc = $aResults[2][$i]
        $sRegion = $aResults[3][$i]
        $sResolved = $aResults[4][$i]

        $lv_item = GUICtrlCreateListViewItem($sLastUpdate & "|" & $sMaster & "|" & _
                $sDesc & "|" & $sRegion & "|" & $sResolved, $ListView1)
    Next
    For $i = 0 To 4
        _GUICtrlListViewSetColumnWidth($ListView1, $i, $LVSCW_AUTOSIZE)
    Next
EndFunc   ;==>_EnumTable

Func _Exit()
    Exit
EndFunc   ;==>_Exit

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0