Jump to content

chris_arceneaux

Member
  • Posts

    11
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by chris_arceneaux

  1. 17 minutes ago, deanishe said:


    Which version of macOS are you on?

     

    I'm running Big Sur 11.2. Here's the code I'm running that's not working:

     

    set _app to "Google Chrome"
    tell application _app to activate
        set allWins to every window
        set allTabs to {}
        repeat with currWin in allWins
            set allTabs to allTabs & every tab of currWin
        end repeat
        repeat with currTab in allTabs
            try
                if (title of currTab) contains "Youtube Music" then set musicTab to currTab
            end try
        end repeat
        tell musicTab to execute javascript "(document.querySelector('[id=\"play-pause-button\"]')).click();"
    end tell
    

     

    It seems to not like multiple lines in the tell because this works:

     

    set _app to "Google Chrome"
    tell application _app to set allWins to every window

     

  2. Thanks guys! I appreciate the tips!

     

    set _app to "Finder"
    tell application _app to activate

     

    I tried this but it didn't work. I dug in a little further and it seems a third step is necessary...

     

    set _app to "Google Chrome"
    set theScript to "tell application \"" & _app & "\" to ...."
    run script theScript

     

    With this in mind, I'll look into adding support for other browsers in the future. If anyone wants to pitch in, I'd welcome a PR🙂

  3. On 1/8/2021 at 6:30 AM, panickat said:

    will add support for Brave browser? :D

     

    I looked into this a bit back when I was initially developing this and it's not easy to make the workflow support both Chrome and Brave. This is an AppleScript limitation as it doesn't allow the application (i.e. Google Chrome) to be changed to a variable.

     

    My recommendation would be to install the plugin and change the scripts referencing...

     

    tell application "Google Chrome"

     

    to

     

    tell application "Brave Browser"

     

  4. On 5/18/2020 at 11:40 AM, godbout said:

    i've tried several ways to show the current volume. the good thing with a Script Filter is that i can show the current volume as a subtext. the (very) bad thing is that it takes some milliseconds to register the typing

    I encountered the same behavior with a workflow that I built and came to the same solution as you. Just found this post perusing your workflow and it made me chuckle. 😊

     

    I'm curious to know if you ending up finding a better way.

  5. New version has been released with the following enhancements:

    • Improved volume setting
      • Current volume is shown in Alfred results
    • Repeat control added
      • Current repeat setting is shown in Alfred results
    • Shuffle playlist control added
      • Unlike Youtube Music button, this also forces a new song to be played
    • Improved Like/Dislike setting
      • Fix ensures that current song playing is liked/disliked

    Download Latest Workflow Here

    alfred-repeat.jpg

    alfred-volume.jpg

  6. Alfred Workflow: Youtube Music Controls for Chrome
    
    Latest version: download here
    
    GitHub: https://github.com/carceneaux/alfred-youtube-music-control
    
    An Alfred workflow for controlling Youtube Music playback in an open Youtube Music tab in Chrome.
    
    I built this workflow out of necessity as Google Play music will be retired shortly.I listen to music
    most of the day at work and this helps immensely.
    
    The workflow uses the following keywords to control playback in an open Youtube Music tab:
    
    * 'ym': Play/Pause
    * 'ym prev': Previous Song
    * 'ym next': Next Song
    * 'ym+': Thumbs Up Song
    * 'ym-': Thumbs Down Song
    * 'ym vol <volume percentage>': Set Youtube Music Volume
    * 'ym search <search term>': Search Youtube Music
    * 'ym shuffle': Shuffle Playlist
    * 'ym repeat': Set Repeat Setting
    * 'ym quit': Close Youtube Music Tab
    
    Requirements
    
    By default, executing JavaScript through AppleScript is turned off in Chrome. To turn it on, from the menu
    bar, go to View > Developer > Allow JavaScript from Apple Events.
    
    For more information: https://support.google.com/chrome/?p=applescript
    

     

     

    screenshot.png

×
×
  • Create New...