[Solved] Change cell color while sound is running

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
N4LXP
Posts: 2
Joined: Thu Jun 04, 2020 9:50 pm

[Solved] Change cell color while sound is running

Post by N4LXP »

I have a macro that plays an mp3 file about 3 seconds long after a button is pushed. Someone else is listening to that mp3 file using a headset and the user can't hear it. At best, I would like to change the color of the button while the mp3 file is being played and if that is not possible I would like to change the color of the adjacent cell. Thanks so much for your help.
Last edited by Hagar Delest on Fri Jun 05, 2020 5:57 pm, edited 1 time in total.
Reason: tagged solved.
OpenOffice 4.1.3 on Windows 10 Pro
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Change cell color while sound is running

Post by Zizi64 »

Of course you can change the color of a Form Control element (Button) by a macro.

You can change the color easily, when the button is clicked, and the macro is launched, by the first command of the macro. But it is harder to reset the button color, when the sound ends. There is not a built-in Event for this task.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Change cell color while sound is running

Post by Zizi64 »

Try to apply the function STYLE() by your macro with the usage of the timing option in the applied Cell Formula:

https://wiki.openoffice.org/wiki/Docume ... E_function

Apply the Cell Formula to the desired cell by your macro launched by the Button-click.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Change cell color while sound is running

Post by Zizi64 »

Here is a sample code embedded into the attached document:
FlashLight.ods
(10.36 KiB) Downloaded 165 times
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
N4LXP
Posts: 2
Joined: Thu Jun 04, 2020 9:50 pm

Re: Change cell color while sound is running

Post by N4LXP »

Thanks for all the help. Using "Style" was an easy and elegant solution.
OpenOffice 4.1.3 on Windows 10 Pro
Post Reply