Jump to content
Sign in to follow this  
mesale0077

html code dont work

Recommended Posts

mesale0077

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister ()

GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$insetBorders = 0
$myIE_Obj = _IECreateEmbedded ()
Local $GUIActiveX = GUICtrlCreateObj($myIE_Obj, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)




 


GUISetState()       ;Show GUI
ppp()

; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
     
    EndSelect
WEnd

GUIDelete()

Exit
func ppp()
        
_IENavigate($myIE_Obj, "about:blank")
Local $a 
$a =""
$a &="<html>"&@CRLF
$a &="    <head>"&@CRLF
$a &=""&@CRLF
$a &="    </head>"&@CRLF
$a &="    <body><script language=Javascript>"&@CRLF
$a &="<!-- Begin"&@CRLF
$a &="var ver = navigator.appName;"&@CRLF
$a &="if (ver == ""Microsoft Internet Explorer"") {"&@CRLF
$a &="document.write('<bgsound src="""&@ScriptDir &"\ddde.mp3"""&" ID=music loop=1 AUTOSTART=true>');"&@CRLF
$a &="} else {"&@CRLF
$a &="document.write('<embed type=""audio/midi"" src="""&@ScriptDir &"\ddde.mp3"""&" AUTOSTART=false hidden=true VOLUME=""90"" name=""musicSource"" MASTERSOUND></EMBED>');"&@CRLF
$a &="}"&@CRLF
$a &="//-->"&@CRLF
$a &="</script>"&@CRLF
$a &=""&@CRLF
$a &=""&@CRLF
$a &="    </body>"&@CRLF
$a &="</html>"&@CRLF
$a &=""&@CRLF
_IEDocWriteHTML ($myIE_Obj, $a)
_IEAction ($myIE_Obj, "refresh")
$myIE_Obj.document.body.scroll = "no"
$myIE_Obj.document.body.style.border = $insetBorders
Return $myIE_Obj
EndFunc
this code problem?

Share this post


Link to post
Share on other sites
jaberwacky

This works for me:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister()

Global $myIE_Obj = _IECreateEmbedded()
Global $GUI = GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)

Global Const $insetBorders = 0
Global $GUIActiveX = GUICtrlCreateObj($myIE_Obj, 10, 40, 600, 360)
Global $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
Global $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
Global $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
Global $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete($GUI)
            _IEErrorHandlerDeRegister()
            Exit
        Case $GUI_Button_Home
            _IENavigate($myIE_Obj, "http://www.autoitscript.com")
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
mesale0077

thank you

sound.html work

IENavigate($myIE_Obj, @ScriptDir &"\sound.html")

but

_IEDocWriteHTML ($myIE_Obj, $a) dont work

html code:

<html>

<head>

</head>

<body>

<bgsound src="musıc.mp3 LOOP="-1" VOLUME="-2000">

</body>

</html>

write to "about:blank"

$a :html code

_IEDocWriteHTML ($myIE_Obj, $a)

but

autoit code dont work why?

Edited by mesale0077

Share this post


Link to post
Share on other sites
mesale0077

;this code with sound.html work

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister()

Global $myIE_Obj = _IECreateEmbedded()
Global $GUI = GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)

Global Const $insetBorders = 0
Global $GUIActiveX = GUICtrlCreateObj($myIE_Obj, 10, 40, 600, 360)
Global $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
Global $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
Global $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
Global $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete($GUI)
            _IEErrorHandlerDeRegister()
            Exit
        Case $GUI_Button_Home
            _IENavigate($myIE_Obj,@ScriptDir &"\sound.html")
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
jaberwacky

This is what I have for now:

Press the 'TempTest' button to hear someone say, "Hello."

;this code with sound.html work

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister()

Global $myIE_Obj = _IECreateEmbedded()

Global Const $width = 640
Global Const $height = 580

Global Const $GUI = GUICreate( _
        "Embedded Web control Test", _
        $width, _
        $height, _
        (@DesktopWidth - $width) / 2, _
        (@DesktopHeight - $height) / 2, _
        $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN + $WS_OVERLAPPEDWINDOW)

Global Const $insetBorders = 0

Global Const $GUIActiveX = GUICtrlCreateObj($myIE_Obj, 10, 40, 600, 360)
Global Const $GUI_Button_Back = GUICtrlCreateButton("TempTest", 10, 420, 100, 30) ; change the label to 'Back' when you're ready
Global Const $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
Global Const $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
Global Const $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

_IENavigate($myIE_Obj, "about:Blank")

Global $html = "<html>" & @CR
$html &= "<head>" & @CR
$html &= "</head>" & @CR
$html &= "<body>" & @CR
$html &= "<h3>test2</h3>" & @CR
$html &= "<bgsound src='http://www.htmlcodetutorial.com/sounds/helloo.wav'>" & @CR
$html &= "</body>" & @CR
$html &= "</html>"

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete($GUI)
            _IEErrorHandlerDeRegister()
            Exit
        Case $GUI_Button_Home
            _IENavigate($myIE_Obj, @ScriptDir & "\sound.html")
        Case $GUI_Button_Back
            _IEDocWriteHTML($myIE_Obj, $html)
;~          ConsoleWrite("_IEDocWriteHTML -- @error: " & @error & " @extended: " & @extended & @LF)
            _IEAction($myIE_Obj, "refresh")
    EndSwitch
WEnd
Edited by jaberwocky6669

Share this post


Link to post
Share on other sites
mesale0077

;this code with sound.html work

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister()

Global $myIE_Obj = _IECreateEmbedded()

Global Const $width = 640
Global Const $height = 580

Global Const $GUI = GUICreate( _
        "Embedded Web control Test", _
        $width, _
        $height, _
        (@DesktopWidth - $width) / 2, _
        (@DesktopHeight - $height) / 2, _
        $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN + $WS_OVERLAPPEDWINDOW)

Global Const $insetBorders = 0

Global Const $GUIActiveX = GUICtrlCreateObj($myIE_Obj, 10, 40, 600, 360)
Global Const $GUI_Button_Back = GUICtrlCreateButton("TempTest", 10, 420, 100, 30) ; change the label to 'Back' when you're ready
Global Const $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
Global Const $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
Global Const $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

_IENavigate($myIE_Obj, "about:Blank")

Global $html = "<html>" & @CR
$html &= "<head>" & @CR
$html &= "</head>" & @CR
$html &= "<body>" & @CR
$html &= "<h3>test2</h3>" & @CR
$html &= "<bgsound src='"&@ScriptDir &"\musıc.mp3'> " & @CR
$html &= "</body>" & @CR
$html &= "</html>"
 _IEDocWriteHTML($myIE_Obj, $html)
;~          ConsoleWrite("_IEDocWriteHTML -- @error: " & @error & " @extended: " & @extended & @LF)
            _IEAction($myIE_Obj, "refresh")
 
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete($GUI)
            _IEErrorHandlerDeRegister()
            Exit
        Case $GUI_Button_Home
            _IENavigate($myIE_Obj, @ScriptDir & "\sound.html")
        Case $GUI_Button_Back
            _IEDocWriteHTML($myIE_Obj, $html)
;~          ConsoleWrite("_IEDocWriteHTML -- @error: " & @error & " @extended: " & @extended & @LF)
            _IEAction($myIE_Obj, "refresh")
    EndSwitch
WEnd
thank you jaberwocky6669

this code worked

"<bgsound src='"&@ScriptDir &"\musıc.mp3'> "

Edited by mesale0077

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  

×