ShareShortcuts

IsSongPlayingOrPaused

weplaydr
Fork “IsSongPlayingOrPaused”

Built something new on top of this Shortcut? Share it as a fork: it becomes a Shortcut of your own, which you manage, and both pages link to each other so weplaydr gets credit.

  1. 1Get the Shortcut and change it in the Shortcuts app. Give it a name of its own.
  2. 2Share it from the Shortcuts app and copy the iCloud link.
  3. 3Come back here, paste the link and describe what is different, e.g. “Added a step that uses Apple Intelligence to personalise the text.”
Downloads
32K
Saved
1
Actions
15
Category
Music
Version
1.1
Language
EN

IsSongPlayingOrPaused 1/0 SHORTCUTS HAS NO NATIVE SUPPORT TO DETERMINE WHETHER OR NOT CURRENT SONG IS PLAYING OR PAUSED. This is carefully crafted to first circumvent possible conversion errors by CASTING PLAYBACK POSITION TO NUMBER (Type); sampling twice; then test whether delta is non-zero.

What's New

Version 1.1

An extraneous nop action deleted from script.

Version History
1.1 May 23, 2023

An extraneous nop action deleted from script.

1.0 May 23, 2023

First release

What it does

15 actions
  1. Get Current Song
  2. Number
  3. Set Variable
    t0
  4. Comment
    ENABLES SHORTCUTS TO DETERMINE WHETHER IsSongPlayingOrPaused 1/0 APPLE SHORTCUTS HAS NO NATIVE SUPPORT TO DETERMINE WHETHER OR NOT A SONG IS CURRENTLY PLAYING. Tuesday May 23, 2023 WRITTEN BY [email protected] PayPal.Me/Edmonton/10
  5. Nothing
  6. Comment
    The above NOP + Comment increases Time Delta by 100ths of a second
  7. Number
  8. Wait
  9. Get Current Song
  10. Number
  11. Set Variable
    t1
  12. If
  13. Stop and Output
  14. If
  15. Stop and Output

View as code
Beta

Every action of this Shortcut written out as Cherri, a programming language for Shortcuts. Great for learning how it works.

#include 'actions/music'
#define color purple
#define glyph circledQuestionMark

const CurrentPlaybackTime = getCurrentSong()
number(CurrentPlaybackTime)
@t0
/*
ENABLES SHORTCUTS TO DETERMINE WHETHER  IsSongPlayingOrPaused   1/0

APPLE SHORTCUTS HAS NO NATIVE SUPPORT TO DETERMINE WHETHER OR NOT A SONG IS CURRENTLY PLAYING. 

Tuesday May 23, 2023 WRITTEN BY [email protected]
PayPal.Me/Edmonton/10

*/
nothing()
// The above NOP + Comment increases Time Delta by 100ths of a second

const Number = 0.5
wait(Number)
const CurrentPlaybackTime1 = getCurrentSong()
@t1 = CurrentPlaybackTime1

if @t1 > @t0 {
	mustOutput("1", "1")
} else {
	mustOutput("0", "0")
}
Open in Cherri Playground Decompiled with cherri 2.3.0 (GPL-2.0). May need small fixes before it compiles.

Ratings & Reviews

Write a Review
–
out of 5
★★★★★
★★★★
★★★
★★
★
0 ratings

No reviews yet. Be the first to share what you think!

Advertisement

More by weplaydr

See All

You Might Also Like

See All
Advertisement