[Solved] Error with progress bar in Apache OO 4.1.2 macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
pranjal_ds
Posts: 11
Joined: Sun Nov 15, 2020 7:14 am

[Solved] Error with progress bar in Apache OO 4.1.2 macro

Post by pranjal_ds »

Hi,

I am trying to implement Progress bar in my Apache Open office 4.1.2 macro but getting error "Basic runtime error. Property or method not found: Dialog1."
Attached is the error screenshot.
My code is as below:

Code: Select all

Sub ProgressBarDemo()
	Dim oProgressBar as Object, oProgressBarModel As Object, oDialog as Object
	Dim ProgressValue As Long
	REM Dialog1 contains progress bar ProgressBar1 saved in standard library
	DialogLibraries.loadLibrary("Standard")
	oDialog = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
	REM progress bar settings
	Const ProgressValueMin = 0
	Const ProgressValueMax = 40
	Const ProgressStep = 4
	REM set minimum and maximum progress value
	oProgressBarModel = oDialog.getModel().getByName( "ProgressBar1" )
	oProgressBarModel.setPropertyValue( "ProgressValueMin", ProgressValueMin)
	oProgressBarModel.setPropertyValue( "ProgressValueMax", ProgressValueMax)
	REM show progress bar
	oDialog.setVisible( True )
	REM increase progress value every second
	For ProgressValue = ProgressValueMin To ProgressValueMax Step ProgressStep
		oProgressBarModel.setPropertyValue( "ProgressValue", ProgressValue )
		Wait 1000
	Next ProgressValue
End Sub
Attachments
Error while running progress bar
Error while running progress bar
Last edited by RoryOF on Fri Nov 27, 2020 5:46 pm, edited 1 time in total.
Reason: Added [Solved] and green tick [RoryOF, Moderator]
Apache Open Office 4.1.2, OS Windows 7
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Error while implementing progress bar in Apache OO 4.1.2

Post by RoryOF »

ProgressBar macro in this thread, which may be of help.
viewtopic.php?f=13&t=87392&p=409867&hil ... ar#p409861
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
pranjal_ds
Posts: 11
Joined: Sun Nov 15, 2020 7:14 am

Re: Error while implementing progress bar in Apache OO 4.1.2

Post by pranjal_ds »

Hi RoryOF,

Using the given link code I am able to implement the progress in the status bar.

But is there a solution to my error given in previous post to implement the progress bar?

Please check and suggest.

Regards,
Apache Open Office 4.1.2, OS Windows 7
Bidouille
Volunteer
Posts: 574
Joined: Mon Nov 19, 2007 10:58 am
Location: France

Re: Error while implementing progress bar in Apache OO 4.1.2

Post by Bidouille »

pranjal_ds wrote:Please check and suggest.
Without your document, we can not.

Check yourself if Dialog1 exists when you call it.
pranjal_ds
Posts: 11
Joined: Sun Nov 15, 2020 7:14 am

Re: Error while implementing progress bar in Apache OO 4.1.2

Post by pranjal_ds »

Hi Bidouille,

Attached along with is my code file.
Progrss bar code is in Module4.

Please check and suggest.
Attachments
Timeshet Details OpenOffice.ods
Progrss bar code file.
(37.56 KiB) Downloaded 205 times
Apache Open Office 4.1.2, OS Windows 7
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Error while implementing progress bar in Apache OO 4.1.2

Post by JeJe »

You don't have a dialog in that library. If I add one with a progress bar it works.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
pranjal_ds
Posts: 11
Joined: Sun Nov 15, 2020 7:14 am

Re: Error while implementing progress bar in Apache OO 4.1.2

Post by pranjal_ds »

Hi JeJe,

Please let me know how to add a progress bar?

Regards,
Apache Open Office 4.1.2, OS Windows 7
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Error while implementing progress bar in Apache OO 4.1.2

Post by JeJe »

The toolbox toolbar in the IDE has a list of controls... the label, textbox, progress bar...

Attached is your document with it added.
Attachments
Timeshet Details OpenOffice.ods
(38.18 KiB) Downloaded 220 times
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
pranjal_ds
Posts: 11
Joined: Sun Nov 15, 2020 7:14 am

Re: Error while implementing progress bar in Apache OO 4.1.2

Post by pranjal_ds »

Thank you.
My problem is resolved now.

You can close this forum.

Regards,
Apache Open Office 4.1.2, OS Windows 7
Post Reply