Inserting the date each day in a journal

Writing a book, Automating Document Production - Discuss your special needs here

Inserting the date each day in a journal

Postby mkhammer695 » Mon May 10, 2010 12:02 am

Thanks. I guess I am in over my head but I seem to learn faster this way.
The machine is running Windows Vista 32 bit and I have been struggling with the issue for the better part of six hours. Plus a few days.
In OpenOffice.org 3.2 Writer, I have been developing a "Journal" template.
This is when the trouble started. It is very handy to have a tool by which the "Date" in the date field changes with the calendar, but now I've got the bright idea that it would be very helpful to set it up so that a time stamp would be set in a field upon opening the document, saving it, and closing it.
This way I would have a detailed record of events in the journal.
I checked the "Macros" forum entries and tried a copy/paste dialog. It inserted the time field but it updates the time at the upper left whenever I re-open the journal. The message pops up SYNTAX ERROR and I have to click close four or five times to escape.
Does anyone know how to configure the time stamp to anchor the appropriate field after the ending sentence on "close" or "save", and in front of the opening sentence when opening the journal?
for example: 13:33:50 The quick brown... the end of that. 13:56:04
I appreciate your willingness to school me in this if someone is willing and able.

Best vibes
Hammer

Title Edited. A descriptive title for posts helps others who are searching for solutions and increases the chances of a reply (Hagar, Moderator).
OpenOffice 3 on Windows Vista 32 bit
User avatar
mkhammer695
 
Posts: 4
Joined: Thu May 06, 2010 4:39 pm

Re: macros-snippets-scripts-or?

Postby RoryOF » Mon May 10, 2010 12:13 am

If you select Insert / Fields / Other / Document / Time
you get two choices, Time (fixed) and Time. Time fixed freezes the time of insertion, Time updates.
The shortcut Time selection from Insert Fields is the updating one.

I can't help with your time-stamping, sorry.
Apache OpenOffice 4.0.1 on Xubuntu 14.04 and Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 14377
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: macros-snippets-scripts-or?

Postby floris v » Mon May 10, 2010 12:17 am

Insert - Field - Document tab - select Time. That should give two options, Time (fixed) and Time. You need Time (fixed).

Code: Select all   Expand viewCollapse view
sub insert time
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(5) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Type"
args1(0).Value = 1
args1(1).Name = "SubType"
args1(1).Value = 0
args1(2).Name = "Name"
args1(2).Value = ""
args1(3).Name = "Content"
args1(3).Value = "0"
args1(4).Name = "Format"
args1(4).Value = 5041
args1(5).Name = "Separator"
args1(5).Value = " "

dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args1())
MS Windows Vista - AOO 4.0.1 - LibreOffice 4.1.0.4.
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
floris v
Moderator
 
Posts: 3034
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands


Return to Advanced Uses

Who is online

Users browsing this forum: No registered users and 6 guests