Discussion is actually here:
http://www.msfn.org/...on/page__st__60
but of course any idea/suggestion/correction is also very welcome here.
Wonko
Posted 01 August 2011 - 12:48 PM
Posted 13 September 2011 - 04:17 PM
@echo off echo. echo echo batch to bring hex to a table. echo. set /p hex=where did you store your hex? set /p out=what name for your table?(no ext) echo the following based on http://www.computing.net/answers/programming/batch-text-file-content-to-variable/16264.html echo the rest by r. (NNplay4) setlocal enabledelayedexpansion set SEPARATOR= set filecontent= for /f "delims=" %%a in (%hex%) do ( set currentline=%%a set filecontent=!filecontent!%SEPARATOR%!currentline! ) echo Your hexadecimal string is: %filecontent% pause set str=!filecontent!%SEPARATOR%!currentline! echo. >NUL 2>%out%.htm copy spread1h.txt+%out%.htm set str=!filecontent!%SEPARATOR%!currentline! set str=%str:~0,1% echo.%str%>%out%.htm copy %out%.htm+spread2h.txt %out%.htm set str=!filecontent!%SEPARATOR%!currentline! set str=%str:~1,1% echo.%str%>>%out%.htm copy %out%.htm+spread2h.txt %out%.htm set str=!filecontent!%SEPARATOR%!currentline! set str=%str:~3,1% echo.%str%>>%out%.htm copy %out%.htm+spread3h.txt %out%.htm
set str=%str:~inside 1 cell, then
1in the adjacent cell, and
,1%in the third.
set str=!filecontent!%SEPARATOR%!currentline! echo. >NUL 2>%out%.htm set str=!filecontent!%SEPARATOR%!currentline! set str=%str:~0,1% echo.%str%>%out%.htm copy spread1h.txt+%out%.htm+spread3h.txt %out%.htm,
Posted 13 September 2011 - 05:41 PM
No, I removed it. See edit below.(cause Dsfi is cool, but a simpler ver. is nice also.
@echo off echo. echo echo batch to bring hex to a table. echo. set /p hex=where did you store your hex? set /p htm=what name for your table?(no ext) echo the following based on http://www.computing.net/answers/programming/batch-text-file-content-to-variable/16264.html echo the rest by r. (NNplay4) setlocal enabledelayedexpansion set SEPARATOR= set filecontent= for /f "delims=" %%a in (%hex%) do ( set currentline=%%a set filecontent=!filecontent!%SEPARATOR%!currentline! ) echo Your hexadecimal string is: %filecontent% pause set str=!filecontent!%SEPARATOR%!currentline! echo. >NUL 2>%htm%.swp echo. >NUL 2>%htm%.htm set str=!filecontent!%SEPARATOR%!currentline! set str=%str:~0,1% echo.%str%>%htm%.swp copy spread1h.txt+%htm%.swp+spread2h.txt %htm%.htm echo. >NUL 2>%htm%.swp rem ============================ rem this line is different from above ( no spread1h, no null out) set str=!filecontent!%SEPARATOR%!currentline! echo. >NUL 2>%htm%.swp set str=!filecontent!%SEPARATOR%!currentline! set str=%str:~1,1% echo.%str%>%htm%.swp copy %htm%.htm+%htm%.swp+spread3h.txt %htm%.htm echo. >NUL 2>%htm%.swp
Posted 13 September 2011 - 06:28 PM
set str=!filecontent!%SEPARATOR%!currentline!
set str=%str:~0,1%
echo.%str%>temp\swap0D0A
dsfi temp\swap 0 1 temp\swap0D0A
dsfi %htm%.htm e 0 temp\swap
echo. >NUL 2>temp\swap0D0A
echo. >NUL 2>temp\swap
dsfi %htm%.htm e 0 spread2h
FOR /L %%? IN (0,1,94) DO (
set str=!filecontent!%SEPARATOR%!currentline!
SET str_index=%%?
set str=%str:~!str_index!,1%
echo.%str%>temp\swap0D0A
dsfi temp\swap 0 1 temp\swap0D0A
dsfi %htm%.htm e 0 temp\swap
echo. >NUL 2>temp\swap0D0A
echo. >NUL 2>temp\swap
dsfi %htm%.htm e 0 spread2h
)
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
Posted 13 September 2011 - 07:01 PM
I see that you have changed the program while I was posting
Seemingly this snippet:
Quote
set str=!filecontent!%SEPARATOR%!currentline!
set str=%str:~0,1%
echo.%str%>temp\swap0D0A
dsfi temp\swap 0 1 temp\swap0D0A
dsfi %htm%.htm e 0 temp\swap
echo. >NUL 2>temp\swap0D0A
echo. >NUL 2>temp\swap
dsfi %htm%.htm e 0 spread2h
Is copied for all values from 0 to 94 (and I cannot understand WHY and WHY last one points to "spread3h" whilst all previous ones pointed to "spread2h", maybe a typo? )
You will also need to add as SECOND line (just after the @echo off) this line:
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
As a general rule instead of re-writing the same snippet over and over, you could use a loop.
Posted 13 September 2011 - 07:10 PM
Sure , contact an Admin/Mod.As usual, I get carried away. Though there is, "seemingly", a connection to the CHS-LBA translation, as in the spreadsheets for Hex, it is however, OT.
It would be an (good) idea to move the posts I did to another topic . Is it feasible?
You need to make yourself four base files.
-Spread1h.txt
-Spread2h.txt
-Spread2hrow.txt
-Spread3h.txt
These are made by hex-editing an html table.
Enter Value1 in A1, Value2 in A2. Edit: forgot: Save file as webpage 1sheet. Open it in an hex-editor. Find Value1, copy all before it (until the >), save as Spread1h.txt. From after Value1, copy </td>..spacespace. Save as Spread2h.txt.
Find Value2. Copy the last </td>..spacespace from after Value1, until Value2. You should have some </tr>, <tr>,td> included. Save as Spread2hrow.txt. Copy from the end of Value2 to the end of the file. Save that last bit as Spread3h.txt.
Posted 13 September 2011 - 07:46 PM
Posted 13 September 2011 - 07:56 PM
No , I persoanlly cannot as I am not Admin (nor Mod of this forum - and even if I were it would have been an unapproved nomination)Hello dear Admin Wonko, could you change the thingy of topic, please?
Done
Ok, here the thing.
r.
Posted 13 September 2011 - 08:23 PM
Posted 13 September 2011 - 09:06 PM
Posted 13 September 2011 - 09:43 PM
Posted 14 September 2011 - 12:40 PM
Posted 14 September 2011 - 01:18 PM
Posted 14 September 2011 - 01:42 PM
@ECHO OFF
SETLOCAL
ECHO batch to bring hex to a table.
ECHO.
SET /p hex=where did you store your hex?
SET /p htm=what name for your table?
CALL :write_head
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
FOR /F "tokens=* delims=" %%? IN (%hex%) DO SET hex_contents=%%?
CALL :parse_line
CALL :write_tail
ECHO.
ECHO File %htm% written...
GOTO :EOF
:write_head
(
ECHO ^<^!doctype html PUBLIC "-//IETF//DTD HTML 2.0//EN"^>
ECHO ^<html^>^<head^>
ECHO ^<title^>HexTable from %hex%^</title^>^</head^>
ECHO ^<body^>^<body bgcolor=#CCCCCC text=black^>^<table border=1^>
ECHO ^<tr^>
) > %htm%
GOTO :EOF
:parse_line
SET /A Counter=0
FOR /L %%A IN (0,3,1200) DO (
SET Hex_Code=!hex_contents%:~%%A,2!
SET /A Counter+=1
IF NOT !Hex_Code!.==. (ECHO ^<td align=center^>^<p^>!Hex_Code!^</p^>^</td^>>>%htm%) ELSE GOTO :EOF
IF !Counter!==16 SET /A Counter=0 &ECHO ^</tr^>^<tr^>>>%htm%
)
GOTO :EOF
:write_tail
ECHO ^</tr^>^</body^>^</html^>>>%htm%
GOTO :EOF
Posted 14 September 2011 - 02:17 PM
@ady
Last version is attached on the thread on MSFN, can't you get it from there?
Wonko
Posted 14 September 2011 - 02:24 PM
Well, AFAI can see, the latest version I saw posted was make_fat_08.7z in a different topic than the original, and I am not a member of MSFN forums. I don't even know if 08 is the latest. Anyway, why leaving version 05 here, if there is a better version? So, I'd like to repeat my request, if it is not so much trouble for you.
Thank you in advance.
Posted 14 September 2011 - 02:32 PM
@betrand, So, still OT? Even when you already know it?
Besides being off-topic
Yeah, I was OT, but posting the things was to get feedback /help /ideas. : : .TEST it properly
you have clearly NO idea of what you are doing, and you are doing it anyway WRONG!
I guess that's the first posted version.Neither of the two batches work.
I agree the first versions (both), were.UNNEEDEDLY complex and use UNNEEDEDLY a zillion files
,Excel 14 Wizard generated HTML
IF NOT !Hex_Code!.==. (ECHO ^<td align=center^>^<p^>!Hex_Code!^</p^>^</td^>>>%htm%) ELSE GOTO :EOFCool, That's what I've just done (after my last post), with an equivalent
if not %str%.==. goto _end: :
:parse_line SET /A Counter=0 FOR /L %%A IN (0,3,1200) DO (Could you explain what the 1200 stands for?
Posted 14 September 2011 - 02:40 PM
1200 represents a cardinal number, it is an integer placed right after 1199 and immediately before 1201.Could you explain what the 1200 stands for?
Posted 14 September 2011 - 03:05 PM
So, is 1199 an integer also?1200 represents a cardinal number, it is an integer placed right after 1199 and immediately before 1201.
IF NOT !Hex_Code!.==. (ECHO ^<td align=center^>^<p^>!Hex_Code!^</p^>^</td^>>>%htm%) ELSE GOTO :EOFis the same (idea) as
if not %str%.==. goto _endwhen _end contains echo this and that.
Cool.In this case it represents an arbitrarily "biggish" number multiple of 3 (the "step")
0 members, 0 guests, 0 anonymous users