Results 1 to 10 of 10

Thread: Using ShockwaveFlashObjects in VB Script

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    6

    Exclamation Using ShockwaveFlashObjects in VB Script

    This has been bothering me for quite some time now, I hope someone here can help me.

    In Windows Notepad I save a blank file as "hello.vbs"

    Then I enter this:

    Code:
    Set test = CreateObject("ShockwaveFlashObject")
    Set test = Nothing
    Save and then I double click hello.vbs to run it. I get the following error:

    Code:
    Script: C:\hello.vbs
    Line: 1
    Char: 1
    Error: ActiveX component can't create object: 'ShockwaveFlashObject'
    Code: 800A0AD
    Source: Microsoft VBScript runtime error
    Why? I have the flash plugin installed on my computer.

    I've tried this: regsvr32 C:\WINDOWS\system32\Macromed\Flash\Flash32_11_5_502_149.ocx

    It says that it succeeded, still I get the same error. I've also tried this in hello.vbs:

    Code:
    Set test = CreateObject("AxInterop.ShockwaveFlashObjects")
    Set test = CreateObject("ShockwaveFlashObjects")
    Set test = CreateObject("AxShockwaveFlashObjects")
    Set test = CreateObject("ShockwaveFlashObject")
    Set test = CreateObject("Flash32_11_5_502_149")
    None of it works! I'm very annoyed, what am I missing here? All I want to do is load a flash file into VBScript.

    My end goal is to try and create a screenshot of the flash file in VBScript once it has loaded. Please help!

  2. #2
    Lively Member
    Join Date
    Dec 2010
    Location
    http://bbat.forumeiro.com/
    Posts
    86

    Lightbulb Re: Using ShockwaveFlashObjects in VB Script

    Hi
    What do you want to achieve with this vbscript ?
    Do you want to read a file with .swf ? so try using Internet Explorer to open it easily !
    An example to download a file.swf and open it with IE
    Code:
    Dim strFileURL,strHDLocation
    Titre = "Download Flash Games"
    ' Tes paramètres
    Set objFSO = Createobject("Scripting.FileSystemObject")
        PathScript = objFSO.GetParentFolderName(wscript.ScriptFullName)& "DownloadFlash"
    	If Not objFSO.FolderExists(PathScript) Then
    	objFSO.CreateFolder(PathScript)
    	End If
        strFileURL = InputBox("Link to Download File","Link to Download File","http://www.poissonrouge.com/colourbugs/colour_bugs_nomessage.swf")
    	If strFileURL = "" Then Wscript.Quit
    	NomFichier = InputBox("Select the file name to save","Select the file name to save","Namefile")
    	If NomFichier = "" Then Wscript.Quit
        strHDLocation = PathScript & "\" & NomFichier &".swf" 'Nom avec lequel l'enregistré
    ' Récupérer le fichier
        Set Ws = CreateObject("WScript.Shell")
     'Autoriser le contenu actif à s'exécuter dans les fichiers de la zone Ordinateur local
       LockDown="HKLM\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN\"
       Keysec1=LockDown & "iexplore.exe"
       itemtype = "REG_DWORD"
       WS.RegWrite Keysec1,0,itemtype 
        Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
        objXMLHTTP.open "GET", strFileURL, false
        objXMLHTTP.send()
    If objXMLHTTP.Status = 200 Then
    Set objADOStream = CreateObject("ADODB.Stream")
    objADOStream.Open
    objADOStream.Type = 1 'adTypeBinary
    objADOStream.Write objXMLHTTP.ResponseBody
    objADOStream.Position = 0    'Set the stream position to the start
    Set objFSO = Createobject("Scripting.FileSystemObject")
    If Not objFSO.Fileexists(strHDLocation) Then
    objADOStream.SaveToFile strHDLocation
    objADOStream.Close
    end if
    Set objADOStream = Nothing
    End If
    Set objXMLHTTP = Nothing 
    Explorer()
    Set WS = Nothing
    Set objFSO = Nothing
    
    Sub Explorer()
    Ws.Run "%comspec% /c Start iexplore.exe " & strHDLocation,0,False
    wscript.sleep 5000
    Question = MsgBox ("Vouliez-vous ouvrir ce Jeu en plein écran ?" & Vbcr &_
     "SI oui , alors cliquez sur [OUI]  ?"& Vbcr &_
     "Sinon , alors cliquez sur [NON]",VBYesNO+VbQuestion,Titre)
     If Question = VbYes then
        WS.AppActivate strHDLocation
        WS.SendKeys "{F11}" 'pour mettre internet explorer en plein écran
    else
            WScript.Quit
     End if
    Set WS = Nothing
    end Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    6

    Smile Re: Using ShockwaveFlashObjects in VB Script

    Thanks a lot for your reply!

    My end goal with this is to create a screenshot of the flash file. I want to for example have in a folder:

    flash.swf
    flashScreen.vbs

    After I run "flashScreen.vbs" I want to have this in the same folder:

    flash.swf
    flashScreen.vbs
    flash.jpg

    The first step towards my goal is to actually be able to read the flash file in the VB Script.

    I haven't looked at the code you've posted yet, I'll do it a little later today. I really appreciate any help you can give me towards fullfilling my goal!

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    6

    Unhappy Re: Using ShockwaveFlashObjects in VB Script

    Alright, I've checked your code now. Seems like you somehow thought I wanted to download and display a flash. That's not what I'm trying to do.

    I want to know how I can use "AxShockwaveFlashObjects" in VB Script.

    Alternativly I will accept a method of launching the flash in internet explorer and then take a screenshot of it, through VB Script, and the window must not be visible to anyone logged in.

    I have high hopes on this forum, can't anybody help me? Must be a lot of experts here

  5. #5
    Lively Member
    Join Date
    Dec 2010
    Location
    http://bbat.forumeiro.com/
    Posts
    86

    Lightbulb Re: Using ShockwaveFlashObjects in VB Script

    Hi
    To achieve your aim :
    First you must use an external tool named NirCmd where you can download it here http://www.nirsoft.net/utils/nircmd.html
    Second UnZip the file and extract the file named : NirCmdc.exe : NirCmdc in Line Command and copy it in your windows folder
    Finally Copy and paste this Vbscript in your notepad and test it
    Code:
    Set Ws = CreateObject("WScript.Shell")
    Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
    folder = Day(Now) & "_" & Month(Now) & "_" & Year(Now)
    If Not fso.FolderExists("c:\temp\"&Folder) Then
    	com = "cmd /c md c:\temp\"&Folder
    	Resultat1 = Ws.Run(Com,0,false)
    end if
    PathSWF = "D:\DownloadFlash\Color.swf" 'change to your path
    RunFlash = ws.run("iexplore.exe -k "&PathSWF,1,false) 'Start IE in FullScreen
    wscript.sleep 3000
    command = "cmd /c nircmdc.exe savescreenshot ""c:\temp\"& Folder &"\"& Folder &".jpg"""
    screenshot = Ws.Run(Command,0,false)
    Last edited by Hackoo; Feb 20th, 2013 at 07:35 PM.

  6. #6

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    6

    Re: Using ShockwaveFlashObjects in VB Script

    Thanks for your solution, however it's not exactly what I wanted so we're not done yet.

    First of all I'd like nothing to appear when taking the screenshots, no windows should come up. Meaning the flash should be loaded in memory, just not being displayed in a window.

    Secondly it must work even if I'm not at the computer, the script will be set to run automatically while the computer could be locked (showing the password prompt to log back in).

    And thirdly it should be a screenshot of only the flash, not the entire screen and not even the window that contains the flash - just the actual flash.

    Needless to say we need a programming master for this.

    I know it can be done for I have seen it. I do believe learning how to use "AxShockwaveFlashObjects" would be the first step towards solving this.

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    6

    Re: Using ShockwaveFlashObjects in VB Script

    BUMP

    This has still not been solved.

    I'm still looking for how to do this. It's not impossible.

    Does anybody have an answer??? This is seriously driving me nuts. All this searching for an answer... for MONTHS!

  8. #8
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Using ShockwaveFlashObjects in VB Script

    I think the reason Flash fails to be created is because it needs a parent window to host the Flash window. You say you have seen it done before - can you provide more details about it?
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  9. #9

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    6

    Re: Using ShockwaveFlashObjects in VB Script

    Take this drink and sit you down next to me, warm yourself by the fire while I tell you my story:

    Once upon a time, long ago when the flash format was but a couple of years old, I had a dll file. I could register this dll file using regsvr32 in Windows, it made it available in ASP files (vbscript).

    I could then use it in ASP files (or vbs files) by writing:

    Code:
    Set swfimg = CreateObject("swfimg.swfimgObject")
    swfimg.Width = 550
    swfimg.Height = 400
    swfimg.ImageQuality = 100
    swfimg.FilePath = "c:\flashfile.swf"
    swfimg.Frame = 1
    swfimg.Work
    swfimg.Save("c:\screenshot.jpg")
    Set swfimg = Nothing
    This worked even when I was logged out and nobody was watching the desktop. Even after a reboot and nobody had ever logged in. The ASP files could run on a server when someone visited a homepage for example.

    But time has caused me to lose this dll file, no trace remains of it. But I know it is possible for I have seen it!

    Now I want to code my own. Have been wanting for quite some time now, and ever am I searching for an answer.

    Can you help me?


    Edit: "swfimg" is not the real name of this component, the mist of time has swallowed the memory of its true name.

  10. #10
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Using ShockwaveFlashObjects in VB Script

    Googling "VBScript SWF DLL -decompiler" led me to SWF To Image library. Download it here.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width