Jump to content

embed html file from harddisk


 Share

Recommended Posts

I am creating some sort of music player for myself, which uses a last.fm account. I do not want to load the all but-ugly webpage, but I have narrowed it down to just the player itself. The problem is now, I save the player as a .html file on the user's harddisk, but I fail to open that file in the embedded IE...

Help me please?

EDIT: code was kinda messing up.. download attachment to see the code.

codeexample.au3

Edited by toonboon

[right]~What can I say, I'm a Simplistic person[/right]

Link to comment
Share on other sites

I am creating some sort of music player for myself, which uses a last.fm account. I do not want to load the all but-ugly webpage, but I have narrowed it down to just the player itself. The problem is now, I save the player as a .html file on the user's harddisk, but I fail to open that file in the embedded IE...

Help me please?

EDIT: code was kinda messing up.. download attachment to see the code.

codeexample.au3

Add

fileclose($file)

after you have finished writing the file then IE can read it.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Try this:

#include <windowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister()

$oIE = _IECreateEmbedded()
$GUI = GUICreate("Last.fm Player", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 500, 400)
GUISetState() ;Show GUI
_IENavigate($oIE, "http://www.last.fm/listen/user/toonboon/personal")
$username = "toonboon"
If Not FileExists(@ScriptDir & "\Url") Then DirCreate(@ScriptDir & "\Url")
$FileName = @ScriptDir & "\Url\" & $username & ".html"
$File = FileOpen($FileName,2)
MsgBox(0,'',$File)
FileWrite($File, '<object type="application/x-shockwave-flash" data="http://cdn.last.fm/webclient/s12n/s/3/lfmPlayer.swf" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"' & @CRLF & '        id="lfmPlayer" name="lfmPlayer" align="middle"' & @CRLF & '        width="300" height="221">' & @CRLF & '    <param name="movie" value="http://cdn.last.fm/webclient/s12n/s/3/lfmPlayer.swf" />' & @CRLF & '    <param name="flashvars" value="lang=en&amp;lfmMode=radio&amp;FOD=true&amp;expanded=true&amp;url=lastfm%3A%2F%2Fuser%2F' & $username & '%2Fpersonal&amp;autostart=true" />' & @CRLF & '    <param name="allowScriptAccess" value="always" />' & @CRLF & '    <param name="allowNetworking" value="all" />' & @CRLF & '    <param name="allowFullScreen" value="true" />' & @CRLF & '    <param name="quality" value="high" />' & @CRLF & '    <param name="bgcolor" value="fff" />' & @CRLF & '    <param name="wmode" value="transparent" />' & @CRLF & '    <param name="menu" value="true" />' & @CRLF & '</object></noscript>' & @CRLF & '</div>' & @CRLF & '' & @CRLF & '' & @CRLF & '<script>' & @CRLF & 'var lfmPlayer_params = {"movie":"http:\/\/cdn.last.fm\/webclient\/s12n\/s\/3\/lfmPlayer.swf","flashvars":"lang=en&lfmMode=radio&FOD=true&expanded=true&url=lastfm%3A%2F%2Fuser%2F' & $username & '%2Fpersonal&autostart=true","width":300,"height":221,"majorversion":7,"build":"0","allowscriptaccess":"always","allownetworking":"all","allowfullscreen":"true","quality":"high","bgcolor":"#fff","wmode":"transparent","menu":"true","id":"lfmPlayer","setcontainercss":false,"swliveconnect":"true","name":"lfmPlayer","align":"middle"};' & @CRLF & 'UFO.create(lfmPlayer_params, "lfmPlayer_container");' & @CRLF & '</script>')
FileClose($File)
_IENavigate($oIE,$FileName)
While 1
    Sleep(1000)
    WinSetTitle($GUI, '', StringReplace($oIE.document.title, " - Last.fm", ""))
WEnd
Edited by Zedna
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...