Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Posts posted by GuiB

  1. 6 hours ago, Nabil said:

    Im talking about the second line!?


    Actually, you don't need to edit that line. The `filePath` string that is mentioned here is simply a variable that refers to the `filePath` string from the first line.


    I mean, the first line is simply there to set a variable to the file path that you want and then this variable is used later in the script. I put it there at the top so it is easy to see and make it clearer.


    Hope this helps!

  2. On 2/24/2020 at 2:48 PM, Nabil said:

    how do I find the POSIX file path? As shown in the script description for the workflow! 

    I am an amateur!!

    @Nabil, for the script, you need to change the `"/path/to/your/image"`  in the line:


    set filePath to "/path/to/your/image"

    to the path of your file.


    You can get the file path using the Alfred File Action named "Copy Path to Clipboard" or the 'Copy "fileName" as Pathname' that you can get while doing a secondary click on the file in the Finder and holding the Alt key  (like explained here: https://osxdaily.com/2015/11/05/copy-file-path-name-text-mac-os-x-finder/ )

  3. Hey, a little late, but wanted to join the party since this is one of my most wanted feature requests (I think we talked about this multiple time ago...)! Actually, it would be great to remove the restriction completely and allow to assign the same hotkey in any workflow and make a popup to list the possible list of actions when invoking a hotkey which is assigned to multiple actions (like @Jasondm007 is mentioning), but being able to use the same hotkey only in app-specific situation would be a great step! :)


    I've been assigning some of my hotkeys from behind (by editing the workflow "info.plist") or using BetterTouchTool or Hammerspoon to get around this.


    On 1/17/2020 at 6:22 AM, Andrew said:

    I'm open to implementing this.


    One of the reasons this hasn't been a thing so far is it is much easier for users to accidentally get themselves into a confusing situation. What would you consider to be the desired behaviour if there were a hotkey conflict? (e.g. set same hotkey on two different synced macs in different workflows, which when the sync merges, they are both "valid").


    I think the idea to pop a list of the actions that are linked to the invoked hotkey would make it work and would clearly show that we have a conflict, but the wanted action could still be invoked from the popup list. Maybe to make it even clearer, you could add a little mention on the popup that specifies that multiple actions were found using the invoked hotkey...


    For the popup, what I'm thinking is to just pop the normal Alfred search UI, but with the list items set to the conflicted actions (so we can invoke one using CMD+1 or CMD+2 ... or writing its title to filter the list). The problem I'm thinking is how can we get a title, but the Hotkey object doesn't have one... maybe you could use the Workflow Title and with that, maybe you could add a "Label" field to the Hotkey object or use an Object Note as title? With that you could set the item icon to the Workflow icon or add an icon field to the Hotkey object... Maybe those new fields could be grouped and mention that they would be used in case of hotkey conflict.


    I know this may be quite some work to implement the feature, but I think this would be worth it and I think it would actually make it less confusing to every user (new and more experimented ones; I think there were multiple messages here on the forum regarding the confusion of a user regarding why it couldn't use a specific key combination and then later found out it was already used somewhere else). Also, this could be used to implement some kind of modal keybinding.


    To give some more idea... To make it easier to fix those conflicted hotkeys, when on this popup you could set a modifier key that would jump to the selected hotkey object node in its workflow. This way we won't have to search too much to find where it was set.


    So again, just my +1 :)



  4. @Jasondm007, yes that would be great to be able to call directly the File Action, but at the moment I think the only way is doing GUI scripting using AppleScript like @deanishe said or you can implement your own version of the built-in actions using a shell script or AppleScript.


    For the Open With, if you want to avoid the GUI scripting route, you can easily do it using a shell script like:


    open -a "ApplicationName" /Path/To/File


  5. @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! :)



  6. @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.

  7. @cebroski in addition to what @deanishe said, I would recommand to remove also the last part of the scipt so it doesn't close an already opened tab.


    I mean, remove:

    -- close the first default tab
    tell application "System Events"
    	keystroke tab using control down
    	delay 0.2
    	keystroke "w" using command down
    end tell


    However, if I understand well what you want, I think it would be better/easier/faster to use the Alfred's builtin 'Open URL' object. The idea is to have a Keyword object (or another trigger) that connect to 2 'Open URL' objects that send your specific URLs to Firefox.


    Here is an example workflow that should do what you want: https://d.pr/f/jsvmIY

    Make sure to check the "Open links in tabs instead of new windows" in the Firefox Preferences.

  8. @slyfox, yes @deanishe is right about the first example whose passing the Arg & Vars to Alfred, but my second example uses Python.


    Here is the workflow updated again: https://d.pr/f/z8i7VM


    But to put it here in the forum:


    My first one uses an expression in the Arg & Vars (ex: `round(({query}+({query}/0.971))*100)/100` ) and pass it to Alfred using `tell application id "com.runningwithcrayons.Alfred" to search "={query}"`


    My second example uses a Script Filter set to the Python language and what is great is that you can see directly see the output. You can just change the expression at `val = round(query+(query/0.971),2)` to use what you want.


    Here is the script:


    import sys, json
    query = float(sys.argv[1])
    val = round(query+(query/0.971),2)
    data = {'items': [{
        'title': val,
        'subtitle': str(query)+'+('+str(query)+'/0.971)',
    	'arg': val,
        'text' : {
            'copy' : val,
            'largetype' : val


  9. @Twice Bitten, since you are not mentioning which Terminal application you are using, I guess you use Terminal.app. So, to "pass the text into the current Temrinal session window" and keeping your default Terminal integration as it is in Alfred (so you can keep your other action to open a new Terminal Session if you want), you can create a workflow that pass your text to a Run Script object with the script language set to /usr/bin/osascript (AS) and with the script set to:


    on run argv
      tell application "Terminal"
        activate -- comment this line if you don't want to send the Terminal window to front
        do script (item 1 of argv) in tab 1 of window 1
      end tell
    end run

    or if you want to change Alfred's Terminal integration as mentioned by @vitor and use , you can set Alfred to use a Custom terminal application and set the script to :


    on alfred_script(q)
      tell application "Terminal"
        activate -- comment this line if you don't want to send the Terminal window to front
        do script q in tab 1 of window 1
      end tell
    end alfred_script


  10. 6 hours ago, deanishe said:

    There’s a bleep-bloop?


    Huh. I guess I must be blocking that without knowing.


    There's a preference to disable the sound in the Notification Settings at: The Bell Icon (top right corner) -> Notifications Settings -> Notification preferences -> Play a sound when I receive a notification


    @dfay , could this help to uncheck this?

  11. If I get what you want to do, here is an updated workflow: https://d.pr/f/Qy36hV


    In short, you don't need to use the Hotkey object to get the clipboard content or to pop Alfred, but use it simply to launch your workflow. Then, you connect a keyword object to get an Alfred field to write your query and then you append this query + clipboard to your file (the clipboard accessed using the Alfred's clipboard content variable)


    Hope this helps!

  12. 2 hours ago, deanishe said:

    You want a File Filter, which you can then connect to a Terminal Command with the command cd "{query}".


    As @deanishe says, but to simplify the 'connect to a Terminal Command with the command cd "{query}" ', actually with Hyper you can simply do an "open this folder with this application" where "this application" will be Hyper.


    I mean, to build it yourself, just do:

    1. Go inside your Alfred's Preferences at your Workflows tab
    2. Press the [+] button at the bottom of your Workflow list and select: Examples -> Simple Folder Search
    3. Double click the File Filter object and change the keyword to: >find
    4. Click the Save button to save your preferred keyword
    5. Double click the Open File object and drag-and-drop your Hyper.app application into the right drop target (where it says: the default application)
    6. Click the Save button to save your object

    Then, you should be able to invoke >find myproject


    With this you don't even have to change the custom terminal in Alfred and add my script, but if you plan on using Hyper I think it would be useful if you want to invoke Hyper using the Open Terminal Here or other Terminal object of Alfred.

  13. You should be able to use Hyper by using my script that you can find in the attached post. You will need to set Alfred to use a custom terminal (Alfred Preferences -> Features -> Terminal) and paste my script in the bottom text area. Then you should be able to use the Open Terminal Here action from Alfred when inside the File Action menu 



  14. 6 hours ago, ssppjj said:

    I wish Enter key closes the form though. It bums me that I have to click on the button to close this form every time.


    Just press CMD+S again and it should save it.


    I mean:

    1) CMD+S from the Snippet History to pop the Snippet window

    2) CMD+S from the Snippet Window to save the Snippet (which does the same as pressing the Save button)

  15. 1 hour ago, Appu Mohan said:

    Any way to set spark for this (http://www.packal.org/workflow/mailapp-search) work flow ? 


    This is a different problem. This is a workflow that is simply a file scanner that is set to scan a specific kind of files in a specific directory ( ~/Library/Mail ). This is a specific configuration that work with Apple Mail since Mail put its email database inside a folder hierarchy composed of .emlx files which can be directly accessed by Finder.


    Spark uses a different database composed of SQLite files. Therefore, the workflow you are linking (or a modified version) can't be used with Spark and you would need to create a new one that can interface with the SQLite database. If you want to go this route and create your own workflow, you can have a look and find Spark's data folder here: ~/Library/Group Containers/3L68KQB4HG.group.com.readdle.smartemail

  16. @Appu Mohan, some time ago I did a plugin for Spark to work with Alfred. You can have a look at the attached discussion link for the download file and how to install it. But in short, download the applescript file here and drop it into your folder at `~/Library/Application Support/Alfred/Plugins/Email/Spark.applescript`


    Hope this helps!



  17. @Andrew, great addition, thanks! Just played a bit with it and this will be useful, but I was wondering if it would be possible to make it so it filters the list or the Up/Down arrows jump between fields that match the query?


    For example, if I have a Work Phone Number + a Work Address, I could type "work" and use the arrows to jump between those fields.

  • Create New...