Jump to content

dfay

Member
  • Posts

    1,054
  • Joined

  • Last visited

  • Days Won

    62

Posts posted by dfay

  1. You need to add one of the metadata keys -- I think it's kmdItemContent -- in order for file filters to search contents.

    I just use Spotlight if I need to search within a file -- I used to have Alfred set to search all file contents (not the default) but turned it off a couple of years ago b/c I realized I wasn't using Alfred primarily to search documents, but to launch apps and workflows etc. But I have also accumulated documents in so many different formats over the years that in practice I rarely want to restrict file type.

    I think for most users Alfred is not a Spotlight replacement but a complement, adding a ton of capabilities on top of the same index that Spotlight uses.

  2. This problem is b/c smargh's Applescript action_pdf-splitter.scpt in the workflow bundle calls /System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py , an embedded script in one of the stock Automator actions.  Unfortunately this Automator action doesn't seem to work in El Cap.

     

    if you open action_pdf-splitter.scpt in Script Editor and comment out the line

     

    -- tell application "Finder" to delete (every item of (cache_path as alias))

     

    you can look in the workflow cache directory ~/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.hackademic.skimmer and you'll find the PDFs for individual pages there.  You can then combine them in Preview or using Automator's New PDF from Images action

     

    * on further testing the script in the Combine PDF Automator action works fine with most PDFs, just not the ones generated by the Skim Applescript.  But the New PDF from Images action works.  Go figure.

     

    I edited the (*HANDLERS*) section of the script as shown below:

    on combinePDFPages(_title, cache_path, temp_path, orig_path)
    	--convert AS paths to POSIX paths
    	set orig_posix to (POSIX path of (orig_path as alias)) as string
    	set temp_posix to (POSIX path of (temp_path as alias)) as string
    	
    	--prepare final PDF file path
    	set _file to orig_posix & _title & "_split.pdf"
    	
    	(*	--combine ALL individual PDF pages into new, single PDF
    	do shell script "\"/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py\" -o " & (quoted form of POSIX path of _file) & space & (quoted form of temp_posix) & "*.pdf"
    	
    	--delete the individual page PDFs
    	tell application "Finder" to delete (every item of (cache_path as alias))
    	
    	--open new PDF
    	set _file_ to ((POSIX file _file) as alias)
    	tell application "Skim"
    		open _file_
    		go front document to page 1 of front document
    	end tell *)
    	
    	tell application "Finder" to open (cache_path as alias)
    	
    end combinePDFPages
    

    basically replacing the actual combining of PDFs with opening a Finder window to the folder where all the individual pages are stored.  I use this infrequently enough that I'll just proceed manually from there.

  3. You can use Applescript to test which machine a workflow is running on, and alter workflow behavior on that basis.  e.g. here is one I use with Chronosync, where the CS files have different names based on the machine:

    	set theComp to computer name of (system info)
    	tell application "ChronoSync"
    		if theComp contains "laptop" then
    			open "~/archive/laptop to USB.sync"
    		else if theComp contains "home desktop" then
    			open "~/Documents/ChronoSync Documents/home <> USB.sync"
    		else if theComp contains "work desktop" then
    			open "~/archive/atu-childermas.sync"
    		else if theComp contains "another computer" then
    			open "~/ChronoSync Documents/another cs doc.sync"
    		end if
    		Trial Sync document 1
    	end tell
    
    
    

    Also - in this example - I have a post-synchronization script set up in Chronosync which writes the date & time to a dotfile in Dropbox which my Alfred workflow reads in a script filter, so it comes up with the title "Chronosync Current Machine" and a subtitle like "Last run on Work Desktop, 2016-06-24 3:50 PM"  Basically writing a dotfile to save the last run date instead of saving it as a variable within the workflow, and to make it available easily to scripts that aren't part of the workflow.

  4. Here's a more detailed description of how to set this up - this still relies on the clipboard but it doesn't affect clipboard history, and allows to select text and hit a hotkey rather than going through the manual steps you describe:

     

    create a new blank workflow

     

    add a hotkey, and select Action: Pass through to workflow and Argument: Selection in OS X

     

    add a run script action with the following config set in the dropdowns:

     

    Language: /bin/bash

    with input as argv

     

    for the script you can use

    query=$1
    
    echo -n "<strong>"$query"</strong>"

    Then add a Copy to Clipboard action with {query} in the text box and both checkboxes below checked.

     

    then connect them all and add your hotkey

  5. create a trigger that connects to the following applescript:

    tell application "iTunes"
    	set loved of current track to true
    end tell
    

    This didn't used to work with Apple Music, but it does now.

     

    Adding an Apple Music track throws up error "iTunes got an error: current track doesn’t understand the “add” message." number -1708 from current track

     

    So that's not easily possible at the moment.  

  6. Another simpler if quirky option is to just give all the workflows the same name, then when they all show up in Alfred's results, use the command-number keys to select. I currently have seven different keywords named bib for various BibDesk and citation scripts, & this works fine for me. I suppose you could do this now by just typing 10k and using command-number as your submenu.

  7. This forum has seen a lot of posts recently (including my own) which are basically geared towards allowing Alfred to replace TextExpander in the wake of the Smile pricing/sync kerfuffle -- ideas like allowing tabs/form filling, input within snippet expansion, snippets triggering workflows/scripts, case sensitivity in snippets, etc.

     

    Thinking about what it would take for me to be able to replace the 250+ snippets I have in TE with Alfred snippets, there are two killer features....1) is snippets to trigger scripts (mostly for date math)....I suspect this is in the works....2) is the ability to use my snippets on iOS.  As far as I've seen, this hasn't come up, but it seems like an area where Alfred could really raise the bar.  Smile has a pretty widely adopted API ( https://smilesoftware.com/textexpander-ios/apps) but the TE keyboard itself is pretty slow and generic.

     

    So I'd like to see an Alfred iOS keyboard, either as part of Alfred Remote or a separate app.  It could just do snippet expansion on iOS using Alfred's synced snippets.  If it could run scripts, this would be even better.  And for the icing on the cake, maybe it could communicate with Alfred on OS X, run a query and return the results (the kind of two-way communication I think people were hoping to see emerge with Alfred Remote).

     

    OR....now that Smile has lowered their price on TE 6 to $20/year for existing users, and $40/year or so for new users, maybe it would make sense to not invest development resources into snippets.  For me at least (as an existing user) the revised TE pricing makes switching a lot less urgent and compelling -- the main concern is the need to rely on Smile's sync service.

     

    Hence the subject line....if Alfred is going to go all in with snippets and replace TextExpander, it seems like an iOS keyboard is going to be necessary for many users....if that's not on the roadmap, it might not be worth prioritizing snippet features.

     

    Thoughts?

  8. You can create multiple keywords for workflows already.  Just add an additional keyword object and link it to the same outputs as the existing keyword.

     

    Keywords in Alfred's window aren't case sensitive.  

     

    But you're right, snippets only allow a single case-sensitive keyword as it stands now.

     

    Re: conflicts with existing words, I'd recommend pursuing an approach that uses punctuation or double letters to avoid that possibility.  The approach I've been using for the last couple years is the dot notation described here: https://medium.com/@zholmquist/textexpander-abbreviations-b8e094526bfd#.ib6susgdv 

  9. If I read your intention correctly, you can create a new workflow trigger that does nothing but post a notification, then call that via Applescript instead of using "display notification"

     

    It'll look something like 

     

    tell application "Alfred 3" to run trigger "xxxxx" in workflow "xx.x.x.x.x" with argument xxxx

     

    ​but the workflow trigger object will give you the exact code

  10. What I did was to look for the block of html in the source that had the advanced search form, which was here:

    <!-- CONTENT ELEMENT, uid:61050/text [begin] -->

    <div id="c61050" class="csc-default">

    <!-- Text: [begin] -->

    <p class="bodytext"><a href="https://search.ebscohost.com/login.aspx?direct=true&authtype=ip,guest&custid=s8336272&setup=1&groupid=main&profile=eds"title="Ouvre un lien externe dans une nouvelle fenêtre" target="_blank">Recherche avancée</a></p>

    <!-- Text: [end] -->

    </div>

    <!-- CONTENT ELEMENT, uid:61050/text [end] -->

    and then add the &bquery element that we saw in the earlier cryptic URL to the URL in that <a> tag above.

  11. The easiest way to figure out a search URL is to do a search, then dissect the URL that displays the search result.

    So if I search for Bourdieu , that library produces a URL with a lot of cruft:

    https://eds.a.ebscohost.com/eds/results?sid=a907e052-7b42-4396-af76-278c2c68a208%40sessionmgr4001&vid=0&hid=4203&bquery=Bourdieu&bdata=JmNsaTA9RlQxJmNsdjA9WSZsYW5nPWZyJnR5cGU9MCZzaXRlPWVkcy1saXZl

    So the next step is to try stripping out everything but the query.

    unfortunately the simplest form

    https://eds.a.ebscohost.com/eds/results?bquery=Bourdieu

    results in an Internal Server Error

    and the other catalog link under the Catalogue Crésus produces URLs that don't have the query encoded.

    ...

    I thought this was going to be an easy question, since I've done this with a dozen or so university libraries before....but the catalog servers you are dealing with here are not so amenable to the usual approach.

    The next step is to start looking at the <form> tag within the underlying html and trying to reconstruct the URL that the page submits to the server to generate the search results.

×
×
  • Create New...