ChrisL Posted July 3, 2008 Posted July 3, 2008 (edited) Pretty self explanatory really... The Function. Func _GuiCtrlCreateFlash($iXpos,$iYpos,$iWidth,$iHeight,$vSWFPath, $offset = 27) Local $oIE, $GUIActiveX, $tmp, $hFile $oIE = ObjCreate("Shell.Explorer.2") $GUIActiveX = GUICtrlCreateObj ($oIE, $iXpos, $iYpos, $iWidth, $iHeight) $tmp = '<object width="' & $iWidth & '" height="' & $iHeight & '">' $tmp &= '<param name="movie" value="AutoIt.swf">' $tmp &= '<embed src="' & $vSWFPath & '" width="' & $iWidth-$offset & '" height="' & $iHeight-$offset & '">' $tmp &= '</embed>' $hFile = FileOpen(@tempDir & "\AutoItFlash.html",2) FileWrite($hFile,$tmp) FileClose($hFile) $oIE.navigate(@tempDir & "\AutoItFlash.html") $oIE.document.body.scroll = "no" FileDelete(@tempDir & "\AutoItFlash.html") Return $GUIActiveX EndFunc An Example expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Embedded Flash", 640, 680, (@DesktopWidth - 640) / 2, (@DesktopHeight - 680) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) $Flash = _GuiCtrlCreateFlash(10,10,400,300,"http://www.2inept.co.uk/icecastleblaster.swf") $Flash2 = _GuiCtrlCreateFlash(10,330,600,300,"http://www.flashgames247.com/images/logo_rhino_199x91.swf") GUISetState() ;Show GUI ; Waiting for user to close the window While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() Func _GuiCtrlCreateFlash($iXpos,$iYpos,$iWidth,$iHeight,$vSWFPath, $offset = 27) Local $oIE, $GUIActiveX, $tmp, $hFile $oIE = ObjCreate("Shell.Explorer.2") $GUIActiveX = GUICtrlCreateObj ($oIE, $iXpos, $iYpos, $iWidth, $iHeight) $tmp = '<object width="' & $iWidth & '" height="' & $iHeight & '">' $tmp &= '<param name="movie" value="AutoIt.swf">' $tmp &= '<embed src="' & $vSWFPath & '" width="' & $iWidth-$offset & '" height="' & $iHeight-$offset & '">' $tmp &= '</embed>' $hFile = FileOpen(@tempDir & "\AutoItFlash.html",2) FileWrite($hFile,$tmp) FileClose($hFile) $oIE.navigate(@tempDir & "\AutoItFlash.html") $oIE.document.body.scroll = "no" FileDelete(@tempDir & "\AutoItFlash.html") Return $GUIActiveX EndFunc Edited July 3, 2008 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
Andreik Posted July 3, 2008 Posted July 3, 2008 Pretty self explanatory really... The Function. Func _GuiCtrlCreateFlash($iXpos,$iYpos,$iWidth,$iHeight,$vSWFPath, $offset = 42) Local $oIE, $GUIActiveX, $tmp, $hFile $oIE = ObjCreate("Shell.Explorer.2") $GUIActiveX = GUICtrlCreateObj ($oIE, $iXpos, $iYpos, $iWidth, $iHeight) $tmp = '<object width="' & $iWidth & '" height="' & $iHeight & '">' $tmp &= '<param name="movie" value="AutoIt.swf">' $tmp &= '<embed src="' & $vSWFPath & '" width="' & $iWidth-$offset & '" height="' & $iHeight-$offset & '">' $tmp &= '</embed>' $hFile = FileOpen(@tempDir & "\AutoItFlash.html",2) FileWrite($hFile,$tmp) FileClose($hFile) $oIE.navigate(@tempDir & "\AutoItFlash.html") FileDelete(@tempDir & "\AutoItFlash.html") Return $GUIActiveX EndFunc An Example expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Embedded Flash", 640, 680, (@DesktopWidth - 640) / 2, (@DesktopHeight - 680) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) $Flash = _GuiCtrlCreateFlash(10,10,400,300,"http://www.2inept.co.uk/icecastleblaster.swf") $Flash2 = _GuiCtrlCreateFlash(10,330,600,300,"http://www.flashgames247.com/images/logo_rhino_199x91.swf") GUISetState() ;Show GUI ; Waiting for user to close the window While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() Func _GuiCtrlCreateFlash($iXpos,$iYpos,$iWidth,$iHeight,$vSWFPath, $offset = 42) Local $oIE, $GUIActiveX, $tmp, $hFile $oIE = ObjCreate("Shell.Explorer.2") $GUIActiveX = GUICtrlCreateObj ($oIE, $iXpos, $iYpos, $iWidth, $iHeight) $tmp = '<object width="' & $iWidth & '" height="' & $iHeight & '">' $tmp &= '<param name="movie" value="AutoIt.swf">' $tmp &= '<embed src="' & $vSWFPath & '" width="' & $iWidth-$offset & '" height="' & $iHeight-$offset & '">' $tmp &= '</embed>' $hFile = FileOpen(@tempDir & "\AutoItFlash.html",2) FileWrite($hFile,$tmp) FileClose($hFile) $oIE.navigate(@tempDir & "\AutoItFlash.html") FileDelete(@tempDir & "\AutoItFlash.html") Return $GUIActiveX EndFunc Nice work! Thanks for sharing ChrisL! muttley
Synapse Posted July 3, 2008 Posted July 3, 2008 Awsome function....one thing... could u add a new param to hide the scrollbar? Thx
weaponx Posted July 3, 2008 Posted July 3, 2008 Why are you embedding an Internet Explorer object? Embed the Flash player directly: Func _CreateSWF($SWFPath, $SWFL, $SWFT, $SWFW, $SWFH, $SWFBGColor = "#505050") ; Create Flash Object $SWFObj = ObjCreate("ShockwaveFlash.ShockwaveFlash") $SWFActiveX = GUICtrlCreateObj( $SWFObj, $SWFL, $SWFT, $SWFW, $SWFH) ; Configure Flash Object With $SWFObj .Movie = $SWFPath .ScaleMode = 3 ;0 showall, 1 noborder, 2 exactFit, 3 noscale .bgcolor = $SWFBGColor .Loop = True ;.WMode = "transparent" .allowScriptAccess = "Always" ;Variable inject Method 1 ;.FlashVars = '&library_path=' & @ScriptDir & '\charts_library&xml_source=' & @ScriptDir & '\sample.xml' ;Variable inject Method 2 ;.SetVariable('library_path', @ScriptDir & '\charts_library') ;.SetVariable('xml_source', $SWFPath) EndWith Return $SWFObj EndFunc
ChrisL Posted July 3, 2008 Author Posted July 3, 2008 Why are you embedding an Internet Explorer object? Embed the Flash player directly: Func _CreateSWF($SWFPath, $SWFL, $SWFT, $SWFW, $SWFH, $SWFBGColor = "#505050") ; Create Flash Object $SWFObj = ObjCreate("ShockwaveFlash.ShockwaveFlash") $SWFActiveX = GUICtrlCreateObj( $SWFObj, $SWFL, $SWFT, $SWFW, $SWFH) ; Configure Flash Object With $SWFObj .Movie = $SWFPath .ScaleMode = 3 ;0 showall, 1 noborder, 2 exactFit, 3 noscale .bgcolor = $SWFBGColor .Loop = True ;.WMode = "transparent" .allowScriptAccess = "Always" ;Variable inject Method 1 ;.FlashVars = '&library_path=' & @ScriptDir & '\charts_library&xml_source=' & @ScriptDir & '\sample.xml' ;Variable inject Method 2 ;.SetVariable('library_path', @ScriptDir & '\charts_library') ;.SetVariable('xml_source', $SWFPath) EndWith Return $SWFObj EndFunc Ahh much better [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
ChrisL Posted July 3, 2008 Author Posted July 3, 2008 Awsome function....one thing... could u add a new param to hide the scrollbar?ThxI did it but it appears that my method was not the best way [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
DexterMorgan Posted July 3, 2008 Posted July 3, 2008 (edited) Good job Chris... It is nice I did it but it appears that my method was not the best wayIt doesnt matter.. You tried and you did pretty good muttleyYou help a lot of people like me Edited July 3, 2008 by Konstig code
ptrex Posted July 3, 2008 Posted July 3, 2008 @ChrisLThis might give you some more inspirationEmbedded Flash Payerregards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
Nhardel Posted July 13, 2008 Posted July 13, 2008 Func _CreateSWF($SWFPath, $SWFL, $SWFT, $SWFW, $SWFH, $SWFBGColor = "#505050") ; Create Flash Object $SWFObj = ObjCreate("ShockwaveFlash.ShockwaveFlash") $SWFActiveX = GUICtrlCreateObj( $SWFObj, $SWFL, $SWFT, $SWFW, $SWFH) ; Configure Flash Object With $SWFObj .Movie = $SWFPath .ScaleMode = 3 ;0 showall, 1 noborder, 2 exactFit, 3 noscale .bgcolor = $SWFBGColor .Loop = True ;.WMode = "transparent" .allowScriptAccess = "Always" ;Variable inject Method 1 ;.FlashVars = '&library_path=' & @ScriptDir & '\charts_library&xml_source=' & @ScriptDir & '\sample.xml' ;Variable inject Method 2 ;.SetVariable('library_path', @ScriptDir & '\charts_library') ;.SetVariable('xml_source', $SWFPath) EndWith Return $SWFObj EndFuncNoobie here I don't understand how to pass along the .xml file to the .swf I uncommented your .SetVariable('xml_source', $SWFPath) and renamed the 'xml_source' to the name of my xml file but the file doesn't seem to get passed. I know that it works with embed in an HTML file <PARAM NAME="movie" VALUE="gauge.swf?xml_source=sample.xml" /> Any help would be greatly appreciated
weaponx Posted July 13, 2008 Posted July 13, 2008 Noobie here I don't understand how to pass along the .xml file to the .swf I uncommented your .SetVariable('xml_source', $SWFPath) and renamed the 'xml_source' to the name of my xml file but the file doesn't seem to get passed. I know that it works with embed in an HTML file <PARAM NAME="movie" VALUE="gauge.swf?xml_source=sample.xml" /> Any help would be greatly appreciated You probably have to use the full path to the file.
Nhardel Posted July 14, 2008 Posted July 14, 2008 You probably have to use the full path to the file. Tried that. just causes the flash to not even try to run expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Embedded Flash", 640, 680, (@DesktopWidth - 640) / 2, (@DesktopHeight - 680) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) $Flash = _CreateSWF('C:\Documents and Settings\user\Desktop\gauge\gauge.swf',10,10,400,300) $Flash2 = _GuiCtrlCreateFlash(10,330,600,300,"C:\Documents and Settings\user\Desktop\gauge\gauge.swf?xml_source=sample.xml") GUISetState() ;Show GUI ; Waiting for user to close the window While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() Func _CreateSWF($SWFPath, $SWFL, $SWFT, $SWFW, $SWFH, $SWFBGColor = "#505050") ; Create Flash Object $SWFObj = ObjCreate("ShockwaveFlash.ShockwaveFlash") $SWFActiveX = GUICtrlCreateObj( $SWFObj, $SWFL, $SWFT, $SWFW, $SWFH) ; Configure Flash Object With $SWFObj .Movie = $SWFPath .ScaleMode = 3 ;0 showall, 1 noborder, 2 exactFit, 3 noscale .bgcolor = $SWFBGColor .Loop = True ;.WMode = "transparent" .allowScriptAccess = "Always" ;Variable inject Method 1 ;.FlashVars = '&library_path=' & @ScriptDir & '\charts_library&xml_source=' & @ScriptDir & '\sample.xml' ;Variable inject Method 2 ;.SetVariable('library_path', @ScriptDir & '\charts_library') .SetVariable('C:\Documents and Settings\user\Desktop\gauge\sample.xml', $SWFPath) EndWith Return $SWFObj EndFunc Func _GuiCtrlCreateFlash($iXpos,$iYpos,$iWidth,$iHeight,$vSWFPath, $offset = 42) Local $oIE, $GUIActiveX, $tmp, $hFile $oIE = ObjCreate("Shell.Explorer.2") $GUIActiveX = GUICtrlCreateObj ($oIE, $iXpos, $iYpos, $iWidth, $iHeight) $tmp = '<object width="' & $iWidth & '" height="' & $iHeight & '">' $tmp &= '<param name="movie" value="gauge.swf?xml_source=sample.xml">' $tmp &= '<embed src="' & $vSWFPath & '" width="' & $iWidth-$offset & '" height="' & $iHeight-$offset & '">' $tmp &= '</embed>' $hFile = FileOpen(@tempDir & "\AutoItFlash.html",2) FileWrite($hFile,$tmp) FileClose($hFile) $oIE.navigate(@tempDir & "\AutoItFlash.html") FileDelete(@tempDir & "\AutoItFlash.html") Return $GUIActiveX EndFunc Trying to piece together a useful way to display the flash, I have tried both ways of embeding it in autoit. Neither way seems to work. The .swf file is a way for me to make gauges in my project but I must be able to have it find the .xml file. Normally this code works <HTML> <BODY bgcolor="#FFFFFF"> <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="400" HEIGHT="250" id="gauge" /> <PARAM NAME="movie" VALUE="gauge.swf?xml_source=sample.xml" /> <PARAM NAME="quality" VALUE="high" /> <PARAM NAME="bgcolor" VALUE="#666666" /> <param name="allowScriptAccess" value="sameDomain" /> <EMBED src="gauge.swf?xml_source=sample.xml" quality="high" bgcolor="#666666" WIDTH="400" HEIGHT="250" NAME="gauge" allowScriptAccess="sameDomain" swLiveConnect="true" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> </EMBED> </OBJECT> </BODY> </HTML> I make sure that the xml is in the same directory as the swf file and everything works. So I guess what I really am asking is a better defination of .Setvariable and how this works. Again thanks in advance. muttley Here is a link to where I got the flash from: Flash Gauges
weaponx Posted July 14, 2008 Posted July 14, 2008 (edited) This isn't correct: .SetVariable('C:\Documents and Settings\user\Desktop\gauge\sample.xml', $SWFPath) Should be: .SetVariable('xml_source', 'C:\Documents and Settings\user\Desktop\gauge\sample.xml' Maybe also try: .FlashVars = '&xml_source=' & @ScriptDir & '\sample.xml' Edited July 14, 2008 by weaponx
Nhardel Posted July 15, 2008 Posted July 15, 2008 This isn't correct:.SetVariable('C:\Documents and Settings\user\Desktop\gauge\sample.xml', $SWFPath)Should be:.SetVariable('xml_source', 'C:\Documents and Settings\user\Desktop\gauge\sample.xml'Maybe also try:.FlashVars = '&xml_source=' & @ScriptDir & '\sample.xml'Thanks weaponx I could not get .SetVariable('xml_source', 'C:\Documents and Settings\user\Desktop\gauge\sample.xml' to work gave me a syntax errorbut .FlashVars = '&xml_source=' & @ScriptDir & '\sample.xml' did work this has helped out alot Thanks for sticking with me thru thisYour a gentleman and a scholar.....
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