Jump to content

Jasondm007

Member
  • Posts

    342
  • Joined

  • Last visited

  • Days Won

    11

Reputation Activity

  1. Like
    Jasondm007 got a reaction from nikivi in Allow App-specific Hotkeys to Use the Same Key Combinations   
    At the moment, when you assign a key combination to a particular hotkey in Alfred, it keeps you from using the same key combination with a different hotkey. While this make sense in most scenarios, when the hotkey is assigned to a particular app - as specified in the Related Apps panel of the hotkey, and selecting the option that limits the hotkey to when the app takes focus - it seems unnecessary to restrict the user from using the same key combination with other apps that might have focus. As a result, I'd like to request this feature be added to Alfred. 
     
    Without this ability, it causes users to have to come up with increasingly ridiculous key combinations that they can never remember (OK ... that I can never remember 😉). Or, to rely on another intermediary app - like the Better Touch Tool - to assign app-specific shortcuts that are attached to External Triggers in Alfred. BTT is great, but let's cut out the middleman and keep Alfred's shortcuts in Alfred!!
     
    Thanks for your consideration!
     
    PS - This request comes from a previous that can be found here: 
     
  2. Like
    Jasondm007 got a reaction from vitor in Allow App-specific Hotkeys to Use the Same Key Combinations   
    At the moment, when you assign a key combination to a particular hotkey in Alfred, it keeps you from using the same key combination with a different hotkey. While this make sense in most scenarios, when the hotkey is assigned to a particular app - as specified in the Related Apps panel of the hotkey, and selecting the option that limits the hotkey to when the app takes focus - it seems unnecessary to restrict the user from using the same key combination with other apps that might have focus. As a result, I'd like to request this feature be added to Alfred. 
     
    Without this ability, it causes users to have to come up with increasingly ridiculous key combinations that they can never remember (OK ... that I can never remember 😉). Or, to rely on another intermediary app - like the Better Touch Tool - to assign app-specific shortcuts that are attached to External Triggers in Alfred. BTT is great, but let's cut out the middleman and keep Alfred's shortcuts in Alfred!!
     
    Thanks for your consideration!
     
    PS - This request comes from a previous that can be found here: 
     
  3. Like
    Jasondm007 got a reaction from Terminal in [SOLVED] App-specific Hotkeys w. Same Key Combination?   
    Is it possible to use the same key combination in different hotkeys when they're assigned to different apps? In other words, can I assign the same combination of keys to different apps (by adding the app to the Related Apps panel of the hotkey, and selecting the option that only activates it when the app has focus)?
     
    This is something that has always confused me about Alfred, so I wanted to check to see if I was doing something wrong. From what I can tell, Alfred won’t let you assign the same key combination to more than one hotkey - even when they only operate when different apps have focus.
     
    To get around this issue, a long time ago, I stopped adding hotkeys directly in Alfred and started adding External Triggers that I assign to a keyboard shortcut in the Better Touch Tool app. But this has always struck me as odd. Am I doing something wrong here? Is this possible in Alfred?
     
    Thanks for your help!
  4. Thanks
    Jasondm007 reacted to Andrew in How to make the Alfred search window a frontmost app   
    @Jasondm007 I'm not sure you'll ever see Alfred as a frontmost app, as he is configured as an LSUIElement. That focus mode changes Alfred's underlying window style mask, making the window non-activating.
     
    You can see the effect of this option as soon as you change the option without even closing Alfred Preferences, or the Appearance > Options sheet. Show and hide Alfred, and when in Standard Mode, showing Alfred doesn't make Alfred Preferences lose focus. Switch to compatibility, and showing Alfred makes the Alfred Preferences window lose focus (fade out).
     
    Cheers,
    Andrew
  5. Like
    Jasondm007 got a reaction from sballin in Search Apple/iCloud Notes   
    The update is awesome, @sballin!! Thanks a ton!!!
  6. Thanks
    Jasondm007 reacted to sballin in Search Apple/iCloud Notes   
    Version 2.0.0 released! The workflow now runs on python 3 and lets you copy note bodies with cmd+enter and search note bodies with a new keyword.
     
    Other minor changes: include version number, drop confusing .app.alfredworkflow extension, add please wait subtext. I don't think it's possible to have text indicating that no result was found.
  7. Thanks
    Jasondm007 reacted to sballin in Search Apple/iCloud Notes   
    Yep, you can drag the notes url text out of the notes app or another text field, into the finder, and it will create a .inetloc file. If you double click that, the URL handler should do its job!
  8. Thanks
    Jasondm007 reacted to deanishe in selection in macos + keyword   
    It's pretty straightforward, actually. The only time Alfred might pass your script multiple arguments (via ARGV) is from a File Filter or a Hotkey with Argument = "Selection in macOS". At all other times, arg and variables are always single strings. If you try to use any other datatype, Alfred will convert it to a string, e.g. if you set arg in your JSON to an array, Alfred will convert it to a tab-delimited string before it reaches the next action.

    If you want to pass around anything that isn't a string, you can either first convert it to a string (e.g. using JSON) and then back again in the next action, or save it to a file.
  9. Thanks
    Jasondm007 reacted to GuiB in selection in macos + keyword   
    @Jasondm007, you problem is that when you are directly connecting to the File Action you are receiving a list of files in "argv", but on the second example ("imc") you are sending a tab delimited list of file paths that consist as a single string as input. Therefore, on your first example you can iterate over the list input of you script and not just the first argument ("argv 1"). 
     
    Here is a modified version: https://d.pr/f/0BOBGT
     
    I added a delay to better make sure the item has time to be copied (I didn't have all the items on my clipboard viewer if not), but you can play with it to make it work for your case.
  10. Thanks
    Jasondm007 reacted to GuiB in selection in macos + keyword   
    @Jasondm007 
    honestly I don't have many tricks for trying to get some outputs to the debugger and carefully looking at the information there. Sometimes I look at what is happening before, sometimes after a node, trying to output a variable and analyzing it to see if it's right, adding tests inside the script to try to pinpoint where the problem occurs (see if a loop is looping correctly, if a variable is set correctly...)...
     
    In this case, you could see that from the "imc" Keyword node a string was output with paths separated by tab, but on the "Image..." File Action node you could see that the paths are separated by "comma" in the debugger (if you connect the Debug node just after the File Action). This way you have a little cue that the outputs are different. Then you can inspect the "item 1 of argv" and see if they match and if not try to find out why they are different.
     
    With that said, keep in mind that from an Alfred node that output a list of items you would get a List, but when chaining multiple nodes (different Run Scripts or other actions) one output is passed to the next node as one string. So, in order to get multiple items we have to build this string we can manipulate it in the next node to retrieve the different items (that's why I'm passing the paths with tabs as separators as a trick to pass multiple items so we can easily split them afterward in the next node). You can use any delimiter that you want of passing JSON string or something else (like we talked on this thread:
     
    To get back to your workflow above, actually you don't have to pass the output of your AppleScript from your "imc" keyword node and depending on what you want to achieve it could be easier to directly loop over the selection list that you get from the Finder instead of modifying the list to a single string with tab delimiter (especially if you want to connect it to another AppleScript). Here is a modified workflow to show you how it looks if you use the selection directly: https://d.pr/f/pvtilq
     
    Also, I don't remember exactly why I added the Trim function to make sure to trim the files path (maybe to make sure one of the paths doesn't have an extra whitespace in it in case we output as one string), but if you use the passed list from Alfred file action or the Finder selection, then you shouldn't have to trim the paths.
     
    Hope this helps a bit!
     
    Best
  11. Like
    Jasondm007 got a reaction from Andrew in Script Filter Output - A Very Basic Question   
    @dfay, @vitor & @deanishe - Thanks for taking the time out to help a coding neophyte, like myself. I really appreciate it. Honestly, I can't thank you guys enough.
     
    Alfred's great, but it wouldn't be the first thing I'd install on a Mac, if it weren't for you guys and others on the forum. I've learned a ton from you guys!
     
    For others who may be struggling with script filters and JSON outputs, I've uploaded a new version of the workflow to use as a learning example: Download Workflow. 
    The workflow combines everyone's suggestions from above: AppleScript, JavaScript & Ruby. All three are nearly identical, with the exception that the JavaScript and Ruby versions lack the prefix "Same Words" in the subtitle. This should be enough to get you started, if you're also struggling to get your head around how script filters' outputs work.
  12. Like
    Jasondm007 got a reaction from deanishe in Script Filter Output - A Very Basic Question   
    @dfay, @vitor & @deanishe - Thanks for taking the time out to help a coding neophyte, like myself. I really appreciate it. Honestly, I can't thank you guys enough.
     
    Alfred's great, but it wouldn't be the first thing I'd install on a Mac, if it weren't for you guys and others on the forum. I've learned a ton from you guys!
     
    For others who may be struggling with script filters and JSON outputs, I've uploaded a new version of the workflow to use as a learning example: Download Workflow. 
    The workflow combines everyone's suggestions from above: AppleScript, JavaScript & Ruby. All three are nearly identical, with the exception that the JavaScript and Ruby versions lack the prefix "Same Words" in the subtitle. This should be enough to get you started, if you're also struggling to get your head around how script filters' outputs work.
  13. Like
    Jasondm007 got a reaction from dfay in Script Filter Output - A Very Basic Question   
    @dfay, @vitor & @deanishe - Thanks for taking the time out to help a coding neophyte, like myself. I really appreciate it. Honestly, I can't thank you guys enough.
     
    Alfred's great, but it wouldn't be the first thing I'd install on a Mac, if it weren't for you guys and others on the forum. I've learned a ton from you guys!
     
    For others who may be struggling with script filters and JSON outputs, I've uploaded a new version of the workflow to use as a learning example: Download Workflow. 
    The workflow combines everyone's suggestions from above: AppleScript, JavaScript & Ruby. All three are nearly identical, with the exception that the JavaScript and Ruby versions lack the prefix "Same Words" in the subtitle. This should be enough to get you started, if you're also struggling to get your head around how script filters' outputs work.
  14. Haha
    Jasondm007 reacted to deanishe in Script Filter Output - A Very Basic Question   
    That's normal, tbh. It's insane.
     
    It'd probably be a better use of your time trying to re-implement your workflow in a sensible language (if that's possible) than muddling through with AppleScript. It's so crazy, I still don't really understand it after using it for years.
  15. Like
    Jasondm007 got a reaction from dfay in Script Filter Output - A Very Basic Question   
    @vitor Thanks a ton for the explanation and the two working examples. This was extremely helpful, and it got me thinking that I could probably figure out a way to use my existing AppleScript to generate the list and then feed it into your JavaScript or Ruby script filter examples? It's a pretty complicated AppleScript - for my scripting ability, anyways - that generates the list. To be sure, I don't disagree with any of your statements - or others' on this forum - about AppleScript's 💩 status. But it would take me ages to learn one of these better languages, and then reverse engineer the existing AppleScript. As you can tell, I hardly understand AppleScript 😉
     
    @dfay Thanks for the sources above! One of the first failed variations that I mentioned above came from my hackneyed attempts at pulling out pieces of your windows workflow (the one that works for Preview and a few others apps). When @deanishe mentioned a json.scpt file, I knew that I had seen one in your workflow, so I used it in several iterations. But I could never get any of them to work. However, I completely forgot about your more streamlined workflows for only Preview and Finder. In the multi-app version, I think stringing all those variables together for the different apps got me a little turned around. In any case, I'll go back and take a look at those other versions. Thanks a ton!!
     
    I can't thank you both enough!!
  16. Thanks
    Jasondm007 reacted to dfay in Script Filter Output - A Very Basic Question   
    Or to continue with AS, look at the examples here:
     
     
    This is what I used to figure out how to do the recent folders and active folders scripts in 
     
     
     
     
     
    And here's a solution for you:
     
    set theList to {"Red", "Green", "Blue"} # What next? -- import JSON library set workflowFolder to do shell script "pwd" set json to load script POSIX file (workflowFolder & "/json.scpt") -- Create and add items set theItems to {} repeat with i from 1 to count theList set end of theItems to json's createDictWith({{"title", (item i of theList) as text}, {"uid", i},{"arg", (item i of theList) as text}, {"subtitle", "Same Words " & (item i of theList) as text}}) end repeat -- Create root items object and encode to JSON set itemDict to json's createDict() itemDict's setkv("items", theItems) return json's encode(itemDict)  
  17. Thanks
    Jasondm007 reacted to vitor in Script Filter Output - A Very Basic Question   
    The fact that you’re using AppleScript makes the task significantly harder. AppleScript is an awful language: it’s too different from other languages, lacks several features, and is badly documented. That in turn makes it that few people want to use it, meaning there’s less people to help you and less people making resources for you to learn from.

    AppleScript falls flat on its goal of being a language for people who don’t know how to program. It’s sole redeeming quality is that it can talk to GUI apps in a programatic way built into the system. But I advise you to use it for that alone, and get out and use something else as soon as possible. If you want to learn to program, do not start with AppleScript. It’s weighing you down.
     
    At the very least, as @deanishe mentioned in the thread you linked to, use JXA (JavaScript for Automation), which gives you the only good part of AppleScript in a better (yet still not good) language.
     
    AppleScript doesn’t understand JSON, you have to build it by hand and that’s not a good situation to be in. You want to use a language that can build the JSON for you from a simple list you give it.

    JavaScript (works with Alfred’s /usr/bin/osascript (JS)):
    const my_list = ['Red', 'Green', 'Blue'] // Your example list let script_filter_items = [] // We will build this array with the elements for the Script Filter my_list.forEach(element => { // For each item in your list script_filter_items.push({ 'title': element, 'subtitle': element, 'arg': element }) // Add them to the empty array }); JSON.stringify({ 'items': script_filter_items }) // Transform it into JSON Alfred understands  
    Ruby
    require 'json' # We need the JSON gem, to be able to use JSON functions my_list = ['Red', 'Green', 'Blue'] # Your example list script_filter_items = [] # We will build this array with the elements for the Script Filter my_list.each do |element| # For each item in your list script_filter_items.push(title: element, subtitle: element, arg: element) # Add them to the empty array end puts({ items: script_filter_items }.to_json) # Transform it into JSON Alfred understands  
  18. Like
    Jasondm007 got a reaction from kristof in Mail AppleScript to take Mailbox Offline - A simple quotation marks issue?   
    @deanishe Thanks! I was able to get it working with the original script by removing the /s and making sure I used smart quotes around the mailbox's name. In short, it works like a charm now!! I can't thank you enough. 
     
    For other newbies, this is the final script that I use in an Alfred workflow to take a specific mailbox offline in Mail (making sure to substitute GMAIL with the name of your mailbox):
    on alfred_script(q) if application "Mail" is running then activate application "Mail" tell application "System Events" tell process "Mail" click menu item "Take “GMAIL” Offline" of menu 1 of menu item "Online Status" of menu 1 of menu bar item "Mailbox" of menu bar 1 end tell end tell else display notification "To take a mailbox offline, Mail must be open." with title "Mail - Not Open" end if end alfred_script  
    Thanks a ton guys!
  19. Thanks
    Jasondm007 got a reaction from sballin in Search Apple/iCloud Notes   
    @sballin Yeah, on my system, it's only located in: /System/Applications
  20. Like
    Jasondm007 got a reaction from sballin in Search Apple/iCloud Notes   
    @sballin The update works like a charm on my machine, too. 
     
    You're the best! Thanks a ton!!
  21. Like
    Jasondm007 got a reaction from cabsuwepa in Removing keywords in fallback searches?   
    Is it possible to remove a keyword that winds up being used in a fallback search?
     
    Since I’m probably not asking this question in the appropriate Alfred lingo, let me provide an example.
    Let’s say you have a file filter that uses the keyword “oo” when searching for OmniOutliner files. After searching for “oo searchterm” in Alfred, it doesn’t find anything relevant, and so you decide to use one of your fallback searches.  For simplicity, let’s say you select the default Google search fallback.  When run, Google searches for the following: “oo searchterm”. My question is whether it could be run without the “oo “ (i.e., without the keyword and space). In other words, could Alfred snip out everything before the first blank space in the search (and preferably the first blank space, too)?  
    To be clear, my question is not specific to Alfred’s default Google search fallback. I have other fallbacks that use Finder, Spotlight, etc that I’d like to solve the problem with. 
     
    I just find it annoying to always have to go back and clip off that first bit, especially when the searches all follow the same pattern (unnecessarykeyword+blankspace).
     
    Thanks for your help!
  22. Like
    Jasondm007 reacted to Andrew in How to search by tag and filename at the same time?   
    @Jasondm007 Ah I see what you mean, actually I don't have control over this as it's just allowing you to pass * as the field in the constructed MDQuery.
     
    Also, in my experience, using fields prefixed with kMDItemFS can be quite a bit slower.
  23. Like
    Jasondm007 reacted to Andrew in How to search by tag and filename at the same time?   
    @Eric C if you update to the 4.0.4 b1108 pre-release, I've made a tweak to allow * as the Metadata Field allowing you to do the broad style of matching across multiple metadata fields as you described.
     
    Configure the file filter as follows, then you'll be able to type the file name and tags e.g. `projectname receipt`.
     

     
    Let me know how you get on. I have plans on improving this further in the future 
     
    Cheers,
    Andrew
     
     
  24. Like
    Jasondm007 reacted to dfay in Open app in background   
    It would be great to be able to hold a modifier key when opening an app from Alfred, and have it open in the background without stealing focus.
     
    This can be done from the command line with 
     
    open -g path/to/app
     
    and I could create workflows for each of my commonly used apps to allow this....but it would be great as a built-in feature.
  25. Like
    Jasondm007 reacted to deanishe in Alfred 4 GUI - Issues w. Dark Iconography   
    Agree. I'm not denying that it's an issue. I suppose what I want to say is that I think there's an upside to the dark UI in Alfred Preferences in that it's makes it very difficult for a workflow author not to notice that their chosen icon doesn't work on a dark background.
     
     
    This is true. Such people are free to choose a theme that makes Alfred's results legible. It makes sense that a similar option should be available for the Alfred Preferences UI.
     
    In that regard, one could argue that Alfred Preferences should base its colours and fonts (including sizes) on the selected theme. Apart from being super-cool, that would allow users to make Alfred as readable or unreadable as they like.
     
    As I understand it, the majority of Alfred's own icons are defined in code, not as image files, which should make changing their colour comparatively easy.
     
    Other than being a lot of work for Andrew, the main argument against it—as I see it—is that it's potentially another way for users to shoot themselves in the foot, which invariably means more support requests from people complaining about "small, low-contrast fonts" that they chose themselves.
     
    But that's enough of my idea.
     
    I like your suggestion to follow OmniFocus's behaviour.
×
×
  • Create New...