Jump to content

dfay

Member
  • Posts

    1,054
  • Joined

  • Last visited

  • Days Won

    61

Posts posted by dfay

  1. it's not the most graceful way to do it but Finder doesn't let you Applescript saved searches (my first thought for a solution).  Unfortunately since it relies on scripting keystrokes, you may need to lengthen the delays for it to work.  Even with delay 3 instead of delay 1 it's not working consistently for me.  

  2. It came up in the comments here - http://www.alfredforum.com/topic/4700-searchio-auto-suggestion-from-search-engines-in-different-languages/ - and ended up getting nixed....but that involved putting the output from a bunch of search engines into a script filter.  You just want to open a bunch of tabs with the same search term on different search engines, right?

     

    This is actually very easy to do - here is a workflow to get you started.  Basically you have a keyword which gets your query and outputs it to multiple Open URL actions.  The Open URL object in the workflow includes the documentation on how to figure out a search URL.  Alfred's Open URL actions also let you browsers other than the default if you prefer.

     

    https://dl.dropboxusercontent.com/u/6601556/Alfred/Multisearch.alfredworkflow

  3. I am a college professor, and most of my use of Alfred is for research / bibliographical / writing purposes, but I have a workflow that I update / duplicate each quarter to automatically open materials related to whatever course I am teaching.  Overall it looks like this:

     

    Keyword (some abbreviation for the course)

    -->

    Multiple Files - this launches all the folders with my syllabus, grade books, slides, slides from previous versions of the course that I may be cutting/pasting from, etc.

    --> 

    Run Script - this is an Applescript with two parts:

    1) open my current syllabus and automatically go to the date of the next upcoming class - you can find this here: https://github.com/derickfay/course-creator

    2) arrange the files / windows that I just opened according to a corresponding Moom ( http://manytricks.com/moom/ ) template

     

    I also use my Keynote to PDF workflow (linked from http://dfay.fastmail.fm.user.fm/alfred/ also in these forums somewhere) after every class to prepare my slides for posting to course web sites.

     

    None of these are particularly tied to Alfred - they could all be accomplished by independent Applescripts, but Alfred 1) makes them readily available and 2) with Dropbox syncing, makes them available on all three Macs that I use on a regular basis without worrying about syncing Library or other script folders.

  4. I got this to work by changing the Run NSAppleScript to the less foolproof but working:

     

    on alfred_script(q)

    tell application "Microsoft Word" to set documentName to path of active document as alias
    tell application "Finder" to open the container of documentName
    end alfred_script
     
    the other code that I deleted from Shawn's version was checking if Word was active but in my testing it never returned True, so it never actually ran the two tell statements above.
  5. Yeah, the author would need to have a copy of Logic Pro.  Applescript UI scripting can be a messy, hard-to-debug process, but it does let you do things you can't do otherwise.  Here are two resources that I have found essential for figuring out exactly which UI elements scripts should refer to:

     

    http://apple.stackexchange.com/questions/40436/how-to-know-the-name-of-ui-elements-using-accessibility-inspector-or-any-other

     

    http://hints.macworld.com/article.php?story=20111208191312748

     

    I generally use the latter (the script in the hint) more than the former.

  6. I have accomplished this but it's a two step process, one outside of Alfred, one within.  First was to follow these directions (which work with AnyConnect - I had it working before my office switched to AnyConnect and the setup still works):

     

    http://anders.com/guides/native-cisco-vpn-on-mac-os-x/

     

    then once I had the VPN set up as a native OS X VPN, I used this workflow:

     

    http://www.alfredforum.com/topic/1053-vpn-toggle/

  7. Following up a request re: my Case Converter workflow, I've put together a case converter focused on code.

     

    Updated 2021-08-04 to use Universal Actions - now requires Alfred 4.5 beta.

     

    It's hosted on Packal: Code Case

     

    There is a single script filter codecase which converts the argument
     
    e.g.
     
    codecase.png.9abc0521d2c0925906f5d0c309ed3f7b.png
     
    and copies it to the clipboard.
     
    The example shows a space delimited argument, but it will also convert between any of the cases, e.g. Camel -> Pascal, so
     
    codecase myGreatVariableName
     
    will return
     
    my_great_variable_name
     
    etc.
     
    The workflow also contains blank hotkeys for each of the conversions (set up to act on selected text and paste into the frontmost app). 
     
     
    Revisions:
     
    1.4 (2021-08-04) updated to use Universal Actions, requiring Alfred 4.5 beta.  Also added more fun Space Case icon.
     
    1.2.1 (2014-08-29):
    - updated to use Alfred Workflow 1.8.6
    1.2 (2014-08-29):
    - added hotkeys
     
    1.1 (2014-08-29):
    - added Cobra Case (capitalized Snake Case) and separate words
    - added uids so Alfred will sort results based on frequency of usage
  8. Funny I was thinking of writing something like this myself a few days ago, but decided against it b/c I didn't think Alfred was the right vehicle given the need to enter recipients, subject and message.

     

    But - if you want to try to use this script - those directions leave out a critical step.  After you copy the quickmessage.py file in place, you need to change the file permissions to make it executable.  In Terminal cd into that directory then use the command chmod 755 quickmessage.py (brief discussion of permissions here: https://www.linode.com/docs/tools-reference/modify-file-permissions-with-chmod ).  

     

    A couple other issues I see with this approach are that 1) (trivially) line 4 should be smtpServer not smptServer and 2) (more seriously) this script requires you to hard-code your e-mail password in plain text.  Also 3) as written the script requires you to install python 3 which isn't installed on Mavericks by default.

  9. Very cool.  This seems to work with multiple dictionaries in different places in the same document, too.  Which led me to add this Applescript in another keyword ( I used sd ) in the workflow:

    on alfred_script(q)
      set theEntry to "^^^" & q & "^^^"
    end alfred_script
    

    piped out to the clipboard & pasted in current document.  Thus rather than wait for a free moment I can insert the dictionary entries immediately after the first time I use the abbreviation and don't need to remember to do so later.

     

    The only issue I see with this is that if an entry is defined twice with different definitions, it uses the last one in the file.

     

    I also edited the snip bash script to be the following:

    osascript -e 'tell application "System Events" to keystroke "a" using command down'
    osascript -e 'tell application "System Events" to keystroke "c" using command down'
    python snippets.py "{query}"
    

    to automate the gathering of the text and copying to the clipboard.

  10. This is a bit of an aside - let me take off the Alfred hat and put on the professor hat for a minute....

     

    I wouldn't go near DevonThink - it's overkill for bibliographies on one hand, and it doesn't have the library/database integration that dedicated bibliographic software has.

     

    But I'd also never try to manage PDFs just with the file system.  I have about 5000 PDFs indexed in a library in BibDesk (even though I don't write in BibTeX) that originally began 20 years ago as a 400-item Paradox database (in the days of WordPerfect) when I was a 1st year grad. student.  If you are serious about an academic career, you should be using some bibliographic management software -- if I were to start now, I might do it in Zotero rather than BibDesk but the formats are generally exportable/importable relatively easily (see http://en.wikipedia.org/wiki/Comparison_of_reference_management_software ).  The sooner you start doing it, the better - right now you may have one list that you want to maintain of things to read, but soon enough you will have lists by courses you are taking and/or teaching, for comps, for research proposals, articles, thesis, second book, etc.  And a lot of your PDFs are going to belong in more than one of those places.  If you're annotating your PDFs, you don't want multiple copies...so you can create aliases (and now tags, which helps but doesn't solve all the problems) in the file system.

     

    So for keeping a reading list -- my BibDesk library at the moment has about 10 static folders titled "_current.project_name" for various articles and book chapters.  Each of those has the full biblio for the selected project.  Publications are tagged "to read" if I haven't read them.  So depending on the project I am working on, I can filter the project biblio by the tag "to read."  And this is all exposed to Applescript (one of the great things about BibDesk).  So -- say you have set up a smart group for all of the publications you have added in the last month, and those are what you want to be reading from -- you could put this script in an Alfred workflow:

     

    tell application "BibDesk"

     

    activate

     

    tell document 1

    select group "added in last month"

    select (search for "to read")

    end tell

    end tell

     

    and it would automatically give you your reading list.  Yes, you could do this with smart folders and Mavericks tags, but when the day comes that you want to write and cite some of the documents you've been reading, having it all indexed in biblio. software will make it much less painless.  Especially if you are submitting to journals with different citation formats.  It may seem like more work up front, but Google Scholar and all of the big academic databases let you download the citation info.  If I am going to read something related to my research, chances are it's worth being able to find it again, so it's worth the minute or two that it takes to get it into the database up front.  Just start with what you are currently reading, then you can catch up on the rest later.

     

    Also...looking at your 1st post - with BibDesk at least the PDF files can remain exactly where they are, and you can set it up to auto file new PDFs according to a customizable naming convention - mine are filed in folder by first letter of author's last name, then author date title.pdf .  So everything is still easily findable if you're not using your biblio software.

     

    Anyway, there's my unsolicited advice - same advice I give my grad. students - the long-term payoff is greater & the work is less the sooner in your career you start using biblio. software.

×
×
  • Create New...