Macros? Please! Easy!

I’m trying to work on what I’m working on, writing. I need to change something that a macro can do. But I begin to look up how to record a SIMPLE macro to change font and style at a keystroke and all of a sudden I’m in a deep hole and can’t even remember what it was I was writing. The help is confusing and unhelpful and I’ve just lost two days to the deadline. I still have to change everything the old way which is time consuming, frustrating, and I’m about to denounce libre and go back to pen and paper.

Hello @raven_sinus,

Here’s a simple macro to change the font and style of the current selection:

Sub changeFontOfSelection()
	Dim oText As Object, oCursor As Object
	oText = ThisComponent.getText()
	oCursor = oText.createTextCursorByRange( ThisComponent.CurrentSelection.getByIndex(0) )
	
	oCursor.CharFontName			= "Ubuntu"
	oCursor.CharWeight				= 150.0
	oCursor.CharHeight				= 18.0
	oCursor.CharColor				= RGB( 30, 255, 25)
	oCursor.CharBackColor			= RGB( 100, 100, 100 )
	oCursor.CharShadowed			= True
	oCursor.CharUnderline			= True
	oCursor.CharUnderlineHasColor	= True
	oCursor.CharUnderlineColor		= RGB( 30, 25, 255 )
	
End Sub

Okay. That will get me started. Thank you.

You may stumble on a personal methodology bug! LO Writer is not a typewriter. You should not explicitly set your word/glyph attributes explicitly but through styles. Manual formatting, as you seem to typeset your document, is the root of all evil when you need to update your text.

With correct use of styles, i.e. an abstract markup, all you have to do afterwards is to modify the styles only once to “magically” change the appearance to abide by in-house graphical rules. No need of macros for that, only to set styles while typing.

You may seem to waste valuable time thinking carefully about your styles at the beginning, but you spare much more time when writing.

Your styles solution is no use here because it takes as long to set each time it is used ie hand from keys- on mouse- move mouse- select style (min 2 clicks)- return to composition- repeat to return to default style. On top of that EVERY time I have tried to save a style it reverts to default and I have tried 1000 times to change default- WILL NOT CHANGE! So…

Ps. Sorry, but it IS a typewriter with delayed printing. That is all any word processor is. Anything else is icing.

When I write “typewriter”, I mean the mechanical device you used without any assistance. Everything was made by hand, which was tedious and boring. Transposing to document processor, that’s using them without the styles and other automation features. Of course, it is possible but the wrong way, wronger with longer documents.

What you describe shows you have no planning ahead with your document. With an adequate style set (moreover when they are “linked”), manually switching styles happens rarely, mainly at the beginning of another section (chapter or subchapter). If you do it too frequently for “characters”, think about your presentation: too many different “variants” are not recommended.

Wrt your problem with saving styles, read the user’s manual.

Pity you can’t upvote comments.

@anon87010807: you can indeed upvote comments. Mouse over the comment, it will highlight and an up-arrow appears next to the first line. Click on the arrow, the comment is upvoted.

Thank, you, done.

You’re welcome. Note, however, upvoting comments has no impact on karma.