Meow
I have a little bit of problem.
I trying to put a dialog box in beginning of macro. In fact, not real dialog. Just window with progress bar, and maybe Cancel button. This window should stay open at all time of macro working. And automatic close at end of macro.
By the way. Is there any way to put progress bar for macro in status bar of OpenOffice?
Ponny
[Solved] Progress bar in my macro
[Solved] Progress bar in my macro
Last edited by Hagar Delest on Fri Jan 20, 2017 9:14 am, edited 1 time in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
MS Windows 10: OpenOffice 4.1.13; LibreOffice 7.3.5.2
Re: Progress bar in my macro
Here is an example of controlling the document's status bar with a macro. I copied it from this post in the Spanish forum. I translated the comments.
Code: Select all
Sub ControlarAplicacion4()
Dim oBarraEstado As Object
Dim co1 As Integer
'Referencia a la barra de estado del documento activo, Reference the active document's status bar
oBarraEstado = ThisComponent.getCurrentController.StatusIndicator
'Establecemos el texto inicial y el limite de la barra de progreso, Set the initial text and limit of the status bar
oBarraEstado.start( "Procesando Líneas ", 10 )
For co1 = 1 To 10
'Establecemos el valor de la barra de progreso, Set the status bar value
oBarraEstado.setValue( co1 )
'Y el texto, and the text
oBarraEstado.setText( "Procesando la línea: " & co1 )
'Esperamos un segundo, Wait one second
Wait 1000
Next
'Es importante finalizar la barra de estado para devolverle el control a la aplicación
'It is important to end the status bar process to return control to the application
oBarraEstado.end()
End Sub
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Progress bar in my macro
The code above drives the ProgressBar at the Bottom of document window.
From here (https://wiki.openoffice.org/wiki/Docume ... ogress_Bar) is the code for a dialog box.
To use it you have to create a dialog called "Dialog1" and into this insert a ProgressBarObject called "ProgressBar1". (default names)
From here (https://wiki.openoffice.org/wiki/Docume ... ogress_Bar) is the code for a dialog box.
To use it you have to create a dialog called "Dialog1" and into this insert a ProgressBarObject called "ProgressBar1". (default names)
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
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
Re: Progress bar in my macro
It works, thankyou.
I searched in OOo help, and found nothing.
Thankyou again and good night.
Ponny
I searched in OOo help, and found nothing.
Thankyou again and good night.
Ponny
MS Windows 10: OpenOffice 4.1.13; LibreOffice 7.3.5.2
Re: Progress bar in my macro
The help includes the (almost) complete documentation for the Basic language.Ponny wrote:I searched in OOo help, and found nothing.
It does not cover the things you can describe in that language or any other macro language.
This is not for amateurs nor "newbies". At least you should be a hobbyist with some programming background and some level of persistence.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Progress bar in my macro
Andrew Pitonyak's OpenOffice Macros Explained has a section on the Progress Bar at 18.3.9
His Useful Macro Information for OpenOffice.org deals with it in 10.2.9
There are a number of other references and examples easily found on the Internet.
His Useful Macro Information for OpenOffice.org deals with it in 10.2.9
There are a number of other references and examples easily found on the Internet.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS