Jump to content

dfay

Member
  • Posts

    1,054
  • Joined

  • Last visited

  • Days Won

    62

Posts posted by dfay

  1. 14 hours ago, GuiB said:

     

    @dfay, your method to output to a file and parse it by splitting it's lines into an array is not so different than to build a string where the files path are delimited by a newline and where an Alfred variable is then set with the content of this string (so kept in memory instead of manipulating a file).

     

    I'd bet that Alfred dumping to a file is faster than starting python and loading two modules....

  2. Well here's what I came up with:

     

     

    File Action (unchanged)

    write the file list to a text file (files.txt)

    List of Actions (unchanged)

    then Run Script:

    #!/usr/bin/python
    
    import sys
    import subprocess
    
    theFiles = open('files.txt', 'r').readlines()
    
    for aFile in theFiles:
    	args = ['/opt/local/bin/tag', '-a', sys.argv[1], aFile.replace('\n','')]
    	p = subprocess.call(args)

     

    In theory, writing to a file might slow things down a tiny bit, but this is a solution that I will be able to come back to in a year and immediately understand again.

     

  3. "if you put the File Filter output into a variable, you end up with a single, TAB-separated string, just like if you try to set a workflow variable to an array" -- did not know that...which shows how few workflows I've actually worked up since Alfred 3 came out....

     

    I agree, the code is not pretty, but it is working for me at the moment with spaces in my tags & filenames.  

     

    Maybe we need a feature request for Alfred to produce a JSON array rather than a tab-delimited list.

  4. Thanks

    Yes, that worked well -- rather than use the multiple pathways in your example, I used a single pipeline:

     

    file action (as original) -> Arg and Vars to set filesList (as original) -> list filter that passes the desired tag as arg -> Arg and Vars object to concatenate {query} {var:filesList} -> run bash script /opt/local/bin/tag -a $1

     

    My OCD wants a native version but this works fine.

  5. I recently wanted to create a file action that would then display a list of tags and allow me to select one to tag the selected file.  I was hoping to model it on the Move To... , Open With... , Copy To.... actions that are built into Alfred, but with my list of tags as the options.  But I realized this isn't possible.

     

    The same functionality has been requested in some other recent threads:

     

     

     

    Basically the structure be

     

    File action (with selected file) -> embedded List Filter (displayed in Alfred file actions pane, to get second parameter) -> action

     

     

  6. Back to the discussion of why people use Pinboard....because del.icio.us went yahoo and mag.nol.ia had an irrecoverable data loss....

     

    I started using delicious about 12 years ago when I wanted a way to sync my bookmarks in Opera for win xp with my new iMac.  Switched to Pinboard a couple years later and never looked back.  Even though I’ve been off Windows since 2006 or so I’d never consider leaving now, mostly because of the tag-based organization - vastly preferable to folders for reference materials.

  7. Unfortunately there's no real Google Scholar API (there are a few homemade attempts on GitHub but they rely on scraping the web page results and break easily) so there's no immediate way to get results in a form Alfred can parse and display.  

     

    But if you just want to launch a search the basic custom search is just http://scholar.google.com/scholar?q={query}

     

    In practice, the results are good enough that I use advanced search maybe once every six months (and I probably use Google Scholar at least a dozen times a day).

     

    If you want to go for advanced search you'll need to parse the query string in a workflow -- see 

    an example.

     

  8. Rather than split hairs over a few keystrokes, wouldn’t it be easier to just embed your content in PowerPoint or Keynote or whatever you use for your presentations so you don’t have to worry about switching apps when you’re presenting?  I switch to show PDFs once in a great while (using Skim in its presentation mode) but I can’t imagine going to a Word document in front of an audience....  

     

    Incidentally I built this which you may find useful: 

     

    http://www.packal.org/workflow/skim-remote

  9. Hi Rob

    I am getting the same issue described above with uo .  

     

    Also using any of u ug uf us throws a KeyError: 'displayName'

     

    full message here:

    [2017-10-28 10:51:16][ERROR: input.scriptfilter] Code 1: ulysses_items.py:124: SyntaxWarning: assertion is always true, perhaps remove parentheses?
      assert (os.path.exists(args.limit_scope_dir),
    10:51:15 workflow.py:2249 DEBUG    workflow version: 1.0.0
    10:51:15 workflow.py:1657 DEBUG    reading settings from /Users/usernamehere/Library/Application Support/Alfred 3/Workflow Data/com.github.robwalton.alfred-ulysses-workflow/settings.json
    10:51:15 workflow.py:2532 DEBUG    Update check not due
    10:51:15 ulysses_items.py:57 INFO     ulysses_items.main(wf): args = 
    Namespace(kind='sheet', limit_scope_dir=None, query='', search_content=False, search_ulysses_path=True)
    10:51:15 workflow.py:1884 DEBUG    loading cached data: /Users/usernamehere/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.github.robwalton.alfred-ulysses-workflow/__workflow_update_status.cpickle
    10:51:15 workflow.py:2462 DEBUG    update_data: {u'available': False}
    10:51:15 ulysses_items.py:82 INFO     Added iCloud items from '/Users/usernamehere/Library/Mobile Documents/X5AZV975AG~com~soulmen~ulysses3/Documents/Library/Groups-ulgroup'
    10:51:16 ulysses_items.py:82 INFO     Added iCloud Inbox items from '/Users/usernamehere/Library/Mobile Documents/X5AZV975AG~com~soulmen~ulysses3/Documents/Library/Unfiled-ulgroup'
    10:51:16 workflow.py:2267 ERROR    'displayName'
    Traceback (most recent call last):
      File "/Users/usernamehere/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A4FD89F-3A79-4823-934E-855B611DA3DD/workflow/workflow.py", line 2260, in run
        func(self)
      File "ulysses_items.py", line 85, in main
        include_sheets)
      File "ulysses_items.py", line 145, in parse_ulysses_for_groups_and_sheets
        groups_tree = parse_ulysses.create_tree(root_dir, None)
      File "/Users/usernamehere/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A4FD89F-3A79-4823-934E-855B611DA3DD/parse_ulysses.py", line 113, in create_tree
        group = Group(rootgroupdir, parent_group)
      File "/Users/usernamehere/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A4FD89F-3A79-4823-934E-855B611DA3DD/parse_ulysses.py", line 63, in __init__
        join(self.dirpath, 'Info.ulgroup'))['displayName']
    KeyError: 'displayName'
    10:51:16 workflow.py:2269 INFO     for assistance, see: https://github.com/robwalton/alfred-ulysses-workflow
    10:51:16 workflow.py:2290 DEBUG    workflow finished in 0.313 seconds

     

  10. I haven’t done any more work on the Ulysses workflow - but I’ve been using it many times a day with no problems - until earlier today, actually.  I had to reset LaunchServices to clear up some Quicklook problems (cf. 

     ) and it broke my custom url handler as a result.  Fortunately reopening the applet directly from /Applications re-registered it and got it working fine again.

     

     

  11. You need to view the source of the page and look for the name attribute of the search text entry box itself.  

     

    In this case it's here:

     

    <form class="header-search-form" id="searchForm1" action="https://papers.ssrn.com/sol3/results.cfm" method="post" target="_top" name="formQuickSearch">
    <i class="icon icon-gizmo-search" role="button" aria-label="Search eLibrary"></i>
    <input type="text" class="header-search-input" aria-label="Search eLibrary" placeholder="Search eLibrary" name="txtKey_Words" id="txtKeywords" required>
    <input type="hidden" name="isQuickSearch" value="true">
    </form>

     

    Unfortunately with all the JavaScript cluttering most web pages, it's become a bit harder to reverse engineer searches this way compared to 10-15 years ago when the web was s lot cleaner.

×
×
  • Create New...