Last active
April 2, 2018 10:55
-
-
Save keejelo/aba46855c223be1888028a1bfdfdffb3 to your computer and use it in GitHub Desktop.
Export hakchi2 gamelist to HTML or plain text .
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::*********************************************************************************************************************** | |
:: Filename: make_html_list.bat | |
:: Author : keejelo | |
:: Version : 1.25 | |
:: Descr. : Makes a dynamic and sortable HTML list containing all games in gamefolder. | |
:: Usage : vvvvvvv | |
:: Put this file into folder "hakchi2\games_snes" and then run it. | |
:: To make the list sortable -> postfix the gametitles (in hakchi2) with one of the labels below: | |
:: (NES),(SNES),(ARCADE),(MAME),(SEGA),(MD),(GEN),(GB) ..or make your own, just add it below in the code like the rest.. | |
:: Examples of postfix: | |
:: Super Mario Bros. (NES) | |
:: Mega Man X (SNES) | |
::*********************************************************************************************************************** | |
ECHO OFF | |
TITLE Working, please wait... | |
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION | |
SET TIMESTAMP=%DATE%%TIME% | |
SET TIMESTAMP=%TIMESTAMP: =% | |
SET TIMESTAMP=%TIMESTAMP:.=% | |
SET TIMESTAMP=%TIMESTAMP:/=% | |
SET TIMESTAMP=%TIMESTAMP::=% | |
SET TIMESTAMP=%TIMESTAMP:,=% | |
SET outfile=%TIMESTAMP%_list.html | |
SET c=0 | |
DIR /S /B /O:N /AD>_tmp00 | |
FOR /F "tokens=*" %%a IN (_tmp00) DO ( | |
SET /A c=c+1 | |
ECHO.&ECHO Extracting gamedata: !c! | |
TYPE "%%a\*.desktop">>"%~dp0\_tmp01" | |
CLS | |
) | |
ECHO.&ECHO Getting gametitles.. | |
FINDSTR /B "Name=" _tmp01>_tmp02 | |
FOR /F "tokens=*" %%a IN (_tmp02) DO ( | |
SET line=%%a | |
ECHO !line:~5!>>_tmp03 | |
) | |
FOR /F "tokens=*" %%a IN (_tmp03) DO ( | |
SET line=%%a | |
ECHO !line:^&=and!>>_tmp04 | |
) | |
::Sortable postfix labels below (add your own here if you wish..) | |
FOR /F "tokens=*" %%a IN (_tmp04) DO ( | |
SET sys=%%a | |
IF /I NOT "!sys:(NES)=!"=="!sys!" (SET system=NES | |
) ELSE IF /I NOT "!sys:(SNES)=!"=="!sys!" (SET system=SNES | |
) ELSE IF /I NOT "!sys:(ARC)=!"=="!sys!" (SET system=ARCADE | |
) ELSE IF /I NOT "!sys:(ARCADE)=!"=="!sys!" (SET system=ARCADE | |
) ELSE IF /I NOT "!sys:(N64)=!"=="!sys!" (SET system=N64 | |
) ELSE IF /I NOT "!sys:(PSP)=!"=="!sys!" (SET system=PSP | |
) ELSE IF /I NOT "!sys:(PSX)=!"=="!sys!" (SET system=PSX | |
) ELSE IF /I NOT "!sys:(ATARI)=!"=="!sys!" (SET system=ATARI | |
) ELSE IF /I NOT "!sys:(MAME)=!"=="!sys!" (SET system=MAME | |
) ELSE IF /I NOT "!sys:(SEGA)=!"=="!sys!" (SET system=SEGA | |
) ELSE IF /I NOT "!sys:(MD)=!"=="!sys!" (SET system=MEGADRIVE | |
) ELSE IF /I NOT "!sys:(GEN)=!"=="!sys!" (SET system=GENESIS | |
) ELSE IF /I NOT "!sys:(GB)=!"=="!sys!" (SET system=GAMEBOY | |
) ELSE IF /I NOT "!sys:(GBC)=!"=="!sys!" (SET system=GAMEBOY COLOR | |
) ELSE (SET system=^?^?^?) | |
SET q=%%a | |
SET q=!q: =^%%20! | |
ECHO ^<tr^>^<td^>^<a href="https://www.google.com/search?q=!q!" target="_blank" title="Google.."^>%%a^</a^>^</td^>^<td^>!system!^</td^>^</tr^>>>_tmp05 | |
) | |
ECHO ^<^^!DOCTYPE html^>>>%outfile% | |
ECHO ^<html^>>>%outfile% | |
ECHO ^<head^>>>%outfile% | |
ECHO ^<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /^>>>%outfile% | |
ECHO ^<title^>%outfile%^</title^>>>%outfile% | |
ECHO ^<style^>>>%outfile% | |
ECHO *{font-family:verdana,arial,helvetica,sans-serif;font-size:12px;}>>%outfile% | |
ECHO table{margin:30px auto;border-spacing:0;width:80^%%;border:1px solid #f2f2f2;}>>%outfile% | |
ECHO th{font-weight:bold;background-color:#666;color:#fff;}>>%outfile% | |
ECHO th a{color:#fff;}>>%outfile% | |
ECHO th a:hover{text-decoration:none;}>>%outfile% | |
ECHO th:hover{background-color:#333;}>>%outfile% | |
ECHO th,td{text-align:left;padding:5px;}>>%outfile% | |
ECHO tr:nth-child(even){background-color:#f2f2f2;}>>%outfile% | |
ECHO tr:hover{background-color:#d7e9fc;}>>%outfile% | |
ECHO a{text-decoration:none;}>>%outfile% | |
ECHO a:hover{text-decoration:underline;}>>%outfile% | |
ECHO pre{width:80^%%;margin:30px auto;}>>%outfile% | |
ECHO @media print{pre{width:100^%%;}table{margin:0 auto;border-spacing:0;width:100^%%;border:0;}th span{display:none;}th,td{border-bottom:1px dotted #ddd;}}>>%outfile% | |
ECHO ^</style^>>>%outfile% | |
ECHO ^<script^>function TableSort(t){if(this.tbl=document.getElementById(t),this.lastSortedTh=null,this.tbl^&^&"TABLE"==this.tbl.nodeName){for(var e=this.tbl.tHead.rows[0].cells,a=0;e[a];a++)e[a].className.match(/asc^|dsc/)^&^&(this.lastSortedTh=e[a]);this.makeSortable()}}function bubbleSort(t,e){var a,s;1===e^?(a=0,s=t.length):-1===e^&^&(a=t.length-1,s=-1);for(var r=^^!0;r;){r=^^!1;for(var l=a;l^^!=s;l+=e)if(t[l+e]^&^&t[l].value^>t[l+e].value){var o=t[l],c=t[l+e],n=o;t[l]=c,t[l+e]=n,r=^^!0}}return t}TableSort.prototype.makeSortable=function(){for(var t=this.tbl.tHead.rows[0].cells,e=0;t[e];e++){t[e].cIdx=e;var a=document.createElement("a");a.href="#",a.title="Sort",a.style.display="block",a.innerHTML=t[e].innerHTML,a.onclick=function(t){return function(){return t.sortCol(this),^^!1}}(this),t[e].innerHTML="",t[e].appendChild(a)}},TableSort.prototype.sortCol=function(t){for(var e=this.tbl.rows,a=[],s=[],r=0,l=0,o=t.parentNode,c=o.cIdx,n=1;e[n];n++){var i=e[n].cells[c],h=i.textContent^?i.textContent:i.innerText,b=h.replace(/(^\$^|^\,^|^\s)/g,"");parseFloat(b)==b^?s[l++]={value:Number(b),row:e[n]}:a[r++]={value:h,row:e[n]}}var d,u,m;o.className.match("asc")^?(u=bubbleSort(a,-1),m=bubbleSort(s,-1),o.className=o.className.replace(/asc/,"dsc")):(u=bubbleSort(s,1),m=bubbleSort(a,1),o.className.match("dsc")^?o.className=o.className.replace(/dsc/,"asc"):o.className+="asc"),this.lastSortedTh^&^&o^^!=this.lastSortedTh^&^&(this.lastSortedTh.className=this.lastSortedTh.className.replace(/dsc^|asc/g,"")),this.lastSortedTh=o,d=u.concat(m);var S=this.tbl.tBodies[0];for(n=0;d[n];n++)S.appendChild(d[n].row)},window.onload=function(){new TableSort("gamelist");var rows=document.getElementById("gamelist").rows.length;document.getElementById("total").innerHTML=rows+20;};^</script^>>>%outfile% | |
ECHO ^</head^>>>%outfile% | |
ECHO ^<body^>>>%outfile% | |
ECHO ^<noscript^>Javascript is disabled^^! You must enable Javascript to be able to sort the list.^</noscript^>>>%outfile% | |
ECHO ^<table id="gamelist"^>>>%outfile% | |
ECHO ^<thead^>>>%outfile% | |
ECHO ^<tr^>^<th^>Title^ ^<span^>^▼^▲^</span^>^</th^>^<th^>System^ ^<span^>^▼^▲^</span^>^</th^>^</tr^>>>%outfile% | |
ECHO ^</thead^>>>%outfile% | |
ECHO ^<tbody^>>>%outfile% | |
SORT <_tmp05>>%outfile% | |
ECHO ^</tbody^>>>%outfile% | |
ECHO ^</table^>>>%outfile% | |
ECHO ^<pre^>>>%outfile% | |
ECHO === SNES-MINI PRE-INSTALLED GAMES ===>>%outfile% | |
ECHO.>>%outfile% | |
ECHO - Contra III The Alien Wars>>%outfile% | |
ECHO - Donkey Kong Country>>%outfile% | |
ECHO - EarthBound>>%outfile% | |
ECHO - F-Zero>>%outfile% | |
ECHO - Final Fantasy III>>%outfile% | |
ECHO - Kirby's Dream Course>>%outfile% | |
ECHO - Mega Man X>>%outfile% | |
ECHO - Secret of Mana>>%outfile% | |
ECHO - Star Fox>>%outfile% | |
ECHO - Star Fox 2 (which was, until now, unreleased)>>%outfile% | |
ECHO - Street Fighter II Turbo: Hyper Fighting>>%outfile% | |
ECHO - Super Castlevania IV>>%outfile% | |
ECHO - Super Ghouls 'n Ghosts>>%outfile% | |
ECHO - Super Mario Kart>>%outfile% | |
ECHO - Super Mario World>>%outfile% | |
ECHO - Super Metroid>>%outfile% | |
ECHO - Super Mario World 2: Yoshi's Island>>%outfile% | |
ECHO - Super Mario RPG: Legend of the Seven Stars>>%outfile% | |
ECHO - Super Punch-Out^^!^^!>>%outfile% | |
ECHO - The Legend of Zelda: A Link to the past>>%outfile% | |
ECHO.>>%outfile% | |
ECHO ^<b^>Total number of games: ^<span id="total"^>^</span^>^</b^>>>%outfile% | |
ECHO ^</pre^>>>%outfile% | |
ECHO ^</body^>>>%outfile% | |
ECHO ^</html^>>>%outfile% | |
ECHO.&ECHO Cleaning up.. | |
DEL /Q _tmp* | |
TITLE Finished | |
IF EXIST %outfile% ( | |
ECHO.&ECHO Ok, file created: %outfile% | |
) ELSE ( | |
ECHO.&ECHO Error, something went wrong! | |
) | |
ENDLOCAL | |
ECHO.&PAUSE | |
EXIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::************************************************************************* | |
:: Filename: make_txt_list.bat | |
:: Author : keejelo | |
:: Version : 1.05 | |
:: Descr. : Makes a plain text list containing all games in gamefolder. | |
:: Usage : Put this file into folder "hakchi2\games_snes" and then run it. | |
::************************************************************************* | |
ECHO OFF | |
TITLE Working, please wait... | |
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION | |
SET TIMESTAMP=%DATE%%TIME% | |
SET TIMESTAMP=%TIMESTAMP: =% | |
SET TIMESTAMP=%TIMESTAMP:.=% | |
SET TIMESTAMP=%TIMESTAMP:/=% | |
SET TIMESTAMP=%TIMESTAMP::=% | |
SET TIMESTAMP=%TIMESTAMP:,=% | |
SET outfile=%TIMESTAMP%_list.txt | |
SET c=0 | |
DIR /S /B /O:N /AD>_tmp00 | |
FOR /F "tokens=*" %%a IN (_tmp00) DO ( | |
SET /A c=c+1 | |
ECHO.&ECHO Extracting gamedata: !c! | |
TYPE "%%a\*.desktop">>"%~dp0\_tmp01" | |
CLS | |
) | |
ECHO.&ECHO Getting gametitles.. | |
FINDSTR /B "Name=" _tmp01>_tmp02 | |
FOR /F "tokens=*" %%a IN (_tmp02) DO ( | |
SET line=%%a | |
ECHO !line:~5!>>_tmp03 | |
) | |
FOR /F "tokens=*" %%a IN (_tmp03) DO ( | |
ECHO - %%a>>_tmp04 | |
) | |
ECHO.&ECHO Sorting.. | |
SORT <_tmp04> %outfile% | |
ECHO.&ECHO Cleaning up.. | |
DEL /Q _tmp* | |
TITLE Finished | |
IF EXIST %outfile% ( | |
ECHO.&ECHO Ok, file created: %outfile% | |
) ELSE ( | |
ECHO.&ECHO Error, something went wrong! | |
) | |
ENDLOCAL | |
ECHO.&PAUSE | |
EXIT |
@DecanFrost
Yes, if you postfix your games in hakchi2 with labels like (NES) or (SNES) or anything else, and use the HTML list maker, it will become sortable by gametitle and system. Read "usage" in heading of the "HTML make list" source for more information on how to add labels for sorting.
:-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ty works great ..
is there a way to add the system name to the games for easy sorting?