Jump to content

paulw

Member
  • Posts

    158
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by paulw

  1.  

    I made an Automator folder action that processes new apps added to /Applications.

    It looks for apps with the same name in /Applications and its subfolders.

    If it finds an app with the same name in a subfolder of /Applications, it asks if you want to replace the subfoldered app with the newly added one, and does so with shell commands—(moving the app via remove, copy, remove).

     

    Seems to work most of the time. No fancy checks for date or anything like that, just app name. It does fix a problem I've wanted to solve for awhile now, with most dmg's and this workflow leading to app updates always being sent to /Applications and not my organized folder structure.

     

    Here's the link if anyone's interested: https://dl.dropboxusercontent.com/u/5187606/file%20app%20updates%20into%20folders.workflow.zip

  2.  

    Nothing happens when I hit tab.

     

    And also, if I type 'pbtag {tag}' and hit return, I get the same message. If I type 'pbtag {tag} {keyword}' I get internet search fallback immediately after typing any first letter for the keyword.

     

     

    EDIT: This is all because I have tab set as my default "show actions" key in Alfred preferences, instead of right-arrow. If I switch to right-arrow, it works. Do you think there's a way to get around this?

  3.  

    I can't seem to get this workflow to successfully search for anything. Instead, I instantly get taken to the fallback search results, as soon as I type the first letter.

    Starting debug for 'Install Mac Apps'
    
    [ERROR: alfred.workflow.input.scriptfilter] Code 1: Traceback (most recent call last):
      File "actions.py", line 50, in <module>
        apps_list = get_apps()
      File "actions.py", line 43, in get_apps
        apps = get_apps_from_github()
      File "actions.py", line 29, in get_apps_from_github
        response = urllib2.urlopen(request)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 127, in urlopen
        return _opener.open(url, data, timeout)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 410, in open
        response = meth(req, response)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 523, in http_response
        'http', request, response, code, msg, hdrs)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 448, in error
        return self._call_chain(*args)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 382, in _call_chain
        result = func(*args)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 531, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 404: Not Found
    [ERROR: alfred.workflow.input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 4.)'. Row 1, Col 1: 'Document is empty' in XML:
    getting data from github
    [ERROR: alfred.workflow.input.scriptfilter] Code 1: Traceback (most recent call last):
      File "actions.py", line 50, in <module>
        apps_list = get_apps()
      File "actions.py", line 43, in get_apps
        apps = get_apps_from_github()
      File "actions.py", line 29, in get_apps_from_github
        response = urllib2.urlopen(request)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 127, in urlopen
        return _opener.open(url, data, timeout)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 410, in open
        response = meth(req, response)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 523, in http_response
        'http', request, response, code, msg, hdrs)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 448, in error
        return self._call_chain(*args)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 382, in _call_chain
        result = func(*args)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 531, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 404: Not Found
    [ERROR: alfred.workflow.input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 4.)'. Row 1, Col 1: 'Document is empty' in XML:
    getting data from github
    [ERROR: alfred.workflow.input.scriptfilter] Code 1: Traceback (most recent call last):
      File "actions.py", line 50, in <module>
        apps_list = get_apps()
      File "actions.py", line 43, in get_apps
        apps = get_apps_from_github()
      File "actions.py", line 29, in get_apps_from_github
        response = urllib2.urlopen(request)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 127, in urlopen
        return _opener.open(url, data, timeout)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 410, in open
        response = meth(req, response)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 523, in http_response
        'http', request, response, code, msg, hdrs)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 448, in error
        return self._call_chain(*args)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 382, in _call_chain
        result = func(*args)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 531, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 404: Not Found
    
  4. Commands aren't working for me. Flux is at /Applications/Flux.app. Here's the debugger report from typing "flux co":

    Starting debug for 'f.lux'
    
    [ERROR: alfred.workflow.input.scriptfilter] Code 0: 2014-05-12 10:06:21.465 defaults[47405:d07] 
    The domain/default pair of (/Users/paul/Library/Preferences/org.herf.Flux.plist, sleepLate) does not exist
    2014-05-12 10:06:21.604 defaults[47406:d07] 
    The domain/default pair of (/Users/paul/Library/Preferences/org.herf.Flux.plist, under18) does not exist
    2014-05-12 10:06:21.891 defaults[47408:d07] 
    The domain/default pair of (/Users/paul/Library/Preferences/org.herf.Flux.plist, sleepLate) does not exist
    2014-05-12 10:06:22.066 defaults[47409:d07] 
    The domain/default pair of (/Users/paul/Library/Preferences/org.herf.Flux.plist, under18) does not exist
    [ERROR: alfred.workflow.input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 4.)'. Row 1, Col 1: 'Document is empty' in XML:
    Warning: date_sunset(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Users/paul/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.A9644EBB-590C-455C-8F5F-AAEC06E29121/control-functions.php on line 134
    
    Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Users/paul/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.A9644EBB-590C-455C-8F5F-AAEC06E29121/control-functions.php on line 138
    
    Warning: localtime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Users/paul/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.A9644EBB-590C-455C-8F5F-AAEC06E29121/control-functions.php on line 168
    
    Warning: date_sunset(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Users/paul/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.A9644EBB-590C-455C-8F5F-AAEC06E29121/control-functions.php on line 134
    
    Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Users/paul/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.A9644EBB-590C-455C-8F5F-AAEC06E29121/control-functions.php on line 138
    
    Warning: localtime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Users/paul/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.A9644EBB-590C-455C-8F5F-AAEC06E29121/control-functions.php on line 168
    <?xml version="1.0"?>
    <items><item uid="" arg="" valid="no" autocomplete=""><title>Current Color Temp: 2700K (Sunset)</title><subtitle></subtitle><icon></icon></item><item uid="color" arg="color" valid="no" autocomplete="color"><title>Set Current Color Temp</title><subtitle>Either as number or preset.</subtitle><icon></icon></item><item uid="set" arg="set" valid="no" autocomplete="set"><title>Set Preference</title><subtitle></subtitle><icon></icon></item><item uid="disable" arg="disable" valid="yes" autocomplete="disable"><title>Disable for an hour</title><subtitle></subtitle><icon></icon></item><item uid="darkroom" arg="darkroom" valid="yes" autocomplete="darkroom"><title>Enter Dark Room Mode</title><subtitle>You need to have the correct Accessibilty Settings.</subtitle><icon></icon></item><item uid="mood" arg="mood" valid="yes" autocomplete="mood"><title>Enter Mood Lighting Mode</title><subtitle>Don't use this when actively using you computer.</subtitle><icon></icon></item></items>
    
  5. I made an additional change in my version of the script filter on my machine: I want to be able to search for the original term as entered if I don't like the search suggestions. I would have liked to be able to use a modifier key to do that, but couldn't figure out how, since the original {query} is no longer available and has been replaced by the search suggestions.

     

    So I cut out the fallback part of the script (if there are no suggestions) and instead added a first item to the results list that matches the original search term.

    require_once('workflows.php');
    
    $wf = new Workflows();
    $orig = "{query}";
    
    $wf->result( 'ddgignoresuggest', $orig, 'Search DuckDuckGo for '.$orig, 'Search DuckDuckGo for '.$orig.' or search suggestions below', 'icon.png' );
    
    $json = $wf->request( "https://duckduckgo.com/ac/?q=".urlencode($orig));
    $json = utf8_encode($json);
    $items = json_decode($json,true);
    $int = 1;
    foreach($items as $item):
    	foreach($item as $suggestion):
    		$wf->result( $int.'.'.time(), "$suggestion", "$suggestion", 'Search DuckDuckGo for '.$suggestion, 'icon.png'  );
    	endforeach;
    endforeach;
    
    echo $wf->toxml();
    
  6. Okay, I cobbled together something retrieves and parses DuckDuckGo's native search suggestions. Feel free to use it (or improve it) to update your workflow.

    require_once('workflows.php');
    
    $wf = new Workflows();
    $orig = "{query}";
    $json = $wf->request( "https://duckduckgo.com/ac/?q=".urlencode($orig));
    $json = utf8_encode($json);
    $items = json_decode($json,true);
    $int = 1;
    foreach($items as $item):
    	foreach($item as $suggestion):
    		$wf->result( $int.'.'.time(), "$suggestion", "$suggestion", 'Search DuckDuckGo for '.$suggestion, 'icon.png'  );
    	endforeach;
    endforeach;
    
    $results = $wf->results();
    if ( count( $results ) == 0 ):
    	$wf->result( 'ddgsuggest', $orig, 'Search DuckDuckGo for '.$orig, 'No suggested matches, search DuckDuckGo for '.$orig, 'icon.png' );
    endif;
    
    echo $wf->toxml();
    
  7. I dug around in the ddg next code and found the url call for its autocomplete results:

    https://duckduckgo.com/ac/?q=query

    where "query" is whatever you're searching for.

     

    Google's autocorrect results are output as xml, and the workflow is set up to parse that.

     

    DDG's autocorrect outputs a series of strings in curly braces. Maybe someone with php knowhow can adapt the script so it parses DDG's results intead?

     

    Edit: Apparently it's JSON that ddg's autocomplete outputs.

  8. I started using the clipboard-sharing app Command-C and, since it has a url scheme, decided I'd like to use it and Alfred to send dial-able phone numbers to my iPhone.

     

    This version draws on CarlosNZ’s workflow for structure and adapts the ruby script format-us-phone.rb in the Alfred workflow "Funnel" by ctwise.

     

    The script does not filter out phone numbers with letters in them, because it turns out, the iPhone interprets letters in phone numbers correctly.

     
    Note that you'll have to edit the script at this line (near the bottom):
     
    device = "Someone%27s%20iPhone"
    

     

    and replace "Someone%27s%20iPhone" with the name of your device in double quotes (can be an iOS device or another Mac with Command-C running on it).

     
    Please feel free to improve on this workflow!
     
     
     
    Edits:
    3/26/2014: updated to one single ruby script in the workflow, rather than calling a separate .rb file
    3/25/2014: updated to avoid needing to use the clipboard
×
×
  • Create New...