Is It Possible to Play a Continuous Sound Track When a HTML Prompt Is Launched?

Or from inside the HTML prompt?

The HTML prompt in question helps me launch a HTML prompt window for pomodoro sessions.
And the sound can stop when the HTML prompt is closed.

I believe it can be done with the javascript play command, but I am not able to figure out how to play it simultaneous with the clock face changing in the HTML prompt and also where to store the mp3 file or a system sound. Need to learn more javascript.

Thank you!

Interesting.
I think it could work as an mp3 inside the HTML prompt.

Can you share what you got so far.

btw there's a Pomodoro macro in the forums

It's actually very easy. Add something like this somewhere, preferably at the end of your body (I'll explain why in a moment):

<audio src="/Users/Dan/Documents/Example Music.mp3" autoplay="true">

NOTES:

  • It appears you have to use the full path name. I tried "~/Documents/Example Music.mp3" and it didn't work.

  • When you use autoplay='true', the player's controls are hidden, which is what you want, I'd assume. They still seem to take up space in the window, though, which is why I recommend putting the code at the end of the body. It's possible there's a way to make it not take up space in the window, but my HTML/CSS is too rusty to figure it out.

Hope this helps.

2 Likes

@DanThomas thank you for the solution! This should work.

@hello if you would like I can share the macro. please let me know. It is rather basic, and is based on what was shared on the forum some time ago I think.

1 Like

Yes please do when you have a chance,
thanks @sims!

Attaching the macros here.

Not cleaned up at all – most of the macros on this forum are so well done that I am hesitant to share this. :slight_smile:

Some more details:

Macro 01: This is the macro that contains the HTML prompt. This stays in the right corner of the screen, and counts up a timer as to how long one has been in the pomodoro / focus activity.

Macro 02: This macro copies task name and project information from the first task selected in an open OmniFocus window. This macro step can be made conditional on whether OmniFocus is running or not, or the step can be deleted as well. Upon completion of the pomodoro (focus activity), a prompt asks you for any comments about how the session went and then the information is stored in a file in your home directory - the location can be changed in the macro.

Any questions please feel free to ask.

pomodoro Macros.kmmacros (17.9 KB)

Macro 01 Image

image

Macro 02 Image

1 Like