Jump to content

Using _IECreateEmbedded () to make marquee


Bert
 Share

Recommended Posts

I made a script that runs a marquee. It works, but not the way I want. From the code example, I want to run the marquee in the top window, and the main page in the bottom window. I know I can use frames, but the website I plan to use would cause a failure if I tried that approach. The layout is what I have in mind, so I do not wish for it to be changed.

My problem is I want to use _IEBodyWriteHTML to set the text as well as background colors, fonts, and so forth of the marquee. I can't get that to work.

My other problem is the marquee is not right at the top of the page. It is down by a carriage return. I see a example of a clock in the IE examples that is displayed right at the top, but I do not see how to apply what is stated in the example to fix this problem.

I know I can use a different method for the marquee, but I wanted to use this method to see how much easier it would be to control what is displayed.

code:

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

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
$oIE2 = _IECreateEmbedded ();added to make marquee window visable. using $oIE didn't work.
GUICreate("UNPlus 3.0 for Unicenter ServiceDesk", @DesktopWidth - 40, @DesktopHeight - 60, 20 , "", _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 60, @DesktopWidth - 60, @DesktopHeight - 140)
$marquee = GUICtrlCreateObj($oIE2, 10, 39, @DesktopWidth - 60, 60)
$GUI_Button_CTS_web = GUICtrlCreateButton("CTS Portal", 10, 5, 70, 30)
$GUI_Button_Depot_web = GUICtrlCreateButton("Depot System", 85, 5, 80, 30)
$GUI_Button_SC_web = GUICtrlCreateButton("Solution Center", 170, 5, 80, 30)
$GUI_Button_problem_board = GUICtrlCreateButton("SC Problem Board", 255, 5, 100, 30)
$GUI_Button_Service_request = GUICtrlCreateButton("Service Request", 360, 5, 90, 30)
$GUI_Button_SR_Archive = GUICtrlCreateButton("Service Request Archives", 455, 5, 135, 30)
$GUI_Button_Field_operations = GUICtrlCreateButton("Field Operations", 595, 5, 90, 30)

;_IENavigate ($oIE2, @ScriptDir&"/marquee.htm") ;the next line is all the HTML marquee.htm has. This method works, but has a scroll bar.
; I need to figure a way to hide the scroll bar. need to research this. 
_IEBodyWriteHTML ($oIE2, '<marquee>Enter your marquee text here, and/or enter an image below...</marquee>') ; this causes a failure

_IEAction($oIE2, "refresh")
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        ;cases for buttons not done yet. will do later. 
    EndSelect
WEnd
Link to comment
Share on other sites

OK, additions and changes to this section of code:

;_IENavigate ($oIE2, @ScriptDir&"/marquee.htm") ;the next line is all the HTML marquee.htm has. This method works, but has a scroll bar.
; I need to figure a way to hide the scroll bar. need to research this. 
;_IEBodyWriteHTML ($oIE2, '<marquee>Enter your marquee text here, and/or enter an image below...</marquee>') ; this causes a failure
_IENavigate($oIE, "about:blank")
_IENavigate($oIE2, "about:blank")
_IEDocWriteHTML ($oIE2, '<body scroll=no topmargin=0><marquee>Enter your marquee text here, and/or enter an image below...</marquee></body>') ; this causes a failure
;_IEAction($oIE2, "refresh")oÝ÷ Ù«$ªç¬¶*'²'íéh'"²éÜæ«êÞËayû¥Êy«­¢+Ø¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±Ðí%¹ÔÌÐì()}%ÉɽÉ!¹±ÉI¥ÍÑÈ ¤((ÀÌØí½%ô}%
Éѵ ¤(ÀÌØí½%Èô}%
Éѵ ¤íѼµ­µÉÅÕÝ¥¹½Ü٥ͱ¸ÕÍ¥¹ÀÌØí½%¥¸ÌäíÐݽɬ¸)U%
ÉÑ ÅÕ½ÐíU9A±ÕÌ̸À½ÈU¹¥¹ÑÈMÉ٥ͬÅÕ½Ðì°Í­Ñ½Á]¥Ñ ´ÐÀ°Í­Ñ½Á!¥¡Ð´ØÀ°ÈÀ°ÅÕ½ÐìÅÕ½Ðì°|(ÀÌØí]M}=YI1AA]%9=¬ÀÌØí]M}Y%M%   1¬ÀÌØí]M}
1%AM%   1%9L¤(ÀÌØíU%Ñ¥Ù`ôU%
Ñɱ
ÉÑ=¨ ÀÌØí½%°ÄÀ°ØÀ°Í­Ñ½Á]¥Ñ ´ØÀ°Í­Ñ½Á!¥¡Ð´ÄÐÀ¤(ÀÌØíµÉÅÕôU%
Ñɱ
ÉÑ=¨ ÀÌØí½%È°ÄÀ°Ìä°Í­Ñ½Á]¥Ñ ´ØÀ°ØÀ¤(ÀÌØíU%}   ÕÑѽ¹}
QM}ÝôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½Ðí
QLA½ÉÑ°ÅÕ½Ðì°ÄÀ°Ô°ÜÀ°ÌÀ¤(ÀÌØíU%}   ÕÑѽ¹}Á½Ñ}ÝôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíÁ½ÐMåÍÑ´ÅÕ½Ðì°àÔ°Ô°àÀ°ÌÀ¤(ÀÌØíU%}  ÕÑѽ¹}M
}ÝôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíM½±ÕÑ¥½¸
¹ÑÈÅÕ½Ðì°ÄÜÀ°Ô°àÀ°ÌÀ¤(ÀÌØíU%}  ÕÑѽ¹}Áɽ±µ}½ÉôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíMAɽ±´ ½ÉÅÕ½Ðì°ÈÔÔ°Ô°ÄÀÀ°ÌÀ¤(ÀÌØíU%}  ÕÑѽ¹}MÉÙ¥}ÉÅÕÍÐôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíMÉÙ¥IÅÕÍÐÅÕ½Ðì°ÌØÀ°Ô°äÀ°ÌÀ¤(ÀÌØíU%}   ÕÑѽ¹}MI}É¡¥ÙôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíMÉÙ¥IÅÕÍÐÉ¡¥ÙÌÅÕ½Ðì°ÐÔÔ°Ô°ÄÌÔ°ÌÀ¤(ÀÌØíU%}   ÕÑѽ¹}¥±}½ÁÉÑ¥½¹ÌôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½Ðí¥±=ÁÉÑ¥½¹ÌÅÕ½Ðì°ÔäÔ°Ô°äÀ°ÌÀ¤((í}%9Ù¥Ñ ÀÌØí½%È°MÉ¥ÁѥȵÀìÅÕ½Ðì½µÉÅÕ¹¡Ñ´ÅÕ½Ðì¤íÑ¡¹áб¥¹¥Ì±°Ñ¡!Q50µÉÅÕ¹¡Ñ´¡Ì¸Q¡¥ÌµÑ¡½Ý½É­Ì°ÕСÌÍɽ±°È¸(ì$¹Ñ¼¥ÕÉÝäѼ¡¥Ñ¡Íɽ±°È¸¹Ñ¼ÉÍÉ Ñ¡¥Ì¸(í}% ½å]É¥Ñ!Q50 ÀÌØí½%È°Ìäì±ÐíµÉÅÕÐí¹ÑÈå½ÕȵÉÅÕÑáСɰ¹½½È¹Ñȸ¥µ±½Ü¸¸¸±Ðì½µÉÅÕÐìÌäì¤ìÑ¡¥ÌÕÍÌ¥±ÕÉ)}%9Ù¥Ñ ÀÌØí½%°ÅÕ½Ðí½ÕÐé±¹¬ÅÕ½Ðì¤)}%9Ù¥Ñ ÀÌØí½%È°ÅÕ½Ðí½ÕÐé±¹¬ÅÕ½Ðì¤)}]É¥Ñ!Q50 ÀÌØí½%È°Ìäì±Ðí½äÍɽ±°õ¹¼Ñ½ÁµÉ¥¸ôÀÐì±ÐíµÉÅÕÐí¹ÑÈå½ÕȵÉÅÕÑáСɰ¹½½È¹Ñȸ¥µ±½Ü¸¸¸±Ðì½µÉÅÕÐì±Ðì½½äÐìÌäì¤ìÑ¡¥ÌÕÍÌ¥±ÕÉ(í}%Ñ¥½¸ ÀÌØí½%È°ÅÕ½ÐíÉÉÍ ÅÕ½Ðì¤()U%MÑMÑÑ ¤)]¡¥±Ä(ÀÌØíµÍôU%Ñ5Í ¤(M±Ð(
ÍÀÌØíµÍôÀÌØíU%}Y9Q}
1=M(á¥Ñ1½½À(íÍ̽ÈÕÑѽ¹Ì¹½Ð½¹åиݥ±°¼±Ñȸ(¹M±Ð)]¹

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

Not my forte... if you don't get a response here, ask in the GUI forum.

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

I found this: http://www.autoitscript.com/forum/index.ph...2&hl=resize

It shows when a window is resized, a resize limit is set. I noticed on GUIGetMsg(), one of the things to look for is $GUI_EVENT_RESIZED. This leads me in the right direction, for there was a snippit of code I should be able to tweak.

Link to comment
Share on other sites

Got it! This will resize the controls, and keep it from being set too small.

#include <GUIConstants.au3>
#include <IE.au3>
dim $h, $w, $title
_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
$oIE2 = _IECreateEmbedded ()
$w = @DesktopWidth
$h = @DesktopHeight
$title = "UNPlus 3.0 for Unicenter ServiceDesk"
GUICreate($title, $w - 40, $h - 60, 20 , "", $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 68, $w - 60, $h - 140)
GUICtrlSetResizing($GUIActiveX, 1)
$marquee = GUICtrlCreateObj($oIE2, 10, 39, $w - 60, 25)
GUICtrlSetResizing($marquee, 1)
$GUI_Button_CTS_web = GUICtrlCreateButton("CTS Portal", 10, 5, 70, 30)
GUICtrlSetResizing($GUI_Button_CTS_web, 8)
$GUI_Button_Depot_web = GUICtrlCreateButton("Depot System", 85, 5, 80, 30)
GUICtrlSetResizing($GUI_Button_Depot_web, 8)
$GUI_Button_SC_web = GUICtrlCreateButton("Solution Center", 170, 5, 80, 30)
GUICtrlSetResizing($GUI_Button_SC_web, 8)
$GUI_Button_problem_board = GUICtrlCreateButton("SC Problem Board", 255, 5, 100, 30)
GUICtrlSetResizing($GUI_Button_problem_board, 8)
$GUI_Button_Service_request = GUICtrlCreateButton("Service Request", 360, 5, 90, 30)
GUICtrlSetResizing($GUI_Button_Service_request, 8)
$GUI_Button_SR_Archive = GUICtrlCreateButton("Service Request Archives", 455, 5, 135, 30)
GUICtrlSetResizing($GUI_Button_SR_Archive, 8)
$GUI_Button_Field_operations = GUICtrlCreateButton("Field Operations", 595, 5, 90, 30)
GUICtrlSetResizing($GUI_Button_Field_operations, 8)
_IENavigate($oIE, "about:blank")
_IENavigate($oIE2, "about:blank")
_IEDocWriteHTML ($oIE2, '<body scroll=no topmargin=0><marquee>Enter your marquee text here, and/or enter an image below...</marquee></body>') ; this causes a failure

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...