Jump to content

Saez

Member
  • Posts

    27
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Saez

  1. 28 minutes ago, vitor said:

    I understand the solution you’re pursuing. But like I said you’re making something which is a workaround, GUI automation which is likely to break on Ventura. Wouldn’t you rather a more robust solution which has a better chance of surviving through (at least) the next update?

     

    Furthermore, the command-line tool I linked you to seems to do exactly what you want, is maintained, relatively popular, and should allow you to switch sources with literally one line of code. So why pursue the long winded slow solution which is likely to break instead of switching to the quick robust solution which is likely to continue working?

    Now I got it. I will check if it's solve my wishes. Thank you so much @vitor

  2. 13 minutes ago, vitor said:

    @Saez I don’t understand the post reaction. I can try to guide you further, but I need specifics on what is tripping you up.

    Oh, sorry @vitor. I understand that wasn't possible that's why I reacted sad haha.

    My point is:
    Natively, I mean by blocks on workflow, Alfred can't switch an input or output sound device in Apple Preferences > Sound. Right?

    Also, it's impossible to Mute or Unmute "natively" the microphone of mac, only the speakers.

     

    Right. To solve the "problem" of microphone I found on the web how to mute and unmute microphone by AppleScript and I created this workflow: https://github.com/gustavosaez/Mute-UnMute-Microphone---Alfred-Workflow

    Simple, easy, and just press control+option+command+M and I put the microphone to zero and if I press the same keys combination the microphone volume goes to 70% (I define the numbers on applescript).

    I duplicate this workflow and named IO-Sound because that's what I want to change.

     

    As I show you in the screenshot, the process will be the same: control+option+command+run an AppleScript (or any other script that make it happens) and a Notification confirms that my Input and Output devices were changed to X and Y.

     

    Precisely I want to find a way to:
    When I press control+option+command+I my Output goes to "S43ZSCLQ30" (My bluetooth earphone) and Input goes to my "Shure MV51" (my professional microphone)

    And when I press control+option+command+again the script switch de devices to MacBook Air Speakers/Microphone built-in.

     

    I don't know if I was clearly now. If not, please, tell me how can I explain better.

    359617289_AlfredPreferences-CleanShot22-07-2022at14_18.45@2x.thumb.png.021730ab8eeb5d41dca9c402aace5b32.png

  3. Hey Guys, I had an idea but I need help from people who knows AppleScript.

    Today we have a common scenario of people working from home and sometimes need to change the input or output from a device to another.

    In my case, when I go record a podcast (as a guest) or joining to a meeting I need to manually set Output to "S43ZSCLQ30" (My bluetooth earphone) and Input to my "Shure MV51" (my professional microphone). Every time I need to manually do this.

     

    My point is: I know it's possible to automate this by a Hotkey or even setting a Word > Enter because I already did that with this Workflow on GitHub.

    Today my point is the ability to set a word or hotkey and the action will be:
    set S43ZSCLQ30 as Output

    set Shure MV51 as Input

    and when press the hotkey (or word) again both back to MacBook Air Speakers/Microphone (meaning I have the job done).

    I found some AppleScripts on the web but I don't have much knowledge to understand the code to make it works.

    Somebody can help?

    Below some codes I got it.

     

    https://apple.stackexchange.com/questions/217148/using-apple-script-to-manage-sound-output-selection

     

    tell application "System Preferences" to activate
    tell application "System Events"
      get properties
      tell process "System Preferences"
        click menu item "Sound" of menu "View" of menu bar 1
        delay 2
        set theRows to every row of table 1 of scroll area 1 of ¬
          tab group 1 of window "sound"
        set theOutputs to {} as list
        repeat with aRow in theRows
          copy (value of text field 1 of aRow as text) to the end of theOutputs
        end repeat
        tell application "Finder"
          activate
          set desiredOutput to display dialog ¬
            "Choose Sound Output: " buttons theOutputs default button "SoundSticks"
        end tell
        repeat with aRow in theRows
          if (value of text field 1 of aRow as text) is equal to ¬
            (button returned of desiredOutput as text) then
            set selected of aRow to true
            exit repeat
          end if
        end repeat
      end tell
    end tell
    tell application "System Preferences" to quit

     

    tell application "System Preferences" to activate
    tell application "System Events"
      get properties
      tell process "System Preferences"
        click menu item "Sound" of menu "View" of menu bar 1
        delay 2
        set theRows to every row of table 1 of scroll area 1 of ¬
          tab group 1 of window "sound"
        set theOutputs to {} as list
        repeat with aRow in theRows
          if (value of text field 1 of aRow as text) ¬
            is equal to "SoundSticks" then
            set selected of aRow to true
            exit repeat
          end if
        end repeat
      end tell
    end tell
    tell application "System Preferences" to quit

     

  4. 5 hours ago, dobby007 said:

    Have the Alfred developers ever thought about introducing a real marketplace for Alfred workflows? This is like the most inconvenient thing that I need to search for workflows on forums, buggy and outdated Packal site, GitHub, Google or whatever. Then I might wanna check if there are any updates to my workflows and here comes a real painful question: where did I download the workflow from?

     

    It seems like a natural evolution of Alfred so I just trying to wrap my head around the reasons why this hasn't been introduced for so long time.


    That's a good idea.
    Maybe some advanced users from here can curate the workflow (like App Store or Shortcuts) and make sure workflows keep updated and functional (inactivating older).
    This could encourage other users share more and more useful workflows improving productivity with Alfred.
    Also keep the community more active.

    Another thing is create ability to voting/review workflow to encourage others to download it.

    Ability to make creators create more, perhaps creating some system to affiliate or gain some credit to change by discount on upgrade to v5, anything like that.

    And @dobby007 there is a way to make (with script or python) the workflow check if there is any update and auto-update, the creators just must implement it (I don't know how to do it, but I had some that update when tried to run.

  5. 1 hour ago, vitor said:

    I see the usefulness in muting your microphone from a Hotkey, as it’s a way that should work universally across apps.

     

    I’d be wary of calling it a way to take control of one’s privacy, though. Just like the Workflow can unmute the microphone programmatically, so can anyone else, which means muting it doesn’t offer any protection against those who are shady.

     

    I Agree. I want to mean privacy and not protection because mute microphone keeps your privacy ok but not means protection by itself.
    Just a way to avoid "audio leaking' when entering in a meeting call.

    I didn't not mean that it protects anything further the privacy of audio.

  6. If you are coming from Windows and used to use "Windows + E" to access the Explorer folder, in macOS you are facing no shortcut for this or need to be on desktop and press 3 keys at the same time to open such folder.

     

    So, this simple shortcut opens the Download Folder and the shortcut is "Command + E".

    Inside the shortcut you can edit to any other folder you prefer. Unfortunately it's not possible to select the 'iCloud Drive' folder, any other else is allowed.

     

    Download | Source

     

     

    image.thumb.png.6157ff3e4b79b2f6106383ea69a93577.png

  7. 2 hours ago, deanishe said:

    If you want to open a playlist URL use open location, i.e. tell application "Music" to open location (item 1 of argv)

     

    Hmmm that's works partially. Music.app recognize the command, open the playlist, connects to the destination but not starts play:
    the link I'm testing: https://music.apple.com/us/playlist/feeling-confident/pl.76e1b75c52404883bc58972d4ebb2c6f


    76087906_MusicMusic18_12.202110h01m38s.thumb.png.0247863bc7655ef0be54a92a015d7d7d.png

  8. 40 minutes ago, vitor said:

     

    That’s the code I posted above.

    Unfortunately it's not working.

     

    [12:36:51.341] Apple Music - ALPHA[List Filter] Processing complete
    [12:36:51.341] Apple Music - ALPHA[List Filter] Passing output 'https://music.apple.com/us/playlist/feeling-confident/pl.76e1b75c52404883bc58972d4ebb2c6f' to Open URL
    [12:36:51.359] Apple Music - ALPHA[Open URL] Processing complete
    [12:36:51.360] Apple Music - ALPHA[Open URL] Passing output 'https://music.apple.com/us/playlist/feeling-confident/pl.76e1b75c52404883bc58972d4ebb2c6f' to Run Script
    [12:36:51.559] ERROR: Apple Music - ALPHA[Run Script] /Users/gustavosaez/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/8F6FE6A4-B99D-4DA4-8CAD-45D17ACC7135:42:72: execution error: Music got an error: Can’t make some data into the expected type. (-1700)

     

     

    567095039_AlfredPreferencesAlfredPreferences17_12.202113h09m05s.thumb.png.0df98921627379e2116c39ada0b4087f.png

  9. Basically the way is like this:
    952862590_AlfredPreferencesAlfredPreferences17_12.202112h10m08s.thumb.png.537bb96e54337a0c9e6010852a3c7de2.png

     

    Args, means:
    24397200_CleanShotCleanShot17_12.202112h10m40s@2x.thumb.png.a762c17cd6255da822b5187ed26162b7.png

     

    I thought if there is a way to copy this Arg and make AppleScript read it (get this arg).

    The way is:
    1. Type "amusic"
    2. Select what you want to listen
    3. Music.app is opened in the page. (stops here and the user needs to click on Play to listen, except for radio stations).


    I want to update to next steps:
    4. Music app is hidden (I found how to do this)
    5. Music starts to play without action of user (I'm in trouble of this)


    After that, I think the way is "automated" to do everything in Alfred.

  10. I'm working on this Alfred Workflow: https://github.com/gustavosaez/Alfred-Workflow-Apple-Music-Playlist

    And today I'm looking for a day to "automate" the play music in background or hidden (to avoid open the application and click PLAY).

    I found a way to set the mouse click on a screen position (specific on the play button), but it works only if the app is visible and if the resolution of screen is the same of mine.

    I search about UI Elements for Music.app and didn't find anything.

    The problem is:

    • When Alfred opens the chosen link, Music.app take a few seconds to open and load the playlist selected;
    • After this, space/play command is inactive, so I think to create a script that gets the current page and play the playlist in shuffle mode.

    Any idea?

    some ideas:

    tell application "Music"
        -- tell application "System Events" to tell process "Music" to click at {620, 374}
        play current playlist
    end tell

     

    tell application "Music"
        -- tell application "System Events" to tell process "Music" to click at {620, 374}
        play {workflowPlaylistName}
    end tell
    
    tell application "System Events"
        keystroke "h" using command down
    end tell

     

  11.  

    Alfred Workflow - Apple Music Playlist

    This workflow was based on the information provided by MacStories in this post

    Tired to check the page everytime I wanted to hear something new and also tired to find something new in a mess of Apple Music App, I imported manually each link and image to here.

    So, just type "amusic" to see a list or "amusic+type" to select a specific list and choose inside it, for example "amusicplaces".

    After choose, tap enter and the music app on your mac will be opened at the playlist choosen, just play and enjoy.

     

    Feel free to edit and reshare.

    Check it here https://github.com/gustavosaez/Alfred-Workflow-Apple-Music-Playlist

  12. Forget it friend! I found the error on the log
     

    Quote

    [11:46:41.831] ERROR: Kill Sticky[Run Script] /Users/gustavosaez/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/C01C00E4-0A67-4A64-962F-376AB4B122A8:29:332: execution error: Safari got an error: You must enable the 'Allow JavaScript from Apple Events' option in Safari's Develop menu to use 'do JavaScript'. (8)


    Now, allowed, it worked. Thank you so much!!!

  13. The link expired. How can I trigger a javascript on Alfred to run it on Safari at the same page?

     

    javascript:(function()%7B(function%20()%20%7Bvar%20i%2C%20elements%20%3D%20document.querySelectorAll('body%20*')%3Bfor%20(i%20%3D%200%3B%20i%20%3C%20elements.length%3B%20i%2B%2B)%20%7Bif%20(getComputedStyle(elements%5Bi%5D).position%20%3D%3D%3D%20'fixed')%20%7Belements%5Bi%5D.parentNode.removeChild(elements%5Bi%5D)%3B%7D%7D%7D)()%7D)()

     

×
×
  • Create New...