0

I'm trying to find a solution to fast forward a track in the Music app while it is minimised and while I'm working on another app. I got some ideas from Keyboard Maestro but not sure if the steps are right.

I have received the following script and asked to create an AppleScript but for some reason, it's not working:

set A to {}
tell application "QuickTime Player" to if it is running and (playing of documents contains true) then set end of A to "QuickTime Player"
tell application "Music" to if it is running and (player state is playing) then set end of A to "Music"
tell application "Spotify" to if it is running and (player state is playing) then set end of A to "Spotify"
tell application "VLC" to if it is running and playing then set end of A to "VLC"
A

Is there anything wrong here?

I also could not save the script in the Applescript editor.

1
  • 1
    What do you mean by it is not working - what does it seem to do?
    – mmmmmm
    Commented Aug 4, 2022 at 7:30

1 Answer 1

2

You've asked two separate questions here, one being really vague and nothing to do with the title of the question. Therefore, I'll focus on the question about fast forwarding the currently playing track in Music.app:

tell application id "com.apple.music" to if ¬
        player state ≠ stopped then set the ¬
        player position to player position + 5

This advances the track forward by 5 seconds. Likewise, you can rewind the track by a given number of seconds by subtracting them from the value of the player position property.

4
  • Thank you for your reply buddy! I was trying to say: 1 I'm listening to an audiobook using Music application 2 I minimised Music application and started to work on Microsoft Excel 3 I heard something interesting from the audiobook and I want to rewind/fast forward a couple of seconds while I'm still working on Excel and while Music application is minimised The script I pasted from Keyboard Maestro doesn't seem to work and I don't know what the problem is. Do I need to create a new AppleScript and paste the script that you written in the upper post or use Keyboard Maestro? Thnx
    – Dave Mega
    Commented Aug 4, 2022 at 16:03
  • @DaveMega: You can paste the above script into a new Script Editor document to test it out. In order to make use of it the way you want, you'd be best using Automator to create a Quick Action with a single Run AppleScript action, into which you can paste the above code replacing any sample code that appears in the editing pane. Make sure it is set to receive no input from any application, then save it and assign a keyboard shortcut to it from System Preferences > Keyboard > Shortcuts > Services
    – CJK
    Commented Aug 8, 2022 at 5:13
  • Thnx buddy...Unfortunately it didn't work
    – Dave Mega
    Commented Aug 9, 2022 at 20:38
  • @DaveMega Ah...the old "it didn't work" teaser, without actually saying what happened. I'm not a mind reader. Tell me exactly what you did (I mean exactly), and I'll help you fix it. Since there's nothing wrong with my script, the problem lies in something you did incorrectly, and I need to know what that was.
    – CJK
    Commented Aug 10, 2022 at 4:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .