Jump to content

GuiB

Member
  • Posts

    366
  • Joined

  • Last visited

  • Days Won

    19

Posts posted by GuiB

  1. I confirm, I'm on 10.11.6 and this is happening on my side as well... I don't know exactly when this happened since I didn't use this feature lately, but I also think this is coming from a Security Update since I just did an update about 1.5 week ago to Security Update 2018-002. I tested with 3.6.2 Pre-Release (Build 915), 3.6.1 (Build 910) and 3.6 (Build 903) and none worked. So yes I think the problem is not caused by an Alfred update, but Apple... Also, I just updated to Security Update 2018-003 and the problem is still there. I hope Apple will fix this soon! :)

  2. The workflow disappear has Alfred didn't see a JSON format string (or XML) as the output of your Script Filter. If you don't want to output JSON/XML than it would be better with a simple Keyword object connected to a Run Script object. Then you will be able to do what you want (but you shouldn't press <enter> on your step 1, but more: 'jjj' <space>).

     

    If you want to do it with a Script Filter, just replace your script with:

     

    import sys, json
    
    query = sys.argv[1]
    
    data = { 'items' : [{
        'title': 'goto collection',
        'subtitle': query,
        'arg': query,
    }] }
    
    sys.stdout.write(json.dumps(data))

     

  3. I would recommend against it since CMD+Q is the native hotkey to close an application in macOS and why Alfred doesn't allow it natively, but there's workaround that you can try. If you want to do it in Alfred, you can create a workflow, add a Hotkey node connected to a Run Script one that ' tell application "Alfred 3" to search ' and that should pop Alfred. However, where is the trick is to set you hotkey since Alfred wouldn't allow it in the Hotkey node, but you need to edit directly the workflow "info.plist" to set manually the hotkey that you want like:

     

    Quote

    <dict>
                    <key>action</key>
                    <integer>0</integer>
                    <key>argument</key>
                    <integer>0</integer>
                    <key>focusedappvariable</key>
                    <false/>
                    <key>focusedappvariablename</key>
                    <string></string>
                    <key>hotkey</key>
                    <integer>12</integer>
                    <key>hotmod</key>
                    <integer>1048840</integer>
                    <key>hotstring</key>
                    <string>Q</string>
                    <key>leftcursor</key>
                    <false/>
                    <key>modsmode</key>
                    <integer>2</integer>
                    <key>relatedAppsMode</key>
                    <integer>0</integer>
                </dict>

     

     

    (See the "hotstring" and "hotmod" keys)

     

     

    Also, other workarounds would be to use another application that would allow to register you hotkey and send a different key combination that you could use in Alfred: Ex: tell the application that when you type "CMD+Q" it sends instead "CMD+ALT+SHIFT+SPACE" and map Alfred to "CMD+ALT+SHIFT+SPACE". I didn't tried it, but Hammerspoon, BetterTouchTool or

    Karabiner may work for this

     

    Please note that for my first idea you would need to buy Alfred to create your workflow and this is mainly a workaround and not sure this will always work, so please if you want to go this route, keep this in mind. Using another application to switch the hotkey would be a safer method if you can make it works and you could try before buying, but as noted above, I would recommend against since this is the shortcut for quitting an application on macOS, but I understand if you've been using it for many years.

  4. @Mightymuke , you are right, I did this node too fast while adding the unicode normalization this week...

     

    Here is a new update with this bug fix: https://nofile.io/f/TocAqvK7JJJ/gbCardhop.alfredworkflow

     

    However, now I have a bigger problem since Cardhop 1.1 added localization and English actions doesn't work when you are in another localization. So, I'll see what could be changed to make it works for everyone (extract all the localized strings from Carhop or maybe ask the Cardhop team if it would be possible to keep the English actions word working in other language (as I think I would prefer this since I'm used to write those kind of actions in English than in French: I'm used to write "mail personName" than "écrire personName", but not sure they would want this))

     

    @cands, you should update to this one to have this bug fix

     

  5. @eternali, you mean the download isn't working on your side ? Or that you are not able to install it in Alfred ? Or that you are not able to configure it to make it work with your own RTF signature ?

     

    Here is a new workflow that use User Environment Variable, so it may be easier for you to figure out where to put your file path.

    https://nofile.io/f/UPw0gDKn82H/Example+-+Rich+Text+Snippet.alfredworkflow

     

    Here are some cues to use it:

     

    To install:

    To Use with a RTF file:
    • Create a new RTF file using Text Edit
    • Save the file somewhere on your computer
    • Open Alfred Workflows and look for the Example - Rich Text Snippet
    • Open the workflow configuration menu (button: "[x]" )
    • Set the "filePathToRTF" variable to the path of your created RTF document
    • Change the snippet to one that you want (double click the first node of the workflow)
    • Then, you should be able to open another application, do you snippet and automatically expand to your RTF content
    For RTFD:
    • Do the same thing as for a RTF file, but save as RTFD and set the "filePathToRTFD" variable to your RTFD document path
  6. @Eukaryote, haha thanks :) Actually, you can make a workflow for Cardhop with just a simple Open URL object and a Keyword object to set a string to send, but I wanted to add more features than simply passing the string to Cardhop ;) Also, I'm sure there could be a method with less connections, but I've been using this kind of message passing with filtering and find it's working quite well.

     

    Best wishes in trying to learn how to make workflows! :)

  7. @cands , yes this was a problem with unicode encoding. Here is a new version that should fix the issue (it's working on my side, let me know if you get any other issues!)

     

    https://nofile.io/f/RtSBb1n8st5/gbCardhop.alfredworkflow

     

    @deanishe, it didn't seem to cause problems with the json output, but more to Cardhop since I tried normalizing the output that sends to Cardhop and it was working as well, but I now normalize the inputs to make sure and it's working also. The problem seemed more that Cardhop want NFC type of unicode or crash

  8. You can also use AppleScript to find the title of the document like that:

    tell application "System Events"
    	tell application process "Atom" to return title of first window
    end tell

     

    If you want to have a more general script that would work with other applications, you can get the window title of the front application like that:

    tell application "System Events"
    	tell (first application process whose frontmost is true) to return title of first window
    end tell

     

    Regarding Atom, note that Atom would return a string that look like "fileName.extension — folderPath" so you can split the string into the fileName and folderPath if needed or get only one part if the other is not needed

  9. Just did some more tests and it seems not all email applications use the "to=" parameter (I'm using Airmail and it won't put the email address with the email put with "to="). So to put a reference of a way that works more generally, just remove the "?to=" and move the "?" after the destination email if you want to add the subject and body fields. Like this:

     

    mailto:destination@email.com
    mailto:destination@email.com?&subject=MySubject&body=MyContent

     

  10. A simple "mailto:" link should work great.

     

    First, make sure Spark is your default email application then:

     

    If you simply want to pop Spark mail with the "To:" field already set then you just have to use an Alfred Open URL node set to (where "destination@email.com" is the email to the person you want to email to) :

    mailto:?to=destination@email.com

     

    If you want to also set the "Subject:" and "Body" field, then use:

    mailto:?to=destination@email.com&subject=MySubject&body=MyContent

    You can use a {query} or environment variable to set any of those fields if you prefer to do it from Alfred than from Spark and Spark will pop with everything set so you can review before sending.

  11. Make sure to reference to the binary in your workflow folder. From your error, it seems that you have a script that look at "/usr/local/Cellar", but you just have to reference to your binary at "./ffmpeg". Think of your workflow folder as your working directory in your script and you should be good if everything look at this directory instead of somewhere else in your computer.

  12. About the Script Filter, I didn't say you needed to assign a variable before using it inside, but more (or what I meant) that you can set the Subtitle string to whatever you want inside the script (so it could be an environment variable, a local variable, a string...). However, for the Keyword and List Filter object, since they don't run a script when you access them, then you need to have set a variable before showing it.


    About the subtitle text when you are searching in Alfred for your workflow, as you said, the output when doing a global search doesn't run your script until you have written your full keyword since this would slow down a lot Alfred since it will execute every script while searching... So you will get many undesirable events. However, Alfred let you assign a subtext for this global search and is the "Placeholder Subtext" field in the Script Filter (3rd line of the Script Filter object). This field works the same way as the field of the same title in the List Filter and the "Subtext" field in the Keyword object. Therefore, it won't be as dynamic as the output of a Script Filter... You can access an environment variable, but you can't output a small script...


    So, in your case about listing the last downloaded file, I don't think you will find an easy way to set this Placeholder Subtext to your file name/path, but if you can set an environment variable before searching for the Workflow Keyword...


    Also, if you don't know this and it's useful to you, note that when searching a keyword you can press tab on your selection (when you are over the keyword line that you want) and Alfred will expand your query to the keyword so you will run your Script Filter and see the output in the Subtitle without activating the workflow.

     

    Hope this helps!

  13. You can set the "Subtitle" field to any Alfred variable to make it dynamic. For example, write "{query}" inside the Subtitle field and you will get your query written in the subtext. For the Keyword and List Filter objects, you would need to have a another entering point to your workflow so you can set your variable before showing it, but if you want it directly written when you write your workflow Keyword, then you'll be better to use a Script Filter so you can run whatever you want to set your subtitle field directly.

  14. @rebdeg, ok, I went back home and had a look at this... it's more complex and I'll give another example if I find a simpler way to do it, but I got it working with some AppleScriptObjC. But in short, on your side you just have to change the file path on the first line and it should work.

     

    Look here for a Workflow as example: https://nofile.io/f/RXhJKD2bpYC/Example+-+Rich+Text+Snippet.alfredworkflow

     

    The main part is this (the AppleScript inside the Run Script is now this):

     

    set theFilePath to "path/to/your/RTFD/file.rtfd"
    
    ------------------------------------
    use framework "Foundation"
    use scripting additions
    
    set pboard to its NSPasteboard's generalPasteboard()
    pboard's clearContents()
    set theURL to its (|NSURL|'s fileURLWithPath:theFilePath)
    set fileWrapper to its (NSFileWrapper's alloc()'s initWithURL:theURL options:0 |error|:(missing value))
    set attrString to its (NSMutableAttributedString's alloc()'s initWithRTFDFileWrapper:fileWrapper documentAttributes:(missing value))
    set theData to attrString's RTFDFromRange:{location:0, |length|:attrString's |length|()} documentAttributes:{DocumentType:"NSRTFD"}
    pboard's setData:theData forType:(its NSPasteboardTypeRTFD)

     

×
×
  • Create New...