Topic: Deleting Columns (1 of 12), Read 92 times, 1 File Attachment
Conf: VEDIT Macro Language Support
From: Clint Danbury
Date: Friday, September 01, 2000 06:31 PM

I have 56 files.

I put their names in a file called "The_List". Within each of those 56
files...

-- The first two lines must remain as they are

-- I want the rest of the lines to have their first 5 columns deleted.

The attached file (my vedit macro attempt) demonstrates an incompetent
method of trying to set a columnar block. In fact, I devised two whole
separate methods which don't work. (Thomas Edison would understand me)

Here are the specific eleven lines (three of which I slashed-out after
I saw that they significantly slowed the execution time)...


Column_Begin(Clear) // Forget any prior Columns
Column_Begin(Cur_Pos) // This column Starts here

// For(#1=1;(! At_EOF);#1++) // Move
// { // To
// Do_Visual("\CD\") // The
// } // End

EOF() // Move To The End

Do_Visual("\CU\") // Cursor up one
Do_Visual("\CR\\CR\\CR\\CR\\CR\") // Cursor over 5

Column_End(Cur_Pos) // Column stops here

Del_Block(Block_Begin,Block_End,COLUMN) // Delete that column


What do I change so that the column will be defined, so that I will be
able to delete the resulting (columnar) block ? Or maybe I should word
that question as, "Like, Huh ? How Come ?"

 
Vedit Macro File

 


Topic: Re: Deleting Columns (2 of 12), Read 87 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Saturday, September 02, 2000 04:00 AM

Your code is nearly o.k.
But you should use Block_Begin() and Block_End().

BTW: The Do_Visual() command is really slow. The internal commands (if
available) are much faster.


BoF
Line(2)

Block_Begin(Cur_Pos)
EoF
Line(-1)
Char(5)
Block_End(Cur_Pos)
Del_Block(Block_Begin,Block_End,COLUMN)


Christian

 


Topic: Re: Deleting Columns (3 of 12), Read 85 times
Conf: VEDIT Macro Language Support
From: Clint Danbury
Date: Tuesday, September 05, 2000 11:02 AM

You ARE the most COOL kid in school.

One day, I'll be like you.

(If I'm lucky)

Cool, cool, ultra cool. I like you.

Think I'll buy you a new car.

 


Topic: Re: Deleting Columns and the crn() command (4 of 12), Read 68 times
Conf: VEDIT Macro Language Support
From: Steve Rawling
Date: Tuesday, August 14, 2001 08:59 AM

Here is a related problem that I am having

I want to store the current column number then go down a line and then goto the column just
right of the saved column number
+1

Thus a block starting at the cursor position two columns wide and two lines deep can be cut out
any where


I try the macro as follows but it does not work.


I am wanting to store the return value of cursor-col() in text register 1 and use it as an
indirect column number in the command goto_col()

but vedit seems to be not recognizing the number because it maybe has 3 spaces
in front of it?

Why doesn't it work


begin_block(cp) \\mark the current cursor position as
\\the beginning of a block

out_reg(1) cursor_col() \\ store column number of the cursor in
out_reg(clear) \\ register 1

line(1) goto_col(@1) \\ go down one line and then goto column number
\\ one greater than the column number saved
\\in text register 1

block_end(cp) \\mark the current cursor position as
\\the end of a block

del_block(bb,be,column) \\ delete the columnar block


Steve

 


Topic: Re: Deleting Columns and the crn() command (5 of 12), Read 72 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Tuesday, August 14, 2001 12:02 PM

>I want to store the current
>column number then go down a
>line and then goto the column
>just>right of the saved column
>number +1
>
>Thus a block starting at the
>cursor position two columns
>wide and two lines deep can be
>cut out any where

You might want to try the following. I'm not sure whether it is the most elegant method, but it works for me:

#10=cursor_col()
BB(CP)
line()
Goto_col(#10+1)
BE(CP)
Del_Block(BB,BE,Colset,#10,#10+1)

Fritz

 


Topic: Re: Deleting Columns (6 of 12), Read 69 times, 1 File Attachment
Conf: VEDIT Macro Language Support
From: Al Murin
Date: Wednesday, July 10, 2002 02:18 PM

Greetings,

I have been trying to get this method to work for me for a few days using Vedit 5.2, and something's not working right. I have a fixed length text file to delete columns from, and the result needs to be a fixed length text file. Once I have the block defined and go to delete it, if there is no text (i.e. other than a space) in a section of the block, whatever text is to the right of the columnar block stays put, and does not shift left with the rest of the data. Please see the attached file for an example - it'll make perfect sense then. If do the steps manually from the menus, it works fine. Also, as long as every line has text in the block, it works fine.

Is this a "feature" of Vedit, or am I doing something wrong? My code is:

BOF
BB(CP)
EOF
BE(CP)
Del_Block(BB,BE,ColSet,91,91)
BB(Clear)

Thaks,

Al Murin

 
explanation of del column problem

 


Topic: Re: Deleting Columns (7 of 12), Read 83 times
Conf: VEDIT Macro Language Support
From: George Christman
Date: Wednesday, July 10, 2002 02:32 PM

Try the following, it worked for me on your sample file ...

del_block(0,file_size,COLSET,31,31)
del_block(0,file_size,COLSET,28,28)

Just make sure that CONFIG(f_f_type) is set to the correct value,
i.e. {CONFIG, File handling, File type}
menu option.

 


Topic: Re: Deleting Columns (8 of 12), Read 76 times
Conf: VEDIT Macro Language Support
From: Al Murin
Date: Thursday, July 11, 2002 05:59 PM

I tried the new code. It worked for deleting one column, but when it tried to delete the second column, the result was the same staggered text. I tried breaking the script up into 2 different scripts, and it didn't work. If I manually execute the commands from the menu, it will work.

I am trying to run the script from the command line using
"vedit -x fmtfile.vdm filename". Does it make a difference of the file size? These text files are about 200-300 lines long.

Al

 


Topic: Re: Deleting Columns (9 of 12), Read 69 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Friday, July 12, 2002 02:17 AM

Perhaps there are some TAB's in your original file?
Especially in the shorter lines?
That could explain the strange formatting.

You can make TAB's visible via {Config, Characters/Cursors, TAB display character}. Set it to "183" for example. That is a small dot in the VEDIT-ANSI font.

Christian

 


Topic: Re: Deleting Columns (10 of 12), Read 61 times
Conf: VEDIT Macro Language Support
From: Al Murin
Date: Friday, July 12, 2002 09:32 AM

I tried what you suggested. Good thought, but no, all the blanks are real spaces. Verified this by switching to hex mode and all the spaces were code 020, which is a space in hex.

Al

 


Topic: Re: Deleting Columns (11 of 12), Read 63 times
Conf: VEDIT Macro Language Support
From: George Christman
Date: Friday, July 12, 2002 09:53 AM


Another thing that works (in addition to Christians
suggestion) is to set the display mode to 4 (show all chars) like this ...

Config(Win_Display_Mode,4)

This will treat tabs like any other byte, one character.

 


Topic: Re: Deleting Columns (12 of 12), Read 64 times
Conf: VEDIT Macro Language Support
From: Al Murin
Date: Friday, July 12, 2002 12:35 PM

Solved my problem in a round about way.
I did a Replace(" ","~",ALL) to replace spaces with ~ (which will never be used in the text file). Now that there is something to delete in the otherwise blank spaces, the del_block commands work fine. Then I do Replace("~"," ",ALL) to get the final result.

Extra steps, I know, but it works. As time permits, I am going to try to get it to work the other way.

Thanks for all the suggestions,

Al