Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: my personal swf game archive checker html batch script  (Read 16071 times)

0 Members and 1 Guest are viewing this topic.

snowcatman

    Topic Starter


    Beginner

    • Experience: Beginner
    • OS: Windows 8
    my personal swf game archive checker html batch script
    « on: March 22, 2014, 12:11:22 PM »
    Ok, i am playing dumb... ::)

    I download flash games to play when I am offline and to entertain my younger kid's.
    Its all on my external hard drive. for portability.
    I need a way to have each swf game in its own sub directory and have its own html file made for it in the same sub directory.
    Then I need a main html file point to each game html file in those sub directories.

    Its becoming a nice collection. But I am getting board doing this manually.

    i think, the things i need to have are:
    sample.html
    for template html code.

    swf-game-checker-html-directories.bat
    for the workhorse of the automation job.

    -----------------------------------
    sample.html file
    -----------------------------------
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
    <title>sample-game-html.swf</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript" src="scripts/swfobject.js"></script>
    <script type="text/javascript">
    swfobject.registerObject("flashId", "9.0.0", "flash/expressInstall.swf");
    </script>
    </head>
    <body>
    <center>
    <div>
    <object id="flashId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600">
    <param name="movie" value="sample-game-html.swf" />
    <param name="FlashVars" value="name=Dr.Solve"/>
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="sample-game-html.swf" width="800" height="600">
    <param name="FlashVars" value="name=Dr.Solve"/>
    <!--<![endif]-->
    <div>
    <h1>Alternative content</h1>
    <p>Get Adobe Flash player</p>
    </div>
    </center>
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
    </object>
    </div>
    </body>
    </html>
    -------------------------------------------------------
    swf-game-checker-html-directories.bat
    -------------------------------------------------------
    @rem logonwallpaper.bat
    @ECHO OFF
    @SETLOCAL ENABLEEXTENSIONS
    @cd /d "%~dp0"

    DEL ERROR.LOG

    >>"%~dp0\error.log" 2>&1 echo -------------------------begining of batch script-------------------------
    >>"%~dp0\error.log" 2>&1 echo ==========================================================================
    >>"%~dp0\error.log" 2>&1 echo started SWF GAME HTML script year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.
    >>"%~dp0\error.log" 2>&1 echo ==========================================================================



    ECHO PART ONE
    >>"%~dp0\error.log" 2>&1 echo PART ONE
    ECHO.
    >>"%~dp0\error.log" 2>&1 echo %CD%
    DIR/W
    ECHO.
    ECHO %CD%
    ECHO.
    ECHO THIS IS JUST A STARTING POINT...
    PAUSE > NUL
    CLS

    >>"%~dp0\error.log" 2>&1 echo ....................................... ......
    ECHO PART tWO
    >>"%~dp0\error.log" 2>&1 echo PART tWO

    PAUSE > NUL
    CLS


    >>"%~dp0\error.log" 2>&1 echo =======================================================================
    >>"%~dp0\error.log" 2>&1 echo --------------------------end of batch script--------------------------


    -------------------------------------------------------
    I feel like I have writers block. or something....
    I know, I know... I think I can, I think, I think I can!  :P

    snowcatman

      Topic Starter


      Beginner

      • Experience: Beginner
      • OS: Windows 8
      Re: my personal swf game archive checker html batch script
      « Reply #1 on: March 22, 2014, 12:27:10 PM »
      ECHO PART TWO
      >>"%~dp0\error.log" 2>&1 echo PART tWO
      >>"%~dp0\error.log" 2>&1 echo ....................................... ......
      ECHO.
      :: UM, CHECK EACH SUB DIRECTORY
      :: I GUESS I COULD START OFF SAYING IF SWF AND HTML EXISTS THEN NEXT.
      :: THEN IF SWF FILE EXIST AND NO HTML THEN CREATE HTML WITH SAMPLE AND CHANGE TXT IN HTML
      :: THEN GO TO NEXT DIRECTORY
      PAUSE > NUL
      CLS

      snowcatman

        Topic Starter


        Beginner

        • Experience: Beginner
        • OS: Windows 8
        Re: my personal swf game archive checker html batch script
        « Reply #2 on: March 22, 2014, 01:09:12 PM »
        ok taking a break will work on this a little later. kind hope you have some ideas for me. thank you.


        ECHO PART TWO
        >>"%~dp0\error.log" 2>&1 echo PART tWO
        >>"%~dp0\error.log" 2>&1 echo ....................................... ......
        ECHO.
        :: UM, CHECK EACH SUB DIRECTORY
        :: I GUESS I COULD START OFF SAYING IF SWF AND HTML EXISTS THEN NEXT.
        :: THEN IF SWF FILE EXIST AND NO HTML THEN CREATE HTML WITH SAMPLE AND CHANGE TXT IN HTML
        :: THEN GO TO NEXT DIRECTORY

        for /d %%a in (*) do (
           if exist "%%a\*.swf && %%a\*.html" . null &&goto addhtml

        :addhtml
        copy sample.html %%a | edit said file replacing "sample-game-html.swf" with name of current file in directory

        PAUSE > NUL
        CLS

        Lemonilla



          Apprentice

        • "Too sweet"
        • Thanked: 70
        • Computer: Specs
        • Experience: Experienced
        • OS: Windows 7
        Re: my personal swf game archive checker html batch script
        « Reply #3 on: March 22, 2014, 01:32:13 PM »
        I look forward to seeing where this goes.  I'll see if I can do some work on it when I have time.
        Quote from: patio
        God Bless the DOS Helpers...
        Quote
        If it compiles, send the files.

        snowcatman

          Topic Starter


          Beginner

          • Experience: Beginner
          • OS: Windows 8
          Re: my personal swf game archive checker html batch script
          « Reply #4 on: March 22, 2014, 04:23:12 PM »
          I cleaned it up a little. put i don't think it doing what i want yet.....

          ECHO PART TWO
          >>"%~dp0\error.log" 2>&1 echo ....................................... ......
          >>"%~dp0\error.log" 2>&1 echo PART TWO

          ECHO.
          :: UM, CHECK EACH SUB DIRECTORY
          :: I GUESS I COULD START OFF SAYING IF SWF AND HTML EXISTS THEN NEXT.
          :: THEN IF SWF FILE EXIST AND NO HTML THEN CREATE HTML WITH SAMPLE AND CHANGE TXT IN HTML
          :: THEN GO TO NEXT DIRECTORY
          >>"%~dp0\error.log" 2>&1 echo %CD%
          ECHO %CD%
          ECHO.

          for /d /r %%a in (*) do (
             if exist "%%a\*.swf" >>"%~dp0\error.log" 2>&1 echo found swf&& goto checkhtml
          )
          echo File does not exist.

          :checkhtml

          for /d /r %%a in (*) do (
             if exist "%%a\*.html" >>"%~dp0\error.log" 2>&1 echo found html&&goto continue
          )
          echo File does not exist.

          :continue
          >>"%~dp0\error.log" 2>&1 echo Rest of your code here.
          echo done


          PAUSE > NUL
          CLS

          snowcatman

            Topic Starter


            Beginner

            • Experience: Beginner
            • OS: Windows 8
            Re: my personal swf game archive checker html batch script
            « Reply #5 on: March 22, 2014, 07:20:08 PM »
            ECHO PART TWO
            >>"%~dp0\error.log" 2>&1 echo ....................................... ......
            >>"%~dp0\error.log" 2>&1 echo PART tWO
            ECHO.
            :: UM, CHECK EACH SUB DIRECTORY
            :: I GUESS I COULD START OFF SAYING IF SWF AND HTML EXISTS THEN NEXT.
            :: THEN IF SWF FILE EXIST AND NO HTML THEN CREATE HTML WITH SAMPLE AND CHANGE TXT IN HTML
            :: THEN GO TO NEXT DIRECTORY
            >>"%~dp0\error.log" 2>&1 echo %CD%
            ECHO %CD%
            for /f "tokens=1-2 delims=;" %%i in ('dir /s /b') do (
               copy "test.html" "%%~dpI" >>"%~dp0\error.log" 2>&1
               )

            PAUSE > NUL
            CLS

            ok, did some online researching.  whats slowing me down is i don't know dos batching.
             i did this in a test environment and it almost does what i want. made a mess thew..
             
            i am putting a modified log file here:
            -------------------------begining of batch script-------------------------
            ==========================================================================
            started SWF GAME HTML script year2014,day22,month03,time18,09.
            ==========================================================================
            PART ONE
            G:\flashgames\flashgames batch test\All-Games\Games
            ....................................... ......
            PART tWO
            G:\flashgames\flashgames batch test\All-Games\Games

               about five hundred of these lines below "1 file(s) copied."
                    1 file(s) copied.
                    1 file(s) copied.
                    1 file(s) copied.
                    1 file(s) copied.
                    1 file(s) copied.
                    1 file(s) copied.
                    1 file(s) copied.

            =======================================================================
            --------------------------end of batch script--------------------------

            yet i went in and deleted the test.html of the last game folder so as to see that it copied. and after i run the batch file its still not there.

            foxidrive



              Specialist
            • Thanked: 268
            • Experience: Experienced
            • OS: Windows 8
            Re: my personal swf game archive checker html batch script
            « Reply #6 on: March 22, 2014, 10:29:18 PM »
            The HTML file in each game folder just has a few minor changes for each folder right?  What changes do you want to make?

            You'd create the HTML file in each folder in a loop, and add the changes as you go.

            Then a second loop will let you gather the html filenames to put in a menu.

            snowcatman

              Topic Starter


              Beginner

              • Experience: Beginner
              • OS: Windows 8
              Re: my personal swf game archive checker html batch script
              « Reply #7 on: March 23, 2014, 07:02:39 AM »
              yes foxidrive.   ;D

              what you said is right on the mark. far as i can tell..

              Also I want to be able to reuse the script later as I
              add new swf file to there own folders as i collect them.
              so as not to modify the the previous games. just
              add/modify the new games in there folders.

              The change in the html is to replace all the
              text "sample-game-html.swf" with the name
              of the swf file in each game folder.
              in the html i left in the beginning of this post
              you will notice there are three places sample-game-html.swf exists.

              in folder \games\abc
              there is abc.swf by itself.
              copy of sample.html should be added and named abc.html
              and edited to reflect the changes
              example: sample-game-html.swf  replaced with ---> abc.swf in the html file
              next folder

              I would love some link's and/or a short description
              of what the script you would show me does.

              e.g. like
              tokens=1-2 delims=
              %%~dpI
              does and how it comes together. i think i am
              just on the clasp of learning this stuff.
              I know there is a lot more to learn than meets the eye.  :)
              thank you.

              « Last Edit: March 23, 2014, 07:24:56 AM by snowcatman »

              foxidrive



                Specialist
              • Thanked: 268
              • Experience: Experienced
              • OS: Windows 8
              Re: my personal swf game archive checker html batch script
              « Reply #8 on: March 23, 2014, 09:08:17 AM »
              This uses d:\games (two references) and creates the HTML code if it doesn't already exist.

              It uses the directory name for the HTML file and puts the SWF filename inside the HTML.
              A list is created of the new HTML files in the "d:\games\menulist.txt" file.

              You could really recreate every HTML file every time it is run - it wouldn't take long - and that will give you a full list of every game in the "d:\games\menulist.txt" file every time

              The characters that need to be escaped in the HTML script are < > ) | ^ & and are escaped with a ^ character.


              Code: [Select]
              @echo off
              for /d /r "d:\games" %%a in (*) do (
                  if exist "%%a\*.swf" if not exist "%%a\%%~nxa.html" (
                     for %%b in ("%%a\*.swf") do (

              (
              echo ^<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"^>
              echo ^<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"^>
              echo ^<head^>
              echo ^<title^>%%~nxb^</title^>
              echo ^<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /^>
              echo ^<script type="text/javascript" src="scripts/swfobject.js"^>^</script^>
              echo ^<script type="text/javascript"^>
              echo swfobject.registerObject("flashId", "9.0.0", "flash/expressInstall.swf"^);
              echo ^</script^>
              echo ^</head^>
              echo ^<body^>
              echo ^<center^>
              echo ^<div^>
              echo ^<object id="flashId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600"^>
              echo ^<param name="movie" value="%%~nxb" /^>
              echo ^<param name="FlashVars" value="name=Dr.Solve"/^>
              echo ^<!--[if !IE]^>--^>
              echo ^<object type="application/x-shockwave-flash" data="%%~nxb" width="800" height="600"^>
              echo ^<param name="FlashVars" value="name=Dr.Solve"/^>
              echo ^<!--^<![endif]--^>
              echo ^<div^>
              echo ^<h1^>Alternative content^</h1^>
              echo ^<p^>Get Adobe Flash player^</p^>
              echo ^</div^>
              echo ^</center^>
              echo ^<!--[if !IE]^>--^>
              echo ^</object^>
              echo ^<!--^<![endif]--^>
              echo ^</object^>
              echo ^</div^>
              echo ^</body^>
              echo ^</html^>
              ) > "%%a\%%~nxa.html"

              )
              echo "%%a\%%~nxa.html" >> "d:\games\menulist.txt"
              )
              )


              snowcatman

                Topic Starter


                Beginner

                • Experience: Beginner
                • OS: Windows 8
                Re: my personal swf game archive checker html batch script
                « Reply #9 on: March 23, 2014, 09:48:47 AM »
                I like it. i tried this in my virtual box and it works great.
                but when i used it on my host machine it spit out errors.

                can this be made mobile and is there a way to log it?

                i tried changing the "d\games" to "%~dp0\" and it does put the html in the folders

                your statement got me thinking.
                This uses d:\games (two references) and creates the HTML code if it doesn't already exist.
                (two references), i know i am missing something.

                but then the batch cuts off.

                log show's that script did not end after were i put the code in you wrote and i changed.
                error in consul is "The system cannot find the path specified."
                thank you.

                foxidrive



                  Specialist
                • Thanked: 268
                • Experience: Experienced
                • OS: Windows 8
                Re: my personal swf game archive checker html batch script
                « Reply #10 on: March 23, 2014, 10:39:06 AM »
                To make it run from the current folder:

                remove "d\games"
                change "d:\games\menulist.txt" to "menulist.txt"


                snowcatman

                  Topic Starter


                  Beginner

                  • Experience: Beginner
                  • OS: Windows 8
                  Re: my personal swf game archive checker html batch script
                  « Reply #11 on: March 23, 2014, 11:42:46 AM »
                  thank you foxidrive that did the trick.
                  going to look-up what your script does. wished i understood some of it

                  %%a\%%~nxa.html

                  this for and if loop i am trying to understand. is there a link witch enplanes it more in detail? i get some of the simple examples but somehow i don't see how you pulled it off. wished i understood it. i think i get lost in some of the terminology of batch scripting


                  not that i want you to do all the work do i just double the effort to make a master html. i was thinking you have the list so maybe i need to refer to another bat file to append the list findings to a current html file?

                  i also notice you set the list file will not change unless there is a successful html made in a swf directory.
                  « Last Edit: March 23, 2014, 12:38:11 PM by snowcatman »

                  snowcatman

                    Topic Starter


                    Beginner

                    • Experience: Beginner
                    • OS: Windows 8
                    Re: my personal swf game archive checker html batch script
                    « Reply #12 on: March 23, 2014, 09:23:14 PM »
                    Ok this is what i ended with. it works and all. thank you foxidrive
                        bet you can clean it up a bit. but remember i need to be mobile. As i use a usb hard drive. thank you

                    I also want to add some more logging to this script. too.

                    ==================================================

                    @rem logonwallpaper.bat
                    @ECHO OFF
                    @SETLOCAL ENABLEEXTENSIONS
                    @cd /d "%~dp0"
                    DEL ERROR.LOG

                    >>"%~dp0\error.log" 2>&1 echo -------------------------begining of batch script-------------------------
                    >>"%~dp0\error.log" 2>&1 echo. ==========================================================================
                    >>"%~dp0\error.log" 2>&1 echo started SWF GAME HTML script year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.
                    >>"%~dp0\error.log" 2>&1 echo. ==========================================================================

                    echo -------------------------begining of batch script-------------------------
                    echo ==========================================================================
                    echo started SWF GAME HTML script year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.
                    echo. ==========================================================================
                    echo.
                    echo.



                    >>"%~dp0\error.log" 2>&1 echo -----------Part One ------------
                    ECHO PART ONE
                    >>"%~dp0\error.log" 2>&1 echo PART ONE
                    ECHO.
                    >>"%~dp0\error.log" 2>&1 echo %CD%
                    DIR/W
                    ECHO.
                    ECHO %CD%
                    ECHO.
                    ECHO THIS IS JUST A STARTING POINT...
                    pause
                    cls

                    echo Cleanup
                    >>"%~dp0\error.log" 2>&1 echo  ------- Cleanup -------
                    >>"%~dp0\error.log" 2>&1 del /s *.html
                    >>"%~dp0\error.log" 2>&1 echo  ----- End Cleanup -----
                    >>"%~dp0\error.log" 2>&1 echo.
                    echo.
                    echo cleanup finnished
                    pause




                    ECHO PART TWO
                    >>"%~dp0\error.log" 2>&1 echo ....................................... ......
                    >>"%~dp0\error.log" 2>&1 echo PART TWO

                    ECHO.
                    :: UM, CHECK EACH SUB DIRECTORY
                    :: I GUESS I COULD START OFF SAYING IF SWF AND HTML EXISTS THEN NEXT.
                    :: THEN IF SWF FILE EXIST AND NO HTML THEN CREATE HTML WITH SAMPLE AND CHANGE TXT IN HTML
                    :: THEN GO TO NEXT DIRECTORY
                    >>"%~dp0\error.log" 2>&1 echo %CD%
                    ECHO %CD%
                    ECHO.
                    ECHO Update Operation In Progress - Please Stand By...
                    echo ^<!DOCTYPE HTML PUBLIC^> >>index.html
                    echo ^<html^> >>index.html
                    ECHO ^<body^> >>index.html
                    for /d /r %%a in (*) do (
                        if exist "%%a\*.swf" if not exist "%%a\%%~nxa.html" (
                           for %%b in ("%%a\*.swf") do (

                    (
                    echo ^<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"^>
                    echo ^<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"^>
                    echo ^<head^>
                    echo ^<title^>%%~nxb^</title^>
                    echo ^<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /^>
                    echo ^<script type="text/javascript" src="scripts/swfobject.js"^>^</script^>
                    echo ^<script type="text/javascript"^>
                    echo swfobject.registerObject("flashId", "9.0.0", "flash/expressInstall.swf"^);
                    echo ^</script^>
                    echo ^</head^>
                    echo ^<body^>
                    echo ^<center^>
                    echo ^<div^>
                    echo ^<object id="flashId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600"^>
                    echo ^<param name="movie" value="%%~nxb" /^>
                    echo ^<param name="FlashVars" value="name=Dr.Solve"/^>
                    echo ^<!--[if !IE]^>--^>
                    echo ^<object type="application/x-shockwave-flash" data="%%~nxb" width="800" height="600"^>
                    echo ^<param name="FlashVars" value="name=Dr.Solve"/^>
                    echo ^<!--^<![endif]--^>
                    echo ^<div^>
                    echo ^<h1^>Alternative content^</h1^>
                    echo ^<p^>Get Adobe Flash player^</p^>
                    echo ^</div^>
                    echo ^</center^>
                    echo ^<!--[if !IE]^>--^>
                    echo ^</object^>
                    echo ^<!--^<![endif]--^>
                    echo ^</object^>
                    echo ^</div^>
                    echo ^</body^>
                    echo ^</html^>
                    ) > "%%a\%%~nxa.html"


                    )



                    @rem echo "%%a\%%~nxa.html" >> "%~dp0\index.html"
                    echo ^<a href="%%a\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> "%~dp0\index.html"

                    )
                    )


                    echo ^<!-- more content --^> >>index.html
                    echo ^<!-- you don't need to escape ( ) outside blocks --^> >>index.html
                    echo ^<!-- don't escape inside quotes "&" --^> >>index.html
                    ECHO ^</body^> >>index.html
                    echo ^</html^> >>index.html


                    echo.

                    ECHO END OF SCRIPT
                    ECHO PRESS ANYKEY
                    :: CHOICE DOES NOT WORK TO WAIT X AMOUNT OF SECOUNDS
                    :: CHOICE /C:d /N /Td,3
                    :: FOR %%D IN (40 40) DO CHOICE /C:d /N /Td,40
                    PAUSE
                    CLS


                    >>"%~dp0\error.log" 2>&1 echo =======================================================================
                    >>"%~dp0\error.log" 2>&1 echo --------------------------end of batch script--------------------------
                    @endlocal


                    ================================================


                    foxidrive



                      Specialist
                    • Thanked: 268
                    • Experience: Experienced
                    • OS: Windows 8
                    Re: my personal swf game archive checker html batch script
                    « Reply #13 on: March 24, 2014, 12:00:52 AM »

                    %%a\%%~nxa.html

                    this for and if loop i am trying to understand.

                    %%a contains the full path to every folder below the current folder (when "d:\games" isn't used) and in all subfolders

                    %%~nxa contains the name and extension, which is the last folder in the full path of %%a
                    You see CMD doesn't know or care that the last part is a folder or a filename.exe so in this case the FOR metavariables treats it like an extensionless filename - or with an extension if the folder contains a period.

                    As an example if the folder in %%a were c:\windows\system32 then %%~nxa would return system32

                    You can see the FOR modifiers on the last page of the help: type FOR /?


                    If you want further explanation then tell me which parts you need explained and what you think they do.   That makes explaining an easier process.

                    snowcatman

                      Topic Starter


                      Beginner

                      • Experience: Beginner
                      • OS: Windows 8
                      Re: my personal swf game archive checker html batch script
                      « Reply #14 on: March 24, 2014, 06:29:47 AM »
                      thank you again foxidrive....

                      so as to remember this i am adding it to my batch.
                      =================================================
                      ECHO.
                      :: UM, were using a "for" and "if" statement to check if there is a "*.swf" in any directory
                      :: "%%a" contains the full path to every folder below the current folder
                      :: So then were are creating a .html with "%%~nxa.html" name of "*.swf"
                      :: and another "for" statment does, um assuming %%b veribale grab's the file name of the swf.
                      :: and the "do" uses the commands fallowing. and somehow this "%%~nxb" is used to
                      :: tell the script were the names are to go in the html files
                      :: thank you foxidrive for you understanding and help.
                      >>"%~dp0\error.log" 2>&1 echo %CD%
                      ECHO %CD%
                      ECHO.
                      ECHO Update Operation In Progress - Please Stand By...
                      echo ^<!DOCTYPE HTML PUBLIC^> >>index.html
                      echo ^<html^> >>index.html
                      ECHO ^<body^> >>index.html


                      for /d /r %%a in (*) do (
                          if exist "%%a\*.swf" if not exist "%%a\%%~nxa.html" (
                             for %%b in ("%%a\*.swf") do (

                      (
                      echo ^<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"^>
                      echo ^<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"^>
                      echo ^<head^>
                      echo ^<title^>%%~nxb^</title^>
                      ====================================================
                      i am slowly learning this i think. so did must have a few thing not said right, but hopefully i am close.
                      ------------------------------------------------
                      I think I can I think I can I think I can.

                      snowcatman

                        Topic Starter


                        Beginner

                        • Experience: Beginner
                        • OS: Windows 8
                        Re: my personal swf game archive checker html batch script
                        « Reply #15 on: March 29, 2014, 11:05:18 AM »
                        hate bring this thread back but i think i have a small question
                        that come back to it sort of.

                        echo ^<a href="%%a\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> "%~dp0\index.html"

                        gives me full path
                        <a href="G:\flashgames\flashgames batch test\All-Games\\1i.html">1i.html[/url]
                         

                        how would i make it just give partial path like
                        < href="\games\1i.html"1i.html[/url]

                        Squashman



                          Specialist
                        • Thanked: 134
                        • Experience: Experienced
                        • OS: Other
                        Re: my personal swf game archive checker html batch script
                        « Reply #16 on: March 29, 2014, 11:34:56 AM »
                        Code: [Select]
                        echo ^<a href="\games\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> "%~dp0\index.html"

                        snowcatman

                          Topic Starter


                          Beginner

                          • Experience: Beginner
                          • OS: Windows 8
                          Re: my personal swf game archive checker html batch script
                          « Reply #17 on: March 29, 2014, 12:01:10 PM »
                          um, so if there is a set of swf files in
                          \games\li
                          \mygames\centapied

                          then how is that going to be reflected. cause i think you just gave it a known folder and this will not work i don't think for a unknown folder. ??  Squashman

                          i am thinking i want to know the path from the batch file cause the html file its there too.

                          Squashman



                            Specialist
                          • Thanked: 134
                          • Experience: Experienced
                          • OS: Other
                          Re: my personal swf game archive checker html batch script
                          « Reply #18 on: March 29, 2014, 01:02:27 PM »
                          I gave you the code you asked for. If that is not correct then you need to provide more detailed examples of what your input is and what you need for output.

                          snowcatman

                            Topic Starter


                            Beginner

                            • Experience: Beginner
                            • OS: Windows 8
                            Re: my personal swf game archive checker html batch script
                            « Reply #19 on: March 29, 2014, 01:41:26 PM »
                            i did not mean to upset you. put this is not a take over thread.  I though i had enough info in the thread to give everyone what the needed to know. sorry squashman.
                            i put this on my usb external 1tb hard drive. and move from computer to computer.
                            i am set up as a portable user with portable app and such.

                            echo ^<a href="%%a\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> "%~dp0\index.html"

                            i just don't know what to put in the "red" that won't give the hole path name. i was hoping to find out what variable i use to give partial path. like from the batch file to the partial unknown file in unknown directory.

                            so when i look in the html file i am looking for \games, \mygames and \test.
                            example:
                            from directory "\all games\games" with the swf-game-checker-html-directories.bat in it.
                            there is a index.html in that i see the lines in file of like 500 lines.
                            <a href="games\1i.html">1i.html[/url]
                            <a href="mygames\centipede.html">centipede.html[/url]
                            <a href="test\test.html">test.html[/url]

                            but at the moment i get full path like.
                            <a href="G:\flashgames\flashgames batch test\All-Games\\1i.html">1i.html[/url]

                            when i go to play this from my browser it works fine because its localized. but when i am in the car and ad-hoc mode and server them to my son they stop working because there no longer localized. So if i just pointed the the file as if from the index.html then i know the server will see the folders and no longer will i need to worrier about it being localized.  hope i gave enough information.

                            foxidrive



                              Specialist
                            • Thanked: 268
                            • Experience: Experienced
                            • OS: Windows 8
                            Re: my personal swf game archive checker html batch script
                            « Reply #20 on: March 30, 2014, 03:33:19 AM »
                            Replace the part in red with
                            Code: [Select]
                            %%~nxa

                            Salmon Trout

                            • Guest
                            Re: my personal swf game archive checker html batch script
                            « Reply #21 on: March 30, 2014, 05:22:51 AM »
                            echo ^<a href="%%a\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> "%~dp0\index.html"

                            i just don't know what to put in the "red" that won't give the hole path name. i was hoping to find out what variable i use to give partial path. like from the batch file to the partial unknown file in unknown directory.


                            Answer: tilde variable modifiers for FOR variables and also %0 to %9 replaceable parameters

                            If %%a is a file (full path or not) then %%~na is just the bare name part.

                            E.g. if %%Q holds D:\Folder1\Folder2\Folder3\Afilename.ext then %%~nQ will hold Afilename

                            Documentation: FOR /? (at the prompt)

                            or online

                            http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true

                            Assuming variable is %%A

                                %%~A         - expands %%A removing any surrounding quotes (")
                                %%~fA        - expands %%A to a fully qualified path name
                                %%~dA        - expands %%A to a drive letter only
                                %%~pA        - expands %%A to a path only
                                %%~nA        - expands %%A to a file name only
                                %%~xA        - expands %%A to a file extension only
                                %%~sA        - expanded path contains short names only
                                %%~aA        - expands %%A to file attributes of file
                                %%~tA        - expands %%A to date/time of file
                                %%~zA        - expands %%A to size of file (in bytes)




                            snowcatman

                              Topic Starter


                              Beginner

                              • Experience: Beginner
                              • OS: Windows 8
                              Re: my personal swf game archive checker html batch script
                              « Reply #22 on: March 30, 2014, 09:12:03 AM »
                              Thank you Foxidrive and Salmon Trout.

                              i did try some variables put they were not working.

                              i did use the %%~nxa in the red. and tested. it failed. so i looked closer to what i was doing and decided to move the batch file in the folder closer to the games. and it seemed to work offline. so i tested it on server and it worked again. instead of getting \games\1i\1i.html, mygames\centipede\centipede.html, or test\test\test.html ( hence my decision to move the batch file) i got this \1i\1i.html.

                              examples of directory structure:
                              G:\flashgames\flashgames batch test\All-Games\games\1i\1i.html
                              G:\flashgames\flashgames batch test\All-Games\mygames\centipede\centipede.html
                              G:\flashgames\flashgames batch test\All-Games\test\test08\test.html
                              the swf-game-checker-html-directories.bat was in the \All-games folder.
                              now it is in the \games folder

                              think i will try and find a way to bring out one more by using another batch file. but it puts me back to square one i have to make this happen for every folder in All-games folder /mygames  or /test

                              i think html will have to do the work from here. cause i don't see a way to make this easy from what i have learned so far in batch scripting. i guess i will just add frames in html and point to the pages made in the other directories.

                              Open for ideas... and thank you again.

                              Squashman



                                Specialist
                              • Thanked: 134
                              • Experience: Experienced
                              • OS: Other
                              Re: my personal swf game archive checker html batch script
                              « Reply #23 on: March 30, 2014, 09:39:50 AM »
                              I am confused as to where there the html file is. Is it located in the Games folder or the folder with the game name?

                              Either way I think you want to remove the enire path through the All Games folder and leave the rest.. If that is the case that shouldn't be hard to do with string substitution.

                              snowcatman

                                Topic Starter


                                Beginner

                                • Experience: Beginner
                                • OS: Windows 8
                                Re: my personal swf game archive checker html batch script
                                « Reply #24 on: March 30, 2014, 10:41:20 AM »
                                The main "index.html" is created were ever the bat file is and all the html's for the games are created next to there swf files. all the html files get deleted every time I run the batch file and all the html files get recreated again.

                                here is the code in the swf-game-checker-html-directories.bat one more time.
                                ======================================================
                                @rem logonwallpaper.bat
                                @ECHO OFF
                                @SETLOCAL ENABLEEXTENSIONS
                                @cd /d "%~dp0"
                                DEL ERROR.LOG

                                >>"%~dp0\error.log" 2>&1 echo -------------------------begining of batch script-------------------------
                                >>"%~dp0\error.log" 2>&1 echo. ==========================================================================
                                >>"%~dp0\error.log" 2>&1 echo started SWF GAME HTML script year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.
                                >>"%~dp0\error.log" 2>&1 echo. ==========================================================================

                                echo -------------------------begining of batch script-------------------------
                                echo ==========================================================================
                                echo started SWF GAME HTML script year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.
                                echo. ==========================================================================
                                echo.
                                echo.



                                >>"%~dp0\error.log" 2>&1 echo -----------Part One ------------
                                ECHO PART ONE
                                >>"%~dp0\error.log" 2>&1 echo PART ONE
                                ECHO.
                                >>"%~dp0\error.log" 2>&1 echo %CD%
                                DIR/W
                                ECHO.
                                ECHO %CD%
                                ECHO.
                                ECHO THIS IS JUST A STARTING POINT...
                                pause
                                cls

                                echo Cleanup
                                >>"%~dp0\error.log" 2>&1 echo  ------- Cleanup -------
                                >>"%~dp0\error.log" 2>&1 del /s *.html
                                >>"%~dp0\error.log" 2>&1 echo  ----- End Cleanup -----
                                >>"%~dp0\error.log" 2>&1 echo.
                                echo.
                                echo cleanup finnished
                                pause




                                ECHO PART TWO
                                >>"%~dp0\error.log" 2>&1 echo ....................................... ......
                                >>"%~dp0\error.log" 2>&1 echo PART TWO

                                ECHO.
                                :: UM, CHECK EACH SUB DIRECTORY
                                :: I GUESS I COULD START OFF SAYING IF SWF AND HTML EXISTS THEN NEXT.
                                :: THEN IF SWF FILE EXIST AND NO HTML THEN CREATE HTML WITH SAMPLE AND CHANGE TXT IN HTML
                                :: THEN GO TO NEXT DIRECTORY
                                >>"%~dp0\error.log" 2>&1 echo %CD%
                                ECHO %CD%
                                ECHO.
                                ECHO Update Operation In Progress - Please Stand By...
                                echo ^<!DOCTYPE HTML PUBLIC^> >>index.html
                                echo ^<html^> >>index.html
                                ECHO ^<body^> >>index.html
                                for /d /r %%a in (*) do (
                                    if exist "%%a\*.swf" if not exist "%%a\%%~nxa.html" (
                                       for %%b in ("%%a\*.swf") do (

                                (
                                echo ^<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"^>
                                echo ^<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"^>
                                echo ^<head^>
                                echo ^<title^>%%~nxb^</title^>
                                echo ^<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /^>
                                echo ^<script type="text/javascript" src="scripts/swfobject.js"^>^</script^>
                                echo ^<script type="text/javascript"^>
                                echo swfobject.registerObject("flashId", "9.0.0", "flash/expressInstall.swf"^);
                                echo ^</script^>
                                echo ^</head^>
                                echo ^<body^>
                                echo ^<center^>
                                echo ^<div^>
                                echo ^<object id="flashId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600"^>
                                echo ^<param name="movie" value="%%~nxb" /^>
                                echo ^<param name="FlashVars" value="name=Dr.Solve"/^>
                                echo ^<!--[if !IE]^>--^>
                                echo ^<object type="application/x-shockwave-flash" data="%%~nxb" width="800" height="600"^>
                                echo ^<param name="FlashVars" value="name=Dr.Solve"/^>
                                echo ^<!--^<![endif]--^>
                                echo ^<div^>
                                echo ^<h1^>Alternative content^</h1^>
                                echo ^<p^>Get Adobe Flash player^</p^>
                                echo ^</div^>
                                echo ^</center^>
                                echo ^<!--[if !IE]^>--^>
                                echo ^</object^>
                                echo ^<!--^<![endif]--^>
                                echo ^</object^>
                                echo ^</div^>
                                echo ^</body^>
                                echo ^</html^>
                                ) > "%%a\%%~nxa.html"


                                )




                                echo ^<a href="%%~nxa\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> "%~dp0\index.html"

                                )
                                )



                                ECHO ^</body^> >>index.html
                                echo ^</html^> >>index.html


                                echo.

                                ECHO END OF SCRIPT
                                ECHO PRESS ANYKEY
                                :: CHOICE DOES NOT WORK TO WAIT X AMOUNT OF SECOUNDS
                                :: CHOICE /C:d /N /Td,3
                                :: FOR %%D IN (40 40) DO CHOICE /C:d /N /Td,40
                                PAUSE
                                CLS


                                >>"%~dp0\error.log" 2>&1 echo =======================================================================
                                >>"%~dp0\error.log" 2>&1 echo --------------------------end of batch script--------------------------
                                @endlocal

                                ======================================================

                                if you want i can put together a sample in a zip forlder. let me know

                                Squashman



                                  Specialist
                                • Thanked: 134
                                • Experience: Experienced
                                • OS: Other
                                Re: my personal swf game archive checker html batch script
                                « Reply #25 on: March 30, 2014, 02:29:23 PM »
                                Code: [Select]
                                setlocal enabledelayedexpansion
                                set "var1=%%~a"
                                set "var2=!var1:*All-Games=!"
                                echo ^<a href="!var2!\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> "%~dp0\index.html"

                                snowcatman

                                  Topic Starter


                                  Beginner

                                  • Experience: Beginner
                                  • OS: Windows 8
                                  Re: my personal swf game archive checker html batch script
                                  « Reply #26 on: March 31, 2014, 07:42:47 AM »
                                  i copied the swf-game-checker-html-directories.bat to the /All-Games folder and added the code. i used the :: to set asside the code i had.
                                  Code: [Select]
                                  setlocal enabledelayedexpansion
                                  set "var1=%%~a"
                                  set "var2=!var1:*All-Games=!"
                                  echo ^<a href="!var2!\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> "%~dp0\index.html"

                                  from my code i had before.
                                  echo ^<a href="%%a\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> "%~dp0\index.html"
                                  my log file show's that the batch file did not finnish
                                  my index.html show's that the start off a html file was made but no meat of it.
                                  all other html files were made.

                                  thinking i want more logging. need to put a date and time in all html files so i know if the were changed.

                                  thank you for the attempt Squashman  :)

                                  Squashman



                                    Specialist
                                  • Thanked: 134
                                  • Experience: Experienced
                                  • OS: Other
                                  Re: my personal swf game archive checker html batch script
                                  « Reply #27 on: March 31, 2014, 08:05:17 AM »
                                  i copied the swf-game-checker-html-directories.bat to the /All-Games folder and added the code. i used the :: to set asside the code i had.from my code i had before.
                                  Using a double colon inside a code block can have unintended consequences.  Use REM instead.
                                  My code should not have crashed your batch file.

                                  snowcatman

                                    Topic Starter


                                    Beginner

                                    • Experience: Beginner
                                    • OS: Windows 8
                                    Re: my personal swf game archive checker html batch script
                                    « Reply #28 on: March 31, 2014, 09:50:30 AM »
                                    snippet from the batch file

                                    ===================================
                                    echo ^</html^>
                                    ) > "%%a\%%~nxa.html"

                                    )

                                    rem echo ^<a href="%%~nxa\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> "%~dp0\index.html"

                                    setlocal enabledelayedexpansion
                                    set "var1=%%~a"
                                    set "var2=!var1:*All-Games=!"
                                    echo ^<a href="!var2!\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> :: "%~dp0\index.html"

                                    )
                                    )



                                    ECHO ^</body^> >>index.html
                                    echo ^</html^> >>index.html
                                    ==============================

                                    from console
                                    ==============
                                    The system cannot find the path specified.
                                    Maximum set local recursion level reached.
                                    ----- this repeats -----
                                    ==============



                                    Squashman



                                      Specialist
                                    • Thanked: 134
                                    • Experience: Experienced
                                    • OS: Other
                                    Re: my personal swf game archive checker html batch script
                                    « Reply #29 on: March 31, 2014, 10:04:16 AM »
                                    Can you please start using Bulletin Board Code tags around your code and output.

                                    Squashman



                                      Specialist
                                    • Thanked: 134
                                    • Experience: Experienced
                                    • OS: Other
                                    Re: my personal swf game archive checker html batch script
                                    « Reply #30 on: March 31, 2014, 10:06:24 AM »
                                    Why do you have TWO Colons before your output file name?
                                    Code: [Select]
                                    echo ^<a href="!var2!\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> :: "%~dp0\index.html"

                                    snowcatman

                                      Topic Starter


                                      Beginner

                                      • Experience: Beginner
                                      • OS: Windows 8
                                      Re: my personal swf game archive checker html batch script
                                      « Reply #31 on: March 31, 2014, 10:14:10 AM »
                                      doing this in notepad. word-rap. my bag. i fixed it.

                                      echo ^<a href="!var2!\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> :: "%~dp0\index.html"

                                      ran and re-tested it.

                                      in the consul i get.
                                      "Maximum set local recursion level reached."
                                      repeatedly

                                      you did it.
                                      index.html show's
                                      <a href="\Games\1i\1i.html">1i.html[/url]

                                      Squashman



                                        Specialist
                                      • Thanked: 134
                                      • Experience: Experienced
                                      • OS: Other
                                      Re: my personal swf game archive checker html batch script
                                      « Reply #32 on: March 31, 2014, 10:52:45 AM »
                                      Code: [Select]
                                      setlocal enabledelayedexpansion
                                      set "var1=%%~a"
                                      set "var2=!var1:*All-Games=!"
                                      echo ^<a href="!var2!\%%~nxa.html"^>%%~nxa.html^</a^>^<br^> >> "%~dp0\index.html"
                                      endlocal

                                      snowcatman

                                        Topic Starter


                                        Beginner

                                        • Experience: Beginner
                                        • OS: Windows 8
                                        Re: my personal swf game archive checker html batch script
                                        « Reply #33 on: March 31, 2014, 11:18:56 AM »
                                        i i think you did it.
                                        while its on my usb hard drive it works fine.

                                        but the instant i move it to my virtual box and server it it uses the full path. example.
                                        i know i didn't give you all my info so harm done.

                                        <a href="C:\Users\a\Desktop\web server sync folder\wwwroot\flashgames\Games\1i\1i.html">1i.html[/url]


                                        but i guess i will  server it off my usb and keep learning about batch files some more. thank you.

                                        Squashman

                                        Squashman



                                          Specialist
                                        • Thanked: 134
                                        • Experience: Experienced
                                        • OS: Other
                                        Re: my personal swf game archive checker html batch script
                                        « Reply #34 on: March 31, 2014, 11:25:23 AM »
                                        This part of the code is what is cutting down the Directory Path.
                                        Code: [Select]
                                        set "var2=!var1:*All-Games=!"It matches on a Wildcard and the phrase All-Games and removes it.
                                        So if
                                        %%A = G:\flashgames\flashgames batch test\All-Games\games\1i\1i.html
                                        Var2 = \games\1i\1i.html
                                        because it matches: G:\flashgames\flashgames batch test\All-Games and removes it from the path.

                                        On your Server the All-Games Folder is not in your path.  You have now changed the requirements for your batch file.  You would now have to match on flashgames instead of All-Games.


                                        patio

                                        • Moderator


                                        • Genius
                                        • Maud' Dib
                                        • Thanked: 1769
                                          • Yes
                                        • Experience: Beginner
                                        • OS: Windows 7
                                        Re: my personal swf game archive checker html batch script
                                        « Reply #35 on: March 31, 2014, 01:29:56 PM »
                                        I predict 5 pages...
                                        " Anyone who goes to a psychiatrist should have his head examined. "

                                        foxidrive



                                          Specialist
                                        • Thanked: 268
                                        • Experience: Experienced
                                        • OS: Windows 8
                                        Re: my personal swf game archive checker html batch script
                                        « Reply #36 on: April 01, 2014, 12:32:35 AM »
                                        i know i didn't give you all my info

                                        That's the problem and it applies to so many people asking questions, not only you: if you don't give accurate details then
                                        you often get code that doesn't work in your real life situation, and in the worst case it will destroy files.

                                        You supplied few actual details so the code you got worked for what you stated, but what you wanted was different again.

                                        I predict 5 pages...

                                        :D