Difference between revisions of "User talk:גאַנגלערי"
From Apache OpenOffice Wiki
(made some tests) |
(// changed to \\) |
||
(One intermediate revision 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 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 | dim args11(0) as new com.sun.star.beans.PropertyValue | ||
− | args11(0).Name = " | + | args11(0).Name = "Text" |
args11(0).Value = createUnoService("com.sun.star.io.XTextInputStream:readLine()") | args11(0).Value = createUnoService("com.sun.star.io.XTextInputStream:readLine()") | ||
+ | rem eof ------------------------------------------------------------------ | ||
dim args12(0) as new com.sun.star.beans.PropertyValue | dim args12(0) as new com.sun.star.beans.PropertyValue | ||
− | args12(0).Name = " | + | args12(0).Name = "Text" |
− | args12(0).Value = | + | args12(0).Value = createUnoService("com.sun.star.io.XTextInputStream:isEOF()") |
− | + | rem OUStringBuffer aBuffer ----------------------------------------------- | |
− | rem | + | rem 10 ------------------------------------------------------------------- |
− | + | dim args13(0) as new com.sun.star.beans.PropertyValue | |
+ | args13(0).Name = "Howmany" | ||
+ | args13(0).Value = 10 | ||
− | rem | + | rem Text \\ -------------------------------------------------------------- |
− | dim | + | 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 ---------------------------------------------------------------------- | rem ---------------------------------------------------------------------- | ||
− | dispatcher.executeDispatch(document, ".uno: | + | dispatcher.executeDispatch(document, ".uno:GoToStartOfLine", "", 0, Array()) |
+ | dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args2()) | ||
rem ---------------------------------------------------------------------- | rem ---------------------------------------------------------------------- | ||
− | + | dispatcher.executeDispatch(document, ".uno:GoToEndOfLine", "", 0, Array()) | |
− | + | ||
− | + | ||
− | + | ||
dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args4()) | 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: | + | dispatcher.executeDispatch(document, ".uno:GoToStartOfLine", "", 0, Array()) |
+ | dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args5()) | ||
− | args11(0).Value = createUnoService("com.sun.star.io.XTextInputStream:readLine()") | + | rem args11(0).Value = createUnoService("com.sun.star.io.XTextInputStream:readLine()") |
− | args12(0).Value = | + | 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 | wend |
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: