Jump to content

Weaselboy

Member
  • Posts

    58
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by Weaselboy

  1. Hey Weaselboy, thanks for the debug info. That helped a lot!

    I've updated the workflow and improved the authentication process.

     

    Could you give it another try? And could you open your keychain and check if there is an entry 'com.fniephaus.pocket'.

     

    Thanks!

     

    That fixed it!   :)

     

    I deleted the Keychain entry and installed the updated workflow and it works perfectly. Nice work on this and thanks.

  2. Ed3KO9p.png

     

    Fabio-- I'm getting this error after installing your workflow and the first attempt at running. The debug info from Alfred is below. I just edited out my username. I have a valid Pocket account and can login to it with no problem in Safari. Any suggestions?

     

    Thanks

    Starting debug for 'Pocket for Alfred'
    
    [ERROR: alfred.workflow.input.scriptfilter] Code 1: 08:53:53 workflow.py:967 DEBUG    get_password : com.fniephaus.pocket:pocket_access_token
    08:53:53 workflow.py:967 DEBUG    get_password : com.fniephaus.pocket:pocket_access_token
    08:53:53 workflow.py:967 DEBUG    get_password : com.fniephaus.pocket:pocket_access_token
    08:53:53 connectionpool.py:635 INFO     Starting new HTTPS connection (1): getpocket.com
    08:53:53 connectionpool.py:344 DEBUG    "POST /v3/get HTTP/1.1" 401 16
    08:53:53 workflow.py:843 ERROR    Problem authenticating the user. A valid access token is required to access the requested API endpoint.
    Traceback (most recent call last):
      File "/Users/edit/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.9AFC12F4-2304-40BB-9DBC-427C3585C487/workflow/workflow.py", line 841, in run
        func(self)
      File "pocket_alfred.py", line 20, in main
        'pocket_list', data_func=get_list, max_age=1)
      File "/Users/edit/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.9AFC12F4-2304-40BB-9DBC-427C3585C487/workflow/workflow.py", line 602, in cached_data
        data = data_func()
      File "pocket_alfred.py", line 42, in get_list
        get = pocket_instance.get()
      File "/Users/edit/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.9AFC12F4-2304-40BB-9DBC-427C3585C487/pocket.py", line 57, in wrapped
        return self.make_request(url, payload)
      File "/Users/edit/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.9AFC12F4-2304-40BB-9DBC-427C3585C487/pocket.py", line 154, in make_request
        return cls._make_request(url, payload, headers)
      File "/Users/edit/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.9AFC12F4-2304-40BB-9DBC-427C3585C487/pocket.py", line 147, in _make_request
        '%s. %s' % (error_msg, extra_info)
    AuthException: Problem authenticating the user. A valid access token is required to access the requested API endpoint.
    
  3. Hi,

     

    Unless Chrome is already opened, the workflow opens Chrome, but does not open the Safari url/active tab.

     

    Is this a problem with the workflow, or something on my end?  :ph34r:

     

    I use the below Applescript in a workflow to open the front Safari tab in Chrome and it seems to work fine for me whether Chrome is active or not.

     

    I can't recall where I found this, or I would give credit, but I have been using this since the early days of Alfred 1.

    on alfred_script(q)
    tell application "Safari" to set currentURL to URL of current tab of window 1
    tell application "Google Chrome"
    	activate
    	if not (exists window 1) then make new window
    	tell window 1
    		if URL of active tab is "chrome://newtab/" then
    			set URL of active tab to currentURL
    		else
    			make new tab with properties {URL:currentURL}
    		end if
    	end tell
    end tell
    end alfred_script
    
  4. PR> I use an Applescript (below) to do this. Everything above that "System Events" line will be hidden, and apps launched below that line will not be. So in my example, everything but Safari is hidden.

     

    on alfred_script(q)
    tell application "Mail" to launch
    tell application "Messages" to launch
    tell application "Calendar" to launch
    tell application "iTunes" to launch
    tell application "Contacts" to activate
    tell application "Reeder" to activate
    activate application "Finder"
    tell application "System Events" to keystroke "h" using {command down, option down}
    tell application "Safari" to activate
    end alfred_script
    
  5. I'm assuming this may be done with an applescript or something like that, but could someone give me some guidance as to how I could empty the Downloads folder with a workflow? 

     

    I have a workflow that runs this bash script to empty the DL folder to the trash.

    mv ~/Downloads/* ~/.trash/
    
  6. David-- Just so I understand, if I use the current, built in "restart" Alfred system command with the relaunch box already unchecked, I would get the same behavior as this workflow?

     

    It appears the upside to the workflow is if one wanted to leave the box normally checked, but wanted to restart on occasion without a relaunch. Have I got that right?

     

    I always have the box unchecked, but once in a while that choice is ignored and apps relaunch. I know in other forums many users have this same problem (I understand this is not an Alfred problem/bug). I am wondering if using your workflow would force the no relaunch consistently and get around this OS X bug. Seems like it would.

  7. Megan-- I have had the same thing happen a time or two with different apps. Even a Spotight reindex did not fix it for me either. I ended up deleting the app, then reinstalling it and for whatever reason Spotlight picked it up after that. Last time was with the cookbook app Paprika. I have no idea why this happens, but a delete and reinstall fixed it.

  8. I'm not sure what you are doing differently than me, but I only get one Terminal window with this. ?

     

    I have it with a keyword and no argument straight to the Applescript.

     

     

     

    on alfred_script(q)
    tell application "Terminal"
    do script "drutil cdtext"
    activate
    end tell
    end alfred_script

    screenshot20130203at955.png

  9. I bet it is running and you just don't know it.  :)

     

    On you second one... you could make a Workflow like this with Applescript that would pop up a Terminal with your results.

     

    Or you could use the one you have with the bash script and have it output to "large type" in the workflow. That will popup a text window with the results.

     

     

     

    tell application "Terminal"
    activate
    do script "drutil cdtext"
    end tell
  10. Let me try and help you out.

     

    In the Workflows pane click the plus at the bottom then select Templates/Essentials/Keyword to Script. That will start out a blank workflow for you like in my screenshot.

     

    screenshot20130203at649.png

     

    Now double click the keyword section and enter whatever keyword you want... "compact" maybe? Also in that box select that you want no argument.

     

    Now double click the run script box. Just paste your script in there and save.

     

    That should do it. Now enter compact in Alfred and enter, then your script should run.

     

    You can make it nicer by changing the workflow name and with a custom icon if you like.

×
×
  • Create New...