Impress macro to update a slideshow in real time

I thought this would be as easy as pie. Feeling kind of dumb… :man_facepalming:t6:
Basically , I am trying to have an on screen timer during an active slideshow as a textbox. It would also be nice to have a progress bar, but this is easier (as long as I can update an existing slideshow), just calculating the amount of pixels per second and adding them to an overlapping rectangle).
Any idea how to accomplish this?
It’s NOT:

global FuncService = createunoservice("com.sun.star.sheet.FunctionAccess")
global startTime = FuncService.CallFunction("now",  Array())
global slideIndex = 0

Sub InsertTime()
	dim oField as Object
	dim timeField as String
	slideIndex = slideIndex + 1

	Do While true
		timeField = Format(FuncService.CallFunction("now",  Array())-startTime, "HH:MM:SS")
		oField = ThisComponent.getDrawPages().getByIndex(slideIndex).getByIndex(0)
		oField.Text.setString(timeField)
		wait 1000
	Loop
End Sub

At least it doesn’t seems to be working.

Thanks.

Check Python LibreOffice Programming Part 3: Draw & Impress
Chapter 17. Slide Deck Manipulation
Chapter 18. Slide Shows

There are a lot of examples that may point you where you want to go.

Just don’t assign values to global variables, leave them like:

global FuncService
global startTime
global slideIndex

and asign values into procedure:

FuncService = createunoservice("com.sun.star.sheet.FunctionAccess")
startTime = FuncService.CallFunction("now",  Array())
slideIndex = slideIndex + 1

Do While …