[Solved] Macro troubles

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
ChrisCS
Posts: 9
Joined: Fri Apr 11, 2008 5:31 pm

[Solved] Macro troubles

Post by ChrisCS »

Welcome beginner. Please answer all of the questions below which may provide information necessary to answer your question.
-----------------------------------------------------------------------------------------------------------
Which version of OpenOffice.org are you using? 2.3
What Operating System (version) are you using? Ubuntu 7.10
What is your question or comment? I installed Open Office (and Ubuntu) this week and have been trying to make a macro in Writer to put my address and the current date at the top of a letter page. I have put the macro is on a tool bar and it "sort of" works in that it puts my address as and where I want it but for today's date it puts 39549.73 instead of Friday 11 April 2008. However if I do "Insert/Fields/Other/Date" I get "Friday 11 April 2008" in my document and after that, running the macro produces the correct date each time until I shut Writer. On re-starting Writer it again puts a string of numbers like the one above. How can I make it put the date correctly from the start of opening Writer?

I have also done some macros to produce accented letters that are used in French, such as é ("e" acute) so as to save me having to do "Insert/Special Character/", look for the character and then press "OK". The macros are tool bar buttons. What I would like to do is to use each accented letter as the icon on the appropriate button. So far, all my attempts to do this have failed. Is it not possible to do this? I was able to do a similar thing in (dare I mention it - MS Word) so I would have thought it possible to do it in Open Office too. When I did it before in MS Word, I made a document that contained all the accented letters and just copied them onto the buttons which is what I have been trying to do with Writer

Any help with these, no doubt naive, questions would be greatly appreciated.

Many thanks in advance
Last edited by Hagar Delest on Mon Jun 09, 2008 10:52 pm, edited 2 times in total.
Reason: tagged the thread as Solved.
bhmt
Posts: 78
Joined: Wed Nov 28, 2007 7:35 pm

Re: Macro troubles

Post by bhmt »

ChrisCS wrote:Welcome beginner. Please answer all of the questions below which may provide information necessary to answer your question.
-----------------------------------------------------------------------------------------------------------
Which version of OpenOffice.org are you using? 2.3

I have also done some macros to produce accented letters that are used in French, such as é ("e" acute) ... The macros are tool bar buttons. What I would like to do is to use each accented letter as the icon on the appropriate button.
Many thanks in advance
(This is an answer for your second question. You might want to change your Subject to the one about the tool bar icons and make a new post for your other question if it's not too late. And mark your first post [Solved] if it is)

It's easy to use your own icons. Start the process to Modify one of your existing icons on the tool bar. When you get to the screen where you can pick from existing icons, press the "Import" button at the upper right.

A file open dialog will come up allowing you to import more icons into the internal icon directory of OpenOffice.org from some folder on your computer.

You can only import icons that are in the PNG file format and that are
 Edit: 16x16 
16x16 or 26x26 pixels in size -- you can use an image editor like Paint or Gimp or IfranView) to make, save or resize for that.

Hope that helps.

(please change the subject line and mark solved if it is. Thanks.)
Last edited by bhmt on Sun Apr 13, 2008 5:57 pm, edited 1 time in total.
ChrisCS
Posts: 9
Joined: Fri Apr 11, 2008 5:31 pm

Re: Macro troubles

Post by ChrisCS »

Hi, thanks for your suggestions. I tried making a PNG file in Paint but without any success. Paint does not appear to allow one to set the size of an image, so when I tried importing it I got a message saying that it was too big. I also tried Gimp as you suggested but got nowhere with that either. For some reason, the Gimp help files were not included in my installation of Ubuntu. It is a pity that one cannot produce an é and just copy it onto the button. Anyway, I will continue trying (for a while)

Regards,
Chris
bhmt
Posts: 78
Joined: Wed Nov 28, 2007 7:35 pm

Re: Macro troubles

Post by bhmt »

ChrisCS wrote: It is a pity that one cannot produce an é and just copy it onto the button.
I agree! Actually, I suspect someone already has every font character as a graphic somewhere already. Finding it on the web, you could get lucky.
ChrisCS wrote:Hi, thanks for your suggestions. ... Paint does not appear to allow one to set the size of an image,.... [I'm using] ... Ubuntu.
Try IrfanView instead for this. It is easy, free and says it runs on *nix. Also easy to.

So if have some small image you like, try IrfanView. http://www.irfanview.com/

You can open an existing image, Or...

In Wndows (I suspect Umbutu is similar), I can so a "Shft - PrtSc" and it copies the active window to the clipboard. Have your favorite character in view when you do this. I paste the clipboard onto IrfanView (ctrl-v).

Create a "box" around part I really want by dragging the mouse. Then press Crtl-Y to use only that part.

Then use the menu: Image...Resize...and type in 16x16 in the box. Click Ok

...and then File...Save...and pick png at the bottom and then give it a useful name and location. Press Ok.

Then do the thing with OpenOffice.

(It seems that after you get it into OOo, you can delete your original).

You may have to play to get great results, but it's worth a couple of minutes.
User avatar
kingfisher
Volunteer
Posts: 2123
Joined: Tue Nov 20, 2007 10:53 am

Re: Macro troubles

Post by kingfisher »

Have a look at Kiconedit. I believe there's a Gnome 'equivalent' but I forget what it's called and don't know what it's like.
Apache OpenOffice 4.1.9 on Linux
ChrisCS
Posts: 9
Joined: Fri Apr 11, 2008 5:31 pm

Re: Macro troubles

Post by ChrisCS »

Hi bhmt,
I downloaded Irfanview and have got as far as getting the accented letters into OO Writer's icon list. The next problem is that no matter what I do the letter refuses to be placed on the button onto the button which is labelled "agrave" (the name of the macro). I even tried naming the macro by doing ALT+133 or ALT+ 0224 with the cursor in the "Macro name" box but it wouldn't accept that. I shall eventually need about 10 buttons and if they all contain the macro name instead of an icon it will become a very large toolbar. Here was me thinking that there was light at the end of the tunnel!
bhmt
Posts: 78
Joined: Wed Nov 28, 2007 7:35 pm

Re: Macro troubles

Post by bhmt »

ChrisCS wrote:Hi bhmt,
...have got as far as getting the accented letters into OO Writer's icon list. The next problem is that no matter what I do the letter refuses to be placed on the button onto the button which is labelled "agrave" (the name of the macro). I even tried naming the macro by doing ALT+133 or ALT+ 0224 with the cursor in the "Macro name" box but it wouldn't accept that. ....
Ok. You have the macro linked to a tool bar button. But instead of the long macro name, you want a small picture icon.

All you need to do is start OpenOffice Writer, and at the right end of your new toolbar, click the small arrow and pick "Customize Toolbar."

In the middle window is a list of the buttons on the toolbar. Click on one of them to select it.

Then click the "Modify" button. Then click on "Change Icon" (not Rename).

A group of available icons will come up. Click on any of the icons and then press the "OK" button on the bottom of the panel. You should see that icon replace the button text on your toolbar.

(There is no need to try to "Modify...Rename" or edit or otherwise remove the text. The text does remain in the list of buttons and their icons.)

That group of available icons can also have your own icons, Use the Import button at the upper right. (Note: I think ONLY 16x16 icons work -- see that written on the icon panel). The "PNG" I read elsewhere.
ChrisCS
Posts: 9
Joined: Fri Apr 11, 2008 5:31 pm

[Problem solved] Re: Macro troubles

Post by ChrisCS »

Many thanks. I have now succeeded in doing what I wanted. The funny thing is that when I first attempted this and had done all the things you mention, it just would not work. Now it has worked and I haven't changed anything on my computer or with OO.o. Very strange!

Anyway, thanks again but I don't suppose you have heard the last of me. Macros in OO.o seem to have a VERY steep learning curve

Chris
bhmt
Posts: 78
Joined: Wed Nov 28, 2007 7:35 pm

Re: [Problem solved] Re: Macro troubles

Post by bhmt »

ChrisCS wrote: The funny thing is that when I first attempted this and had done all the things you mention, it just would not work. Now it has worked and I haven't changed anything on my computer or with OO.o. Very strange!

Chris
Hi Chris,

Glad it worked. Icons are nice. Meaningful icons are great.

I've noticed on this forum that sometimes OpenOffice.org has to be completely exited and restarted for some things to "take." And that includes exiting the OpenOffice quickstarter if you use it (an icon in the tooltray at the bottom right corner of Windows computers).

Probably has nothing to do with what we were doing, but nice to keep in mind.
Post Reply