Ask Your Question
0

What determines green color output in this macro? [closed]

asked 2014-02-09 14:08:20 +0200

altair gravatar image

updated 2014-02-09 14:42:37 +0200

Alexander Wilms gravatar image

This macro is supposed to find all the comments in the text and to write them green, courier new, 10, italic. Please, what is making this macro understand, for style and for color?

Macro works, I do notunderstand thesource (came through edit)

Code:

sub comments rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ---------------------------------------------------------------------- dim args1(18) as new com.sun.star.beans.PropertyValue args1(0).Name = "SearchItem.StyleFamily" args1(0).Value = 2 args1(1).Name = "SearchItem.CellType" args1(1).Value = 0 args1(2).Name = "SearchItem.RowDirection" args1(2).Value = true args1(3).Name = "SearchItem.AllTables" args1(3).Value = false args1(4).Name = "SearchItem.Backward" args1(4).Value = false args1(5).Name = "SearchItem.Pattern" args1(5).Value = false args1(6).Name = "SearchItem.Content" args1(6).Value = false args1(7).Name = "SearchItem.AsianOptions" args1(7).Value = false args1(8).Name = "SearchItem.AlgorithmType" args1(8).Value = 1 args1(9).Name = "SearchItem.SearchFlags" args1(9).Value = 65536 args1(10).Name = "SearchItem.SearchString" args1(10).Value = "(/*([^]|[\r\n]|(*+([^/]|[\r\n])))*+/)|(//.)" args1(11).Name = "SearchItem.ReplaceString" args1(11).Value = "&" args1(12).Name = "SearchItem.Locale" args1(12).Value = 255 args1(13).Name = "SearchItem.ChangedChars" args1(13).Value = 2 args1(14).Name = "SearchItem.DeletedChars" args1(14).Value = 2 args1(15).Name = "SearchItem.InsertedChars" args1(15).Value = 2 args1(16).Name = "SearchItem.TransliterateFlags" args1(16).Value = 1280 args1(17).Name = "SearchItem.Command" args1(17).Value = 3 args1(18).Name = "Quiet" args1(18).Value = true

dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())

end sub

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-20 07:03:17.010492

1 Answer

Sort by » oldest newest most voted
0

answered 2014-03-11 19:34:50 +0200

RobertS gravatar image

The macro you pasted does not specify any formatting such as "green, courier new, 10, italic". What it does is apply whatever format that was used last in the replace field of search and replace.

The macro was created by "record macro", and this feature does not capture all the details.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-02-09 14:08:20 +0200

Seen: 148 times

Last updated: Mar 11 '14