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 17222 times)

0 Members and 1 Guest are viewing this topic.

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.