Jump to content

Subject22

Member
  • Posts

    171
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by Subject22

  1. On 7/31/2019 at 9:04 PM, Chris Spiegl said:

    Hi @Subject22, I sent you a private message with the new version. Please test it and update your main download if everything works out normally. I don't want to provide a secondary download here because it can get way too confusing by doing so, having the current version be represented in the main forum post is best I think.

     

    Thanks! Unfortunately I took too long to get to it and the file transfer expired. Instead I’ve put the workflow on GitHub (and added a link to the first post). Please feel free to fork the repo and/or submit a pull request. I will endeavour to keep the first post in this thread in sync with the GitHub repo.

  2. I made a similar workflow a while back and managed to bolt together a script filter which lets Alfred tell you if hidden files are currently visible or if they're hidden. This may or may not be useful to you :)

    #!/bin/sh
    
    #check the current value and display the result as subtitle
    CURVALUE=$(defaults read com.apple.finder AppleShowAllFiles -bool)
    
    if [ $CURVALUE = 0 ]; then
    	subtitle="Hidden files are currently invisible"
    else
    	subtitle="Hidden files are currently visible"
    fi
    
    echo '<?xml version="1.0"?><items>'
    echo "<item arg=\"{query}\" uid=\"ssid\" valid=\"yes\">"
    echo "<title>Toggle hidden files</title>"
    echo "<subtitle>$subtitle</subtitle>"
    echo "<icon>icon.png</icon></item></items>"
    echo "</items>"
    
  3. Yes, there is. There's some additional logic in the script I took that snippet from. I pause iTunes, play a sound file, and then resume iTunes, but only if it was playing to start with. That's why I need to control playback within the script (I need to know if iTunes was playing to start with before I tell it to start playing again).

    There are some fairly nasty workarounds that I can think of, but what I really want to know is why the script can't control iTunes when called from the shell. It's very irritating!

    Cheers for the reply :)

  4. This isn't directly related to Alfred, but I need to call an Applescript in one of my workflows (I can't run it directly from the workflow because reasons) and for some reason it's not working. Here's the relevant snippet.

    if application "iTunes" is running then
    	tell application "iTunes"
    		set state to (get player state as string)
    		if state is "playing" then pause
    	end tell
    end if
    
    

    When I run that from Script Editor everything works just fine (iTunes pauses if it was playing, if it was running). But if I save that as a script and run it from Bash with osascript my_script.scpt nothing happens. No error message, nothing. iTunes keeps on playing.

     

    Anyone have any wisdom they can impart?

  5. Me too :D. For anyone who has the same problem, I found a more permanent solution than switching networks.

     

    In Alfred Preferences go to the Advanced tab and tick "Use OS X http proxy settings for scripts". Then head over to System Preferences>Network select the relevant network in the sidebar and then go to Advanced>Proxies. Enable "Web Proxy (HTTP)" and enter your proxy settings (if they don't appear automatically). Hit OK and apply your new network settings. You may or may not need to restart Alfred to get everything working.

  6. I just gave this workflow a shot and see <urlopen error [Errno 61] Connection refused> in Alfred. I don't have time to poke around at the moment, but I wonder if it could be an API key issue? Or perhaps there are some restrictions on my network that I don't know about. I haven't had trouble with other workflows though. Anyhoo, I thought I'd let you know in case it's something obvious :)

    Cheers!

     

    EDIT: Here's the dump from Alfred's script debugger.

    [ERROR: alfred.workflow.input.scriptfilter] Code 1: 14:29:55 workflow.py:1972 DEBUG    Workflow version : 2.1.0
    14:29:55 workflow.py:1990 ERROR    <urlopen error [Errno 61] Connection refused>
    Traceback (most recent call last):
      File "/Users/curtisan/Dropbox/Stuff/Alfred Preferences/Alfred.alfredpreferences/workflows/user.workflow.32CEBDB1-9C78-47F5-A3FA-1121F372809C/workflow/workflow.py", line 1983, in run
        func(self)
      File "media.py", line 48, in main
        configuration = wf.cached_data('tmdbconfig', wrapper, max_age=604800)
      File "/Users/curtisan/Dropbox/Stuff/Alfred Preferences/Alfred.alfredpreferences/workflows/user.workflow.32CEBDB1-9C78-47F5-A3FA-1121F372809C/workflow/workflow.py", line 1616, in cached_data
        data = data_func()
      File "media.py", line 46, in wrapper
        return get_tmdb_configuration(api_key)
      File "media.py", line 80, in get_tmdb_configuration
        return web.get(url, params).json()
      File "/Users/curtisan/Dropbox/Stuff/Alfred Preferences/Alfred.alfredpreferences/workflows/user.workflow.32CEBDB1-9C78-47F5-A3FA-1121F372809C/workflow/web.py", line 540, in get
        auth=auth, timeout=timeout, allow_redirects=allow_redirects)
      File "/Users/curtisan/Dropbox/Stuff/Alfred Preferences/Alfred.alfredpreferences/workflows/user.workflow.32CEBDB1-9C78-47F5-A3FA-1121F372809C/workflow/web.py", line 528, in request
        return Response(req)
      File "/Users/curtisan/Dropbox/Stuff/Alfred Preferences/Alfred.alfredpreferences/workflows/user.workflow.32CEBDB1-9C78-47F5-A3FA-1121F372809C/workflow/web.py", line 211, in __init__
        self.raw = 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 404, in open
        response = self._open(req, data)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 422, in _open
        '_open', req)
      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 1214, in http_open
        return self.do_open(httplib.HTTPConnection, req)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1184, in do_open
        raise URLError(err)
    URLError: <urlopen error [Errno 61] Connection refused>
    14:29:55 workflow.py:2008 DEBUG    Workflow finished in 0.061 seconds.
    
  7. Hey Andrew, on a related note I feel that the contextual menu for Run Workflow Trigger in the Remote section of Alfred Preferences could get quite cluttered. By the time I have 50 workflows all offering remote triggers things are going to get quite out of hand! Before I updated to 2.6 I was kind of expecting some sort of drag and drop interface.

    Just some random ramblings :)

×
×
  • Create New...