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 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

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
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.1.5 on Xubuntu 18.04 (mostly 64 bit version) and infrequently on Win2K/XP
14 October 2016 was Pooh's 90th birthday
User avatar
Posts: 26528
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("")

rem ----------------------------------------------------------------------
dim args1(5) as new
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 10 - AOO 4.1.3 - LibreOffice
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
Posts: 3978
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 5 guests