10 Replies Latest reply on Oct 12, 2007 12:37 AM by Newsgroup_User

    Export code

    Level 7
      Hello:
      Is possible to export to a text file all of the code inside my movie
      (scripts and behaviors)?.
      thank you


        • 1. Re: Export code
          Level 7
          You could use scriptMember.linkAs(), but dealing with a protracted
          series of Save dialogs could get frustrating.
          You could also create a handler to do this for you. Grab a copy of the
          PRegEx xtra from < http://www.openxtras.org/pregex/> and FileXtra4 from
          < http://homepage.mac.com/klkersten/xtras/FileXtra4/index.html> and try
          the following:
          --
          on mExportScripts
          tFolder = xtra("FileXtra4").new().fx_FolderSelectDialog("Choose a
          folder:")
          if tFolder = EMPTY then exit

          nLibs = _movie.castLib.count
          repeat with l = 1 to nLibs
          nMems = _movie.castLib[l].member.count
          repeat with m = 1 to nMems
          tMember = member(m, l)
          if tMember.type = #script then
          tName = tMember.name
          if tName = EMPTY then
          tName = "member" && m && l
          end if
          tName = tName & ".ls"
          tText = tMember.scriptText
          OK = re_write(tFolder & tName, [tText])
          end if
          end repeat
          end repeat

          -- alert "Done..."
          end
          • 2. Re: Export code
            Lukewig Level 1
            Hi,

            You could also use this 'miaw xtra' (Director movie you put in Director's xtras folder)

            http://www.lingoworkshop.com/Codelib/XScripts.php

            It has three buttons:
            1. Export all scripts
            2. Externalise all scripts (convert embedded scripts to linked) -- use with care since it modifies the movie
            3. Internalise all scripts (convert linked scripts to fully embedded)-- use with care since it modifies the movie


            -- Cheers,

            Luke
            • 3. Re: Export code
              Level 7
              Thank you very much to all of you.
              When I use ( http://www.lingoworkshop.com/Codelib/XScripts.php)
              and export all scripts, where is the txt file?
              I don't find in anywhere.


              • 4. Re: Export code
                Lukewig Level 1
                Hi,
                Yes,sorry - last minute bug. It should work now (and prompt you for a place to save the scripts)
                Luke
                • 5. Re: Export code
                  macnmotion Level 1
                  Luke,

                  I placed your MIAW in my Xtras folder (MX2004 on PC), I have Buddy API in the Xtras folder. When I run your script, after choosing the Save location, I get the following error:

                  Handler Not Defined
                  #PRegEx_WriteEntireFile

                  Unable to view script or debug. Unable to download the source movie to inspect your code (error 404). Can you help?

                  Thanks. Andy C.
                  • 6. Re: Export code
                    Level 7
                    macnmotion wrote:
                    > I placed your MIAW in my Xtras folder (MX2004 on PC), I have Buddy
                    > API in the Xtras folder. When I run your script, after choosing the
                    > Save location, I get the following error:
                    >
                    > Handler Not Defined
                    > #PRegEx_WriteEntireFile

                    You need the PRegEx xtra from http://www.openxtras.org/ for that function.

                    Andrew


                    • 7. Re: Export code
                      Urban1977 Level 1
                      Instead of pushing XTRA's why has nobody not suggested using FileIO that comes with director.

                      http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_3192
                      • 8. Re: Export code
                        Level 7
                        Urban-Society wrote:
                        > Instead of pushing XTRA's why has nobody not suggested using FileIO
                        > that comes with director.

                        It's simpler to use xtras other than fileIO, and in the case of large files
                        it's faster.

                        I can't say for certain, but from watching the activity of the fileIO xtra
                        it looks to me like it writes one byte at a time, whereas other xtras write
                        blocks of bytes, hence something like a ten-fold (the actual figure may be
                        different, but it's noticeable) speed increase.

                        Andrew


                        • 9. Re: Export code
                          macnmotion Level 1
                          Thanks Andrew.

                          It worked, creating dozens of .ls files. When I view them with a text editor, they certainly have my code, however all formatting is lost, and extra "square" symbols are all over them. Not what I was hoping for, but at least all the code is backed up in text format. I may go through and copy/paste my scripts to Word to hold proper formatting and eliminate these extra formatting characters.

                          Andy C.
                          • 10. Re: Export code
                            Level 7
                            macnmotion wrote:
                            > It worked, creating dozens of .ls files. When I view them with a text
                            > editor, they certainly have my code, however all formatting is lost,
                            > and extra "square" symbols are all over them. Not what I was hoping
                            > for, but at least all the code is backed up in text format. I may go
                            > through and copy/paste my scripts to Word to hold proper formatting
                            > and eliminate these extra formatting characters.

                            Try a different text editor - if you're on a PC then EditPad Lite from
                            http://www.editpadpro.com/editpadlite.html might get the formatting right
                            without the boxes.

                            Andrew