[Solved] Change cell color while sound is running

Creating a macro - Writing a Script - Using the API

[Solved] Change cell color while sound is running

Postby N4LXP » Thu Jun 04, 2020 10:03 pm

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
N4LXP
 
Posts: 2
Joined: Thu Jun 04, 2020 9:50 pm

Re: Change cell color while sound is running

Postby Zizi64 » Thu Jun 04, 2020 10:29 pm

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; LO6.1.6, 6.2.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.4.5;AOO4.1.7
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: 9439
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Change cell color while sound is running

Postby Zizi64 » Thu Jun 04, 2020 10:37 pm

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; LO6.1.6, 6.2.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.4.5;AOO4.1.7
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: 9439
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Change cell color while sound is running

Postby Zizi64 » Thu Jun 04, 2020 11:21 pm

Here is a sample code embedded into the attached document:

FlashLight.ods
(10.36 KiB) Downloaded 19 times
Tibor Kovacs, Hungary; LO6.1.6, 6.2.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.4.5;AOO4.1.7
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: 9439
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Change cell color while sound is running

Postby N4LXP » Fri Jun 05, 2020 2:09 pm

Thanks for all the help. Using "Style" was an easy and elegant solution.
OpenOffice 4.1.3 on Windows 10 Pro
N4LXP
 
Posts: 2
Joined: Thu Jun 04, 2020 9:50 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests