Jonathon Blake wrote:
All:
Can somebody explain why a macro that splits a hexadecimal number into
three parts takes 93 pages of text.
The actions are:
i) jump to lefthand side of number;
ii) jump two characters to the right;
iii) insert a space;
iv) jump two characters to the right;
iv) insert a space;
v) jump to the begining of the line;
vi) Go down one line.
One of the code snippets in there:
dim args15(1) as new com.sun.star.beans.PropertyValue
args15(0).Name = "Count"
args15(0).Value = 1
args15(1).Name = "Select"
args15(1).Value = false
Repeated at least 20 times, if not more.
It goes on like that for most of 93 pages.
[Font is set for single spacing, but most of the code is double spaced.]
This was done using the macro recorder feature.
xan
Jonathon
My guess is that the macro recorder was left in an on state... Just a
guess. That said, the macro recorder sometimes generates "inefficient"
code. I do not meant that it runs slowly, I mean that it is more verbose
than if you wrote a macro ourself using the API.
Sub ParseHexNum
Dim oViewCursor
oViewCursor = ThisComponent.getCurrentController().getViewCursor()
oViewCursor.gotoStartOfLine(False)
oViewCursor.goRight(2, False)
oViewCursor.getText().insertString(oViewCursor, " ", False)
oViewCursor.goRight(2, False)
oViewCursor.getText().insertString(oViewCursor, " ", False)
oViewCursor.gotoStartOfLine(False)
oViewCursor.goDown(1, False)
End Sub
Of course, you said goto the start of the word and I told the cursor to
go to the start of the line, it is pretty close to what you said :-)
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm
Free Info: http://www.pitonyak.org/oo.php
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]