PDA

View Full Version : Wysiwig Conversion in command line



peterv
September 18th, 2014, 02:52 PM
I need to open a file, set the file length, switch the view to HEX and save it using Wysivig Conversion.

I was able to do all but the save using Wysiwig.

vpw.exe -c"Config(F_F_TYPE,512) Win_Display_Mode(8)" "filename"

Bottom line I need a file that is a HEX representation of the original file.

I.e. if the original file was
test

I need the new file be
74 65 73 74

TonyGDI
September 18th, 2014, 04:34 PM
Hi peterv,

The Win_Display_Mode is a display function, not a conversion function. Perhaps there is another way to fulfill this requirement however the following works:

vpw -c'Config(F_F_TYPE,513) do{ rcb(1,cp,cp+1,delete) or(10) rt(1,2048) or(clear) ri(10) }while(!ateof) xall' filename


In the above routine, I've set the file handling to 513 bytes wide since the output is a hex value and a space (divisible by three).

Please try the above and reply back if this meets your requirements.

Tony

peterv
September 19th, 2014, 07:54 PM
Thank you Tony,

It partially worked. I guess I should be more specific. These are binary files containing records of uniform length without record delimiter. What I am trying to do is convert them to text files with hex representations of the binary values with records separated by a new line (\r\n). So setting the file type to record length Config(F_F_TYPE,512) and changing the view to HEX Win_Display_Mode(8) has showed me what I needed to see. Using the {File, Wysiwyg conversion...} I was able to save what I see to a file. I am just trying to automate this process.

So two things:
1. the command you provided is missing the new line endings after each record
2. this process is significantly slower. The way I used to do it took only a few seconds to save the largest file. With your macro it takes 3 or 4 minutes.

I also had to add Config(F_OVER_MODE,0,LOCAL) because I was getting "In Overwrite-Only Mode --see (Config, File Handling)"

vpw.exe -c'Config(F_F_TYPE,9216) Config(F_OVER_MODE,0,LOCAL) do{ rcb(1,cp,cp+1,delete) or(10) rt(1,2048) or(clear)ri(10) }while(!ateof) xall' test

Peter

Howard Goldstein
September 21st, 2014, 11:42 AM
I need to open a file, set the file length, switch the view to HEX and save it using Wysivig Conversion.

I was able to do all but the save using Wysiwig.

vpw.exe -c"Config(F_F_TYPE,512) Win_Display_Mode(8)" "filename"

Bottom line I need a file that is a HEX representation of the original file.

I.e. if the original file was
test

I need the new file be
74 65 73 74
How about:
vpw.exe -c"Config(F_F_TYPE,512) Win_Display_Mode(8) DO_VISUAL(/\ME\FW/)" "filename"

-- Howard

peterv
October 1st, 2014, 06:09 PM
I guess this is as good as it gets. The DO_VISUAL() is a cool thing however it seems to have no power over the save dialog window. So some manual intervention is still required.

So close I can almost feel it...

I have created a simple standalone VB script that does the hex dump for me without an intervention.

Thank you both very much for your time and suggestions.

Peter

pal
October 6th, 2014, 12:15 PM
How about this:



#10 = 8 // number of hex values on each line
#11 = 1
Config(F_F_TYPE, 0, LOCAL)

While (!At_EOF) {
#12 = Cur_Char
Del_Char(1)
Num_Ins(#12, HEX+NOMSG+COUNT, 2)
Ins_Char(' ')
if (#11++ >= #10) {
Ins_Newline
#11 = 1
}
}


Here the record length is set at the beginning of the macro (#10).