I'm new to OOo. I have just recently switched from using MS Office to Open Office. So far, I really like the functionality and the similarity of OOo to MS Office!
To make my experience a bit more robust, I would like to have a single button on a tool bar which would open a specific directory. The function would be very similar to the "open directory" icon on the standard toolbar. The only difference would be the directory which is opened. The standard "open document" button opens the last used directory, I would like to have a custom button which would open "D:\ChasData\Document\SeqFile\2008\" and then I could choose the file in that directory I wanted to edit.
A second macro I would like is a button which would allow me to "SaveAs" to specific directory with a file name of "caf-2008-00xx" The last two digits (xx) would be manually filled in at the time the file is saved. An example of the filename would be “caf-2008-0098.odt" where the "98" would be supplied manually. Also, the file type (“.odt”, “.doc”, etc) would be manually selected at the time the file is saved, just like with the "File|SaveAs" function.
In both cases, the directories are fixed, so I expected this to be a simple task to write a macro to do it. However, I have been overwhelmed by the amount of documentation available! Trying to sort through it has been very time consuming.
I *think* the .uno:open and the .uno:saveas are the two tool bar functions I would like to access. If there is a way to access them and have them open to a specific directory, that would be great. However, I cannot find a reference for the array values of .name and .value to pass to the function, so I cannot properly create the array for both the directory name and a partial filename.
I tried using the following code which was generated by the macro recorder. It would open a directory, but it was the last directory opened, not the specific directory I wanted to go to.
Code: Select all
sub openfile
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 ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Open", "", 0, Array())
end sub
I'm pretty sure I could complete this macro if I had a reference document defining the various array values for the “Array().name” and “Array().value”, but then I could be wrong.
I have been working on this for about a week and have 18 pages of macros I have tried. Unfortunately, I don't feel I'm much closer to a solution. What is really frustrating, is this appears to be such a simple task to do.
This exercise has not been a total loss so far. I have successfully created two other macros. One to open my “Catalog” file and the other to paste unformatted text into a document.
Thanks in advance for any help you may be able to provide.
Bye...
Charles