Difference between revisions of "User talk:גאַנגלערי"
From Apache OpenOffice Wiki
(→my first macro: added section « my first macro ») |
(// changed to \\) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") | dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") | ||
− | rem | + | rem Text begin ----------------------------------------------------------- |
− | + | ||
− | + | ||
− | + | ||
dim args2(0) as new com.sun.star.beans.PropertyValue | dim args2(0) as new com.sun.star.beans.PropertyValue | ||
args2(0).Name = "Text" | args2(0).Name = "Text" | ||
− | args2(0).Value = " | + | args2(0).Value = "" |
− | + | rem Text end ------------------------------------------------------------- | |
− | + | ||
− | rem | + | |
− | + | ||
− | + | ||
− | + | ||
dim args4(0) as new com.sun.star.beans.PropertyValue | dim args4(0) as new com.sun.star.beans.PropertyValue | ||
args4(0).Name = "Text" | args4(0).Name = "Text" | ||
− | args4(0).Value = " | + | args4(0).Value = "" |
− | + | rem arrow down ----------------------------------------------------------- | |
− | + | ||
− | rem | + | |
dim args5(1) as new com.sun.star.beans.PropertyValue | dim args5(1) as new com.sun.star.beans.PropertyValue | ||
args5(0).Name = "Count" | args5(0).Name = "Count" | ||
Line 41: | Line 31: | ||
args5(1).Value = false | args5(1).Value = false | ||
− | dispatcher.executeDispatch(document, ".uno: | + | rem line ----------------------------------------------------------------- |
+ | dim args11(0) as new com.sun.star.beans.PropertyValue | ||
+ | args11(0).Name = "Text" | ||
+ | args11(0).Value = createUnoService("com.sun.star.io.XTextInputStream:readLine()") | ||
+ | |||
+ | rem eof ------------------------------------------------------------------ | ||
+ | dim args12(0) as new com.sun.star.beans.PropertyValue | ||
+ | args12(0).Name = "Text" | ||
+ | args12(0).Value = createUnoService("com.sun.star.io.XTextInputStream:isEOF()") | ||
+ | |||
+ | rem OUStringBuffer aBuffer ----------------------------------------------- | ||
+ | |||
+ | rem 10 ------------------------------------------------------------------- | ||
+ | dim args13(0) as new com.sun.star.beans.PropertyValue | ||
+ | args13(0).Name = "Howmany" | ||
+ | args13(0).Value = 10 | ||
+ | |||
+ | rem Text \\ -------------------------------------------------------------- | ||
+ | dim args21(0) as new com.sun.star.beans.PropertyValue | ||
+ | args21(0).Name = "Text" | ||
+ | args21(0).Value = "\\" | ||
+ | |||
+ | rem while args13(0).Value ------------------------------------------------ | ||
+ | rem while NOT ( xTextInputStream = isEOF() ) ----------------------------- | ||
+ | while args13(0).Value | ||
+ | |||
+ | rem ---------------------------------------------------------------------- | ||
+ | dispatcher.executeDispatch(document, ".uno:GoToStartOfLine", "", 0, Array()) | ||
+ | dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args2()) | ||
+ | |||
+ | rem ---------------------------------------------------------------------- | ||
+ | dispatcher.executeDispatch(document, ".uno:GoToEndOfLine", "", 0, Array()) | ||
+ | dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args4()) | ||
+ | |||
+ | dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array()) | ||
+ | dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args21()) | ||
+ | |||
+ | dispatcher.executeDispatch(document, ".uno:GoToStartOfLine", "", 0, Array()) | ||
+ | dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args5()) | ||
+ | |||
+ | rem args11(0).Value = createUnoService("com.sun.star.io.XTextInputStream:readLine()") | ||
+ | rem args12(0).Value = createUnoService("com.sun.star.io.XTextInputStream:isEOF()") | ||
+ | |||
+ | rem args13(0).Value = args13(0).Value - 1 -------------------------------- | ||
+ | args13(0).Value = args13(0).Value - 1 | ||
+ | wend | ||
end sub | end sub |
Latest revision as of 06:57, 24 November 2007
You can find me at ·גאַנגלערי·T·m: Th·T·email me·
Contents
my first macro
sub begin_end 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 Text begin ----------------------------------------------------------- dim args2(0) as new com.sun.star.beans.PropertyValue args2(0).Name = "Text" args2(0).Value = "" rem Text end ------------------------------------------------------------- dim args4(0) as new com.sun.star.beans.PropertyValue args4(0).Name = "Text" args4(0).Value = "" rem arrow down ----------------------------------------------------------- dim args5(1) as new com.sun.star.beans.PropertyValue args5(0).Name = "Count" args5(0).Value = 1 args5(1).Name = "Select" args5(1).Value = false rem line ----------------------------------------------------------------- dim args11(0) as new com.sun.star.beans.PropertyValue args11(0).Name = "Text" args11(0).Value = createUnoService("com.sun.star.io.XTextInputStream:readLine()") rem eof ------------------------------------------------------------------ dim args12(0) as new com.sun.star.beans.PropertyValue args12(0).Name = "Text" args12(0).Value = createUnoService("com.sun.star.io.XTextInputStream:isEOF()") rem OUStringBuffer aBuffer ----------------------------------------------- rem 10 ------------------------------------------------------------------- dim args13(0) as new com.sun.star.beans.PropertyValue args13(0).Name = "Howmany" args13(0).Value = 10 rem Text \\ -------------------------------------------------------------- dim args21(0) as new com.sun.star.beans.PropertyValue args21(0).Name = "Text" args21(0).Value = "\\" rem while args13(0).Value ------------------------------------------------ rem while NOT ( xTextInputStream = isEOF() ) ----------------------------- while args13(0).Value rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoToStartOfLine", "", 0, Array()) dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args2()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoToEndOfLine", "", 0, Array()) dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args4()) dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array()) dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args21()) dispatcher.executeDispatch(document, ".uno:GoToStartOfLine", "", 0, Array()) dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args5()) rem args11(0).Value = createUnoService("com.sun.star.io.XTextInputStream:readLine()") rem args12(0).Value = createUnoService("com.sun.star.io.XTextInputStream:isEOF()") rem args13(0).Value = args13(0).Value - 1 -------------------------------- args13(0).Value = args13(0).Value - 1 wend end sub
comments: