Jump to content

NOOB ALERT! - delete from flash library help


Recommended Posts

;code begins here
; Shows the filenames of all files in the current directory
$search = FileFindFirstFile("*.fla") 

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")

EndIf

While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
 ;c:\tmp in the following line can be edited to your choice of file location
  Run("C:\Program Files\Macromedia\Flash 6\Flash MX\flash.exe")
  WinWaitActive("Macromedia Flash MX")
Send("^o")
Send("C:\tmp\" & $file)
 Send("{ENTER}")
  
 ;open library
 Send("^l")
 
;delete the offending movie Clip

;IM GETTING STUCK HERE HOW DO I GET AT A MOVIE CLIP IN THE FLASH LIBRARY
;What i would like if there was a script way of say if testerMC present delete it


 
; send export command 
 Send("^!S")
 WinWaitActive("Export Movie")
; set new filepath and name
 $file = StringTrimRight($file, 4)
 Send("C:\tmp\" & $file & ".swf")
 Send("{ENTER}")
 WinWaitActive("Export Flash Player")
; dismiss export settings dialg
 Send("{ENTER}")
 
 
 Send("^s")

; if you're not using MX 2004 Pro, edit the following line to match the Window title of your version
 WinWaitActive("Macromedia Flash MX [" & $file)
; close .fla file
 Send("^w")
 Send("n")
WEnd

; Close the search handle
FileClose($search)

Hi everyone, im trying to get rid of a movie clip from a library in flash. So the above script does helps me get as far as the library but i dont know how to click on a library item and then delete it. any help greatly appriciated.

D

Link to comment
Share on other sites

actually i was also thinking of making a small gui with this script if i wanted to browse for the folder where the flash file is kept and browse where the fla are kept and even browse for the folder to where the output swf will be kept.

does autoit have browse functionality and you can then get the path from that??

Link to comment
Share on other sites

Try this: (It needs lots of work, but you will get the idea)

#Include <File.au3>
#include <GuiConstants.au3>
#include <GuiList.au3>
#include <Array.au3>
#include <ie.au3>
#Include <Constants.au3>
#NoTrayIcon
Opt("TrayMenuMode",1)
Opt("MustDeclareVars", 1)
Dim $selection, $Form1, $flash, $Obj, $gui, $Obj1, $read, $swffile
Dim $selection2, $match, $html, $pending = 0, $swffile, $qst
Dim $downloaded[100], $question_a = 0, $main, $FileList, $atr
dim $st, $Edit_1, $Button_2, $Button_3, $Button_4, $lable_1
dim $Combo_5, $inir_0, $inir_1, $Button_6a, $Button_7, $lable_8
dim $restoreitem, $aboutitem, $exititem, $msg, $msg1, $inputbox
dim $oIEg, $urlname, $line, $search, $q_lable_1, $q_button_2
dim $q_button_3, $q_button_4, $msg2, $filemove, $delimit
Dim $split, $split2, $ppath, $qst2, $qst3, $renamefile, $stringchk
Dim $split3, $nMsg, $nMsg1, $size, $getz, $get2, $get2b, $getL, $getLb
Dim $get3, $get3b, $lenth, $lenthb, $ans, $sHTML, $flash1, $button_6
Dim $xx, $oDoc, $ansb, $browser, $button_7a, $Edit_1a, $reada

If FileExists(@ScriptDir & "\bin\Fconfig.ini") = 0 Then
    DirCreate(@ScriptDir & "\bin")
    IniWrite(@ScriptDir & "\bin\Fconfig.ini", "settings", "size", "2")
    IniWrite(@ScriptDir & "\bin\Fconfig.ini", "settings", "hotkey", "^{F3}")
    DirCreate(@ScriptDir & "\games")
    DirCreate(@ScriptDir & "\bin\temp")
    DirCreate(@ScriptDir & "\bin\temp\pending_review")
EndIf
$main = GUICreate("VollyViewer", 310, 300, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$FileList = _FileListToArray (@ScriptDir & "\games\", "*.swf", 1)
$atr = _ArrayTrim($FileList, 4, 1, 1)
$st = _ArrayToString($atr, "|", 1)
$Edit_1 = GUICtrlCreateList("", 20, 30, 170, 260)
GUICtrlSetData($Edit_1, $st)
$Button_2 = GUICtrlCreateButton("Play Game", 205, 30, 90, 30)
$Button_3 = GUICtrlCreateButton("Exit", 205, 68, 90, 30)
$Button_4 = GUICtrlCreateButton("Help", 205, 106, 90, 30)
$lable_1 = GUICtrlCreateLabel("Viewer size", 205, 142, 90, 20)
$Combo_5 = GUICtrlCreateCombo("", 205, 160, 90, 30)
$inir_0 = IniRead(@ScriptDir & "\bin\Fconfig.ini", "settings", "size", "Normal")
$inir_1 = IniRead(@ScriptDir & "\bin\Fconfig.ini", "settings", "hotkey", "^{F3}")
GUICtrlSetData($Combo_5, "Small|Normal|Large|Maximize", $inir_0)
$Button_6a = GUICtrlCreateButton("Hide to tray", 205, 190, 90, 30)
$Button_7 = GUICtrlCreateButton("Set Hotkey", 205, 230, 90, 30)
$lable_8 = GUICtrlCreateLabel("Hotkey = "&$inir_1, 205, 270, 90, 30)
$restoreitem = TrayCreateItem("Restore")
TrayCreateItem("")
$aboutitem = TrayCreateItem("About VollyViewer")
TrayCreateItem("")
$exititem = TrayCreateItem("Close and Exit")
TraySetState()
GUISetState()
While 1
    $msg = GUIGetMsg()  
    sleep(1)
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_2
            $read = GUICtrlRead($Edit_1)
            If $read = "" Then
                MsgBox(48, "Opps!", "You didn't select a game.")
            Else
                IniWrite(@ScriptDir & "\bin\Fconfig.ini", "settings", "size", GUICtrlRead($Combo_5))
                $selection = $read & ".swf"
                GUISetState(@SW_HIDE, $main)
                _viewer()
                GUISetState(@SW_SHOW, $main)
            EndIf
            ContinueLoop
        Case $msg = $Button_3 ;exit
            Exit

        Case $msg = $Button_4 ;help
            MsgBox(64, "", "to be made a html page")
        Case $msg = $Button_6a
            _hide()
        Case $msg = $Button_7
            $inputbox = InputBox("Set Hotkey", "Set what you want the flash grabber hotkey to be."&@CRLF _
                    &"It is best only to use one key or two key combinations." &@CRLF _
                    &"Use ""^"" for ctrl"&@CRLF _
                    &"Use "" !"" for alt", "", " M", 290, 150)
            IniWrite(@ScriptDir & "\bin\Fconfig.ini", "settings","hotkey", $inputbox)
            GUICtrlSetData($lable_8, "Hotkey = "&$inputbox)
    EndSelect
    sleep(3)
;~  $msg1 = TrayGetMsg() ;having trouble with this. CPU hunger issue.
;~  select
;~      Case $msg1 = $exititem ;exit from tray
;~          exitloop
;~      Case $msg1 = $restoreitem ;restore from tray
;~          _RestoreFromTray()
;~      Case $msg1 = $aboutitem ;about from tray
;~          _aboutVV()      
;~      Case Else
            ;;;
;~  EndSelect
WEnd
Exit

func _hide()
    GUISetState(@SW_HIDE, $main)
    $inir_1 = IniRead(@ScriptDir & "\bin\Fconfig.ini", "settings", "hotkey", "^{F3}")
    HotKeySet($inir_1, "_HotKeyForGrabbingSwfFiles")
EndFunc

func _HotKeyForGrabbingSwfFiles()
    
    if WinActive("[CLASS:MozillaUIWindowClass]","") then
        MsgBox(0, "Error with Flash Grabber!!!", "Flash Grabber only works with Internet Explorer.", 5)
    endif
    if WinActive("[CLASS:IEFrame]", "Internet Explorer") then
        Dim $downloaded[100]
        $downloaded[0] = 0
        $oIEg = _IEAttach ("Internet Explorer", "WindowTitle")
        $urlname = _IEPropertyGet ($oIEg, "locationurl")
        InetGet($urlname, @ScriptDir & "\bin\temp\temp.html")
        $html = FileOpen(@ScriptDir & "\bin\temp\temp.html", 0)
        While 1
            $line = FileReadLine($html)
            If @error Then
                FileClose($html)
                FileDelete(@ScriptDir & "\bin\temp.html")
                MsgBox(0, "Downloaded", "Downloaded " & $downloaded[0] & " .swf Files")
                Exitloop
            EndIf
            $delimit = "'"
            $delimit &= '"'
            $split = Stringsplit($line, $delimit)
            If Not @error Then
                For $i = 1 to $split[0]
                    If StringRight($split[$i], 3) = "swf" Then
                        $match = $split[$i]
                        $split2 = Stringsplit($line, ",)")
                        match()
                    EndIf
                Next
            EndIf
        WEnd
    EndIf
    #cs
        While 1
            $line = FileReadLine($html)
            If @error Then
                FileClose($html)
                FileDelete(@ScriptDir & "\bin\temp\temp.html")
                if $downloaded[0] = 0 then
                    MsgBox(48, "Error", "Error - Unable to grab swf file.", 5)
                    exitloop
                endif
                if $downloaded[0] = 1 then
                    $search = FileFindFirstFile(@ScriptDir & "\bin\temp\*.swf")
                    $swffile = FileFindNextFile($search)
                    ;MsgBox(48, "", $file)
                    $qst = GUICreate("",280, 160)
                    $q_lable_1 = GUICtrlCreateLabel("The following swf file was grabbed:"& @CRLF &"" & @CRLF _
                            &"   "& $swffile&"" & @CRLF &"" & @CRLF &"What do want to do with it?",10, 10, 300, 85 )
                    $q_button_2 = GUICtrlCreateButton("Add to Stash", 10, 120, 80, 25)
                    $q_button_3 = GUICtrlCreateButton("VollyView it!", 100, 120, 80, 25)
                    $q_button_4 = GUICtrlCreateButton("Delete it!", 190, 120, 80, 25)
                    GUISetState(@SW_SHOW,$qst )
                    while 1
                        $msg2 = GUIGetMsg()
                        Select
                            case $msg2 = $q_button_2
                                $question_a=1
                                _filequestion()
                                exitloop
                            case $msg2 = $q_button_3 ;run pending in player
                                $filemove = FileMove(@ScriptDir & "\bin\temp\"&$swffile, @ScriptDir & "\bin\temp\pending_review\"&$swffile, 1)
                                $pending = 1
                                $read = $swffile
                                GUIDelete($qst)
                                _viewer()
                                $question_a = 1
                                _filequestion()
                                ExitLoop
                            case $msg2 = $q_button_4
                                FileDelete(@ScriptDir & "\bin\temp\"&$swffile)
                                GUIDelete($qst)
                                Exitloop
                        EndSelect
                    WEnd
                    Exitloop
                endif
            EndIf
            $delimit = "'"
            $delimit &= '"'
            $split = Stringsplit($line, $delimit)
            If Not @error Then
                For $i = 1 to $split[0]
                    If StringRight($split[$i], 3) = "swf" Then
                        $match = $split[$i]
                        $split2 = Stringsplit($line, ",)")
                        match()
                    EndIf
                Next
            EndIf
            
        WEnd
    endif
    #ce
EndFunc

func _filequestion()
    if $question_a = 1 then
        $ppath = @ScriptDir & "\bin\temp\"&$swffile
        $question_a = 0
    endif
    if $question_a = 0 then $ppath = @ScriptDir & "\bin\temp\pending_review\"&$swffile
    $filemove = FileMove($ppath, @ScriptDir & "\games\"&$swffile, 0)
    $qst2 = MsgBox(4, "File already exist!", "The file name already exist in the stash. Do you wish to overwrite?")
    if $qst2 = 6 then
        FileMove($ppath, @ScriptDir & "\games\"&$swffile, 1)
    endif
    if $qst2 = 7 then
        $qst3 = MsgBox(32+4, "Question", "Do you wish to rename the file before adding it to the stash?"& @CRLF _
                &""& @CRLF _
                &"CLick YES to rename and save to the stash"& @CRLF _
                &"Click NO to delete the file.")
        If $qst3 = 1 then
            $renamefile = InputBox("Rename", "Type the name you want the file to be. You can use the following examples in nameing the file:"& @CRLF _
                    &""& @CRLF _
                    &"filename.swf"& @CRLF _
                    &"filename")
            $stringchk = StringRight($renamefile, 4)
            if $stringchk = ".swf" then
                FileMove($ppath, @ScriptDir & "\games\"&$renamefile, 1)
            Else
                FileMove($ppath, @ScriptDir & "\games\"&$renamefile&".swf", 1)
            endif
        endif
    endif
    GUIDelete($qst)

EndFunc

Func match()
    $split3 = StringSplit($match, "/")
    $size = InetGetSize($match)
    If $size > 100000 Then
        For $q = 1 to $downloaded[0]
            If $match = $downloaded[$q] Then
                Return
            EndIf
        Next
        InetGet($match, @ScriptDir & "\bin\temp\" & $split3[$split3[0]])
        $downloaded[0] += 1
        $downloaded[$downloaded[0]] = $match
    EndIf
EndFunc

func _RestoreFromTray()
    GUISetState(@SW_SHOW, $main)
    HotKeySet($inir_1)
EndFunc

Func _viewer()
    Local $W, $H
    $inir_1 = IniRead(@ScriptDir & "\bin\Fconfig.ini", "settings", "size", "")
    If $inir_1 = "small" Then
        $W = @DesktopWidth - 420
        $H = @DesktopHeight - 350
        $Form1 = GUICreate($read, $W, $H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
    EndIf
    If $inir_1 = "Normal" Then
        $W = @DesktopWidth - 320
        $H = @DesktopHeight - 250
        $Form1 = GUICreate($read, $W, $H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
    EndIf
    If $inir_1 = "Large" Then
        $W = @DesktopWidth - 220
        $H = @DesktopHeight - 150
        $Form1 = GUICreate($read, $W, $H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
    EndIf
    If $inir_1 = "Maximize" Then
        $W = @DesktopWidth   ;170
        $H = @DesktopHeight - 60    ;100
        $Form1 = GUICreate($read, $W, $H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
        WinSetState($Form1,"", @SW_MAXIMIZE)
    EndIf
    $getz = WinGetClientSize($Form1)
    $get2 = ($getz[0] * .46)
    $get2b = ($getz[1] * .95)
    $getL = StringLen($get2)
    $getLb = StringLen($get2b)
    $get3 = StringInStr($get2, ".")
    If $get3 = 0 Then $get3 = $get2
    $get3b = StringInStr($get2b, ".")
    If $get3b = 0 Then $get3b = $get2b
    $lenth = ($getL - $get3)
    $lenthb = ($getLb - $get3b)
    $ans = StringTrimRight($get2, $lenth + 1)
    $ansb = StringTrimRight($get2b, $lenthb + 1)
    $Obj = _IECreateEmbedded ()
    $browser = GUICtrlCreateObj ($Obj, 8, 8, $W - 20, $H - 70)
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
    _IENavigate ($Obj, 'about:blank')
    $oDoc = _IEDocGetObj ($Obj)
    $oDoc.body.style.overflow = "auto"
    $oDoc.body.style.margin = "0px"
    $oDoc.body.style.padding = "0px"
    If $inir_1 = "Normal" Or "Large" Or "Maximize" Then $xx = 0
    If $inir_1 = "Small" Then $xx = -15
    $button_6 = GUICtrlCreateButton("End Game", $ans, $ansb + $xx, 80, 30)
    $button_7a = GUICtrlCreateButton("Load Game", $ans + 100, $ansb + $xx, 80, 30)
    $Edit_1a = GUICtrlCreateList("", $ans + 200, $ansb + $xx, 180, 40)
    GUICtrlSetResizing($button_7a, 512)
    GUICtrlSetResizing($button_6, 512)
    GUICtrlSetResizing($Edit_1a, 512)
    GUICtrlSetData($Edit_1a, $st)
    GUISetState(@SW_SHOW)
    $flash1 = @ScriptDir & "\games\" & $selection
    $sHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
    $sHTML &= 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"'
    $sHTML &= '<embed id=flashy src="'&$flash1&'"'
    $sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
    $sHTML &= 'type="application/x-shockwave-flash" '
    $sHTML &= 'width="100%" height="100%"></embed>'
    _IEBodyWriteHTML ($Obj, $sHTML)
    if $pending = 0 then 
        loadswf($flash1)
    EndIf   
    if $pending = 1 then
        $pending = 0
        loadswf(@ScriptDir & "\bin\temp\pending_review\"&$swffile)
    endif

    While 1
        $nMsg = GUIGetMsg()
        $nMsg1 = TrayGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                ExitLoop
            Case $button_6
                GUIDelete($Form1)
                ExitLoop
            Case $button_7a 
                $reada = GUICtrlRead($Edit_1a)
                if $reada = "" then 
                    MsgBox(48, "Opps!", "You didn't select a game.")
                else    
                    _IENavigate ($Obj, 'about:blank')
                    sleep(100)
                    $flash1 = @ScriptDir & "\games\" & $reada&".swf"
                    $sHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
                    $sHTML &= 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"'
                    $sHTML &= '<embed id=flashy src="'&$flash1&'"'
                    $sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
                    $sHTML &= 'type="application/x-shockwave-flash" '
                    $sHTML &= 'width="100%" height="100%"></embed>'
                    _IEBodyWriteHTML ($Obj, $sHTML)
                    loadswf(@ScriptDir & "\games\"&$reada&".swf")
                EndIf
        EndSwitch
        Switch $nMsg1
            Case $restoreitem
                GUIDelete($Form1)
                GUISetState(@SW_SHOW, $main)
                ExitLoop
            Case $exititem
                GUIDelete($Form1)
                GUIDelete($main)
                Exit
            Case $aboutitem ;about from tray
                _aboutVV()
        EndSwitch
    WEnd
EndFunc   ;==>_viewer

func _aboutVV()
    MsgBox(64, "About", "VollyViewer by Volly."&@CRLF&""&@CRLF&" Special thanks to Lod3n, BigDaddy, and all the other"&@CRLF&"wonderful folks who helped me on this.")
EndFunc

func loadswf($filename)
    $flash = _IEGetObjByName ($Obj, "flashy")
    $flash.Movie = $filename
    
    winsettitle($gui,"","VollyViewer - "&$filename)
EndFunc
Link to comment
Share on other sites

Case $button_7a 
                $reada = GUICtrlRead($Edit_1a)
                if $reada = "" then
                    MsgBox(48, "Opps!", "You didn't select a game.")
                else   
                    _IENavigate ($Obj, 'about:blank')
                    sleep(100)
                    $flash1 = @ScriptDir & "\games\" & $reada&".swf"
                    $sHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
                    $sHTML &= 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"'
                    $sHTML &= '<embed id=flashy src="'&$flash1&'"'
                    $sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
                    $sHTML &= 'type="application/x-shockwave-flash" '
                    $sHTML &= 'width="100%" height="100%"></embed>'
                    _IEBodyWriteHTML ($Obj, $sHTML)
                    loadswf(@ScriptDir & "\games\"&$reada&".swf")
                EndIf

Link to comment
Share on other sites

A right ok. im a flash developer i mean the flash development enviorment i need to access the library in flash see pic attached how do i get to click the testerMc2 Movie Clip in the library and delete it there is no shortcut for selecting them you have to click onto it

also i was hoping to have a small gui where you would be able to instead of

$search = FileFindFirstFile("*.fla")

be able to browse for the folder to where the flash files are stored. instead of putting the script in the same folder as the flas

and the script would read the flas from their.

I am eternally grateful for any help and if you need any flash help you know where to come

post-25432-1185274517_thumb.jpg

Edited by dustyRods
Link to comment
Share on other sites

I don't mean to be thick headed, but I'm having a hard time following you on just what you want.

are you wanting to doing one of the following?? :

1. Want to have a script embedded in flash?

2. click on a control in flash?

3. delete a file so the user can't access the flash control?

I think you want #3, if I'm following you right. You may want to simply have it so if it sees the movie you want to delete, have a while black list that blocks it.

Link to comment
Share on other sites

Hi ya no problem im not the best at explaning things.

We have a 1000 fla files these are flash devleopment files within each of these there is something called a movie clip called testerMc2 we need to delete this from the library which will delete it completly from the fla file and then re export the swf (which is the output file) and save the fla file. therefore we have updated both fla and swf and we have gotten rid of the offending Movie Clip

the script is not embeded in flash no

ya i need to click on the Movie clip testerMc2 in the library i can then send a delete call to it and that will get rid of it. the problem is how do i click it.

no were deleting something out of the fla so that we can update the swf.

If you need any more details shout. think of it as trying to delete a layer in photoshop. how would you go about that?

Link to comment
Share on other sites

I think I'm following you now. A FLA file is something like a zip file in that there are embedded files within it. You want to remove a embedded file, then save your change by doing a export which is the swf? DO I have this right? I think we can script with AutoIt interacting with your flash editor, but it will take some doing.

Link to comment
Share on other sites

the movie clip is an object with the fla file it isnt another file. I can get currently the script up to the library part with the ctrl L send call

however i need to click the on the movieClip called testerMc2 and once its highlighted i can then send a delete call which will give me a dialog. the problem is how do i click that movieClip called testerMc2

Im unsure about command lin this guy seems to have done something with it allright - http://www.mikechambers.com/blog/2003/11/0...d-line-compiler

Thanks again for all your help.

D

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...