Jump to content

How to work with Keywords & Arguments?


Recommended Posts

1963883441_ScreenShot2022-03-07at10_49_50PM.thumb.png.6d1d37c0e16c9304201df436f1d3dc0a.png

 

Is there an easier way to make it so that I can type the key word + the argument for the List Filter when opening Alfred?

 

In the above, I can type "music play" and it performs the intended action/output. Or I can just type music, hit enter and get the options from the List Filter (in case I have a brain fart and forget what options are available or how I abbreviated them)

 

Just wondering if there is another way to do this, without having to use the Conditional Filter after the initial keyword? Reason, because I'm working on another workflow that has many more end commands and need to conserve space in the workflow build window. Also just trying to learn and not over complicate things as much as possible.

 

Link to comment

What is the purpose of the Keyword? You can start the Workflow with the List Filter itself and the behaviour would be the same. Better, even, because it would ensure you only type valid options and wouldn’t need to use the full word.

Link to comment
1 hour ago, vitor said:

What is the purpose of the Keyword? You can start the Workflow with the List Filter itself and the behaviour would be the same. Better, even, because it would ensure you only type valid options and wouldn’t need to use the full word.

 

That is true; but I don't mind typing full words. I type pretty fast, and most words are only a few letters any ways.

But I put the keyword in, because it hides the annoy google search from the list filter. However I did add a shortened keyword on the List Filter (am) to jump right into that if needed (but again with the annoying google search at the bottom of the list)

 

1212812921_ScreenShot2022-03-08at7_17_48AM.thumb.png.af55756bc4549b12508392803985becb.png

 

But I added a Playlist option to the flow, but have to manually add the playlist names to the List Filter.

Is it possible to get the playlist using the Script Filter?

 

I tried using 

tell application "Music"
  get name of playlists
end tell

 

But don't know how it outputs the results, or what I need to output them to? 

 

Edited by Smpl
Link to comment
1 hour ago, Smpl said:

because it hides the annoy google search

1 hour ago, Smpl said:

but again with the annoying google search

 

If you don’t like it, you can turn it off. Alfred Preferences → Features → Default Results → Fallbacks.

 

1 hour ago, Smpl said:

But I added a Playlist option to the flow, but have to manually add the playlist names to the List Filter.

Is it possible to get the playlist using the Script Filter?

 

That’s an entirely unrelated problem. If you want to use a Script Filter, don’t use AppleScript because you’ll need JSON. Use JXA instead.

 

1 hour ago, Smpl said:

But don't know how it outputs the results

 

Run the command in the Script Editor app.

 

1 hour ago, Smpl said:

or what I need to output them to?

 

Script Filter JSON Format.


But again, that has nothing to do with the original question. If you start with a simple query and then introduce an unrelated complex one midway through, it won’t be easy to help you.

Link to comment
  • vitor changed the title to How to work with Keywords & Arguments?
29 minutes ago, vitor said:

But again, that has nothing to do with the original question. If you start with a simple query and then introduce an unrelated complex one midway through, it won’t be easy to help you.

 

@vitor I just thought it would be better to use the same topic, since its related to the same workflow. Instead of starting a whole new one.

I'm good with the original question, I'm fine with how it is now. I didn't realize that the workflow window expands to allow for more space, so I was originally trying to see if there was a simpler way to get to the same end result to save on space in the work flow since I knew I had more to add.

 

If its better than I create a new Topic for the Script Filter question (or whatever is needed to be used instead) to obtain the playlists automatically from the Music app, then I will.

 

Thank you for the help thus far though :)

Edited by Smpl
Link to comment
8 hours ago, Smpl said:

If its better than I create a new Topic for the Script Filter question (or whatever is needed to be used instead) to obtain the playlists automatically from the Music app, then I will.


No, this one is fine. “One problem at a time” is what matters.
 

What exactly is the new question? What’s your current setup and what result are you trying to achieve?

Link to comment
8 hours ago, vitor said:


No, this one is fine. “One problem at a time” is what matters.
 

What exactly is the new question? What’s your current setup and what result are you trying to achieve?

 

I did end up create a new topic Help with getting output from AppleScript to JSON

 

Problem is, I'm not a "programmer." So I'm not familiar with how to change the AppleScript to this JXA you mentioned before to interact with the Apple Music apple.
I spent several hours googling how JXA/JavaScript could be able to control/obtain data from Music but there was nothing on this subject. Some smart individual needs to come up with a program that lets you input AppleScript, and it outputs JXA, lol.. I'd pay for that :P 

 

Basically what I'm trying to do is dynamically get a list of my Playlists in Apple Music, then output that to the AppleScript I have to play that playlist.
Its not super important or vital that its possible, I just wanted to be able to share my workflow and the friends that use it wouldn't have to Manually edit the List Filter with their Playlist titles like I have. I personally don't mind having to do that, just thought it would be easier for others if the workflow did it for them.

 

Edit: I got the JXA (JavaScript) part of it figure out through trial and error, and looking through the Dictionary in Script Editor, but I'm stuck on the JSON part. I've posted the code I'm using in the other topic, where I've been having a conversation with myself :P

 

 

Edited by Smpl
Redirect to other topic.
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...