Jump to content

Things: Search, Show, and Add Tasks


Recommended Posts

Your screenshot is a bit too small for me to read, but it looks like it's working fine. Where are you seeing a problem?

 

It does not work
The task does not fall into inbox
Edited by Alеx
Link to comment

Okay, the first thing to bear in mind is that there was literally no way for me to determine that from your screenshot. It's not at all helpful to say that something doesn't work without explaining what doesn't work and how it doesn't work.

 

That said, it's possible that the error is an AppleScript problem. It's tended to choke on UTF-8 characters in the past. In that case, it'd be out of my control. You need to change the script action to read python act.py {query} 2>&1 | tee act.log and post the contents of act.log, from the workflow's folder. If there's an error there, I might be able to do something about it.

Link to comment

Okay, the first thing to bear in mind is that there was literally no way for me to determine that from your screenshot. It's not at all helpful to say that something doesn't work without explaining what doesn't work and how it doesn't work.

 

That said, it's possible that the error is an AppleScript problem. It's tended to choke on UTF-8 characters in the past. In that case, it'd be out of my control. You need to change the script action to read python act.py {query} 2>&1 | tee act.log and post the contents of act.log, from the workflow's folder. If there's an error there, I might be able to do something about it.

 

act.log:

Traceback (most recent call last):
  File "act.py", line 48, in <module>
    process()
  File "act.py", line 36, in process
    o = check_output(["osascript", "-e", scpt("parse quicksilver input \"{0}\"".format(inp))])
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)
I added .encode('utf-8') in 36 line and it worked
o = check_output(["osascript", "-e", scpt("parse quicksilver input \"{0}\"".format(inp.encode('utf-8')))])
Perhaps problem was in python 2.7.x
 
Thanks for help (:
Edited by Alеx
Link to comment

Thanks; I changed the version on my server to reflect that, and added encode() statements to the other places where the input showed up. Hopefully that'll hold it for a while. Thanks for your help!

 

In the new version, I get error again:

Traceback (most recent call last):
  File "act.py", line 48, in <module>
    process()
  File "act.py", line 36, in process
    o = check_output(["osascript", "-e", scpt("parse quicksilver input \"{0}\"".format(inp.encode("utf-8")))])
  File "act.py", line 10, in scpt
    end tell'''.format(innards)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd1 in position 25: ordinal not in range(128)

You can add .decode("utf-8") at 10 and 19(?) lines to resolve it

end tell'''.format(innards.decode("utf-8"))

And you made ​​a typo in line 43, so choice of areas and projects will not work

o = check_output(["osascript", "-e", scpt_act("show ({0} named \"{1}\")".format(thing.encode("utf-8", inp.encode("utf-8"))))])
o = check_output(["osascript", "-e", scpt_act("show ({0} named \"{1}\")".format(thing.encode("utf-8"), inp.encode("utf-8")))])
Edited by Alеx
Link to comment
  • 2 weeks later...

Yes. Please right-click on the name of the workflow in your preferences and click "Show in Finder." The file should be in the folder that pops up. Also, I don't know what that "Extensions" folder is about—the workflows are stored in the package Alfred.alfredpreferences. Just a heads-up.

Link to comment

Thank you for the direction; I've included the code below. The "extensions" folder may have inadvertently been created from my first attempts at migrating from Alfred v1.

 

-------------------------------------------------------

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>com.danielsh.alfred.things</string>
<key>connections</key>
<dict>
<key>3EEF5217-86CB-42AB-AE8A-42B54B672E82</key>
<array>
<dict>
<key>destinationuid</key>
<string>AB86BAFD-6FE7-443D-9DE9-0DD80667FB1E</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>AB86BAFD-6FE7-443D-9DE9-0DD80667FB1E</key>
<array/>
</dict>
<key>createdby</key>
<string>Daniel Shannon</string>
<key>description</key>
<string>Search and add to-dos.</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Things</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>escaping</key>
<integer>0</integer>
<key>script</key>
<string>python act.py {query} 2>&1 | tee act.log</string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>AB86BAFD-6FE7-443D-9DE9-0DD80667FB1E</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
<integer>4</integer>
<key>keyword</key>
<string>things</string>
<key>script</key>
<string>python feedback.py "{query}" 2>&1 | tee feedback.log</string>
<key>subtext</key>
<string>Search, add, or edit Things tasks.</string>
<key>title</key>
<string>Things Tasks</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>3EEF5217-86CB-42AB-AE8A-42B54B672E82</string>
</dict>
</array>
<key>readme</key>
<string></string>
<key>uidata</key>
<dict>
<key>3EEF5217-86CB-42AB-AE8A-42B54B672E82</key>
<dict>
<key>ypos</key>
<real>190</real>
</dict>
<key>AB86BAFD-6FE7-443D-9DE9-0DD80667FB1E</key>
<dict>
<key>ypos</key>
<real>190</real>
</dict>
</dict>
<key>webaddress</key>
<string>http://alfred.daniel.sh</string>
</dict>
</plist>
Link to comment

Sorry, that was careless of me. Here's the right stuff:

 

Traceback (most recent call last):
  File "feedback.py", line 126, in <module>
    do_feedback()
  File "feedback.py", line 56, in do_feedback
    things_data = do_things_dump()
  File "feedback.py", line 18, in do_things_dump
    shutil.copyfile(libpath, target)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shutil.py", line 52, in copyfile
IOError: [Errno 2] No such file or directory: '/Users/graphics/Library/Application Support/Cultured Code/Things/ThingsLibrary.db'
Link to comment

Actually, no. Scratch that.

That Dropbox stuff was a Hazel-generated backup. The operating library file was in:

 

/Users/graphics/Library/Application Support/Cultured Code/Things

 

except I had renamed the folder to "Things_miad" in order to differentiate between two different library folders I had setup for Things and Thing Beta (when Things cloud sync was first being tested).

I've just now reverted to the proper name, and I'm pointing Things to the amended folder path.

Link to comment

Somewhat improved results: the workflow displays everything and very quickly, but nothing happens when I hit Enter on any item, nor can I type a unique task that shows up in Things.

 

I understand there may be a few different builds of this workflow. Which would you most recommend?

 

"act.log":

-------------------------------------------------------

 

Traceback (most recent call last):
  File "act.py", line 2, in <module>
    from subprocess import check_output
ImportError: cannot import name check_output
 

-------------------------------------------------------

 

 

"feedback.log":

-------------------------------------------------------

 

<items><item arg="parse "test"" uid="com.danielsh.alfred.things.600126875380" valid="yes"><icon>icon.png</icon><subtitle>test</subtitle><title>Add Task</title></item><item arg="show "to do" "test in browser"" uid="task-test" valid="yes"><icon>/Users/graphics/Dropbox/AppPresets/Alfred v2/Alfred.alfredpreferences/workflows/user.workflow.8BF31F9A-5EC8-4203-BC90-85EA313496F4/images/check.png</icon><subtitle /><title>test in browser</title></item><item arg="show "to do" "testing Things cloud sync "" uid="task-testing" valid="yes"><icon>/Users/graphics/Dropbox/AppPresets/Alfred v2/Alfred.alfredpreferences/workflows/user.workflow.8BF31F9A-5EC8-4203-BC90-85EA313496F4/images/check.png</icon><subtitle /><title>testing Things cloud sync </title></item><item arg="show "to do" "test out Scapple"" uid="task-test" valid="yes"><icon>/Users/graphics/Dropbox/AppPresets/Alfred v2/Alfred.alfredpreferences/workflows/user.workflow.8BF31F9A-5EC8-4203-BC90-85EA313496F4/images/check.png</icon><subtitle /><title>test out Scapple</title></item><item arg="show "to do" "test egg"" uid="task-test" valid="yes"><icon>/Users/graphics/Dropbox/AppPresets/Alfred v2/Alfred.alfredpreferences/workflows/user.workflow.8BF31F9A-5EC8-4203-BC90-85EA313496F4/images/check.png</icon><subtitle /><title>test egg</title></item><item arg="show "to do" "test in browser"" uid="task-test" valid="yes"><icon>/Users/graphics/Dropbox/AppPresets/Alfred v2/Alfred.alfredpreferences/workflows/user.workflow.8BF31F9A-5EC8-4203-BC90-85EA313496F4/images/check.png</icon><subtitle /><title>test in browser</title></item><item arg="show "to do" "test in browser"" uid="task-test" valid="yes"><icon>/Users/graphics/Dropbox/AppPresets/Alfred v2/Alfred.alfredpreferences/workflows/user.workflow.8BF31F9A-5EC8-4203-BC90-85EA313496F4/images/check.png</icon><subtitle /><title>test in browser</title></item><item arg="show "to do" "ask Sister Louise Marie for access to latest newsletters"" uid="task-ask" valid="yes"><icon>/Users/graphics/Dropbox/AppPresets/Alfred v2/Alfred.alfredpreferences/workflows/user.workflow.8BF31F9A-5EC8-4203-BC90-85EA313496F4/images/check.png</icon><subtitle /><title>ask Sister Louise Marie for access to latest newsletters</title></item><item arg="show "to do" "print to encrypt sensitive Evernotes"" uid="task-print" valid="yes"><icon>/Users/graphics/Dropbox/AppPresets/Alfred v2/Alfred.alfredpreferences/workflows/user.workflow.8BF31F9A-5EC8-4203-BC90-85EA313496F4/images/check.png</icon><subtitle /><title>print to encrypt sensitive Evernotes</title></item><item arg="show "to do" "call to get Due Dates for remaining Lawn & Garden Retailer advertisements"" uid="task-call" valid="yes"><icon>/Users/graphics/Dropbox/AppPresets/Alfred v2/Alfred.alfredpreferences/workflows/user.workflow.8BF31F9A-5EC8-4203-BC90-85EA313496F4/images/check.png</icon><subtitle /><title>call to get Due Dates for remaining Lawn & Garden Retailer advertisements</title></item><item arg="show "to do" "print to encrypt sensitive Evernotes"" uid="task-print" valid="yes"><icon>/Users/graphics/Dropbox/AppPresets/Alfred v2/Alfred.alfredpreferences/workflows/user.workflow.8BF31F9A-5EC8-4203-BC90-85EA313496F4/images/check.png</icon><subtitle /><title>print to encrypt sensitive Evernotes</title></item><item arg="show "to do" "print to encrypt sensitive Evernotes"" uid="task-print" valid="yes"><icon>/Users/graphics/Dropbox/AppPresets/Alfred v2/Alfred.alfredpreferences/workflows/user.workflow.8BF31F9A-5EC8-4203-BC90-85EA313496F4/images/check.png</icon><subtitle /><title>print to encrypt sensitive Evernotes</title></item></items>
 

 

 

 

Link to comment

Yes, I'm on Snow Leopard.

 

Thank you for the latest workflow version. I've installed and also run Alleyoop on it to be doubly sure, but to no avail.

I get a full library readout but still cannot add a task.

 

For instance, from this point in the screenshot, hitting Enter closes Alfred's entry window, nothing more.

I would really love for this to work. Did my log data indicate anything amiss?

 

zEuvyTV.png

Link to comment

Apologies: I missed a call to check_output, which was causing the problem in the first place. I didn't realize when I wrote this and another workflow that Snow Leopard shipped with Python 2.6 and that method was added in Python 2.7. Try downloading it now and it should work fine.

Link to comment

Thank you, thank you! Works like a charm. 

Really generous of you to put all this time into fixing for my setup (and others', I expect).

 

Between this and TexExpander, I'm assigning my little Unicode characters tags and filing tasks to Areas at lightning speed!

Link to comment

Thanks for the effort Daniel... so many requests (and here comes one more!) - I am experiencing "cropped" tasks... when adding a new task via alfred, not all text is passed to things. I've tried several tests but still not able to figure out a pattern! Somethings last character is cropped, other times the last 2, sometimes nothing is cropped. Seem not to have to do with the lenght of the text.

 

How can I help identify the problem?

 

Nevermind. I have to be patient! If I write too quickly and hit enter before all text appears in Alfred's window, then it is cropped!

Edited by bmscmoreira
Link to comment

Glad it worked itself out! Yeah, I'm afraid that the script is still a bit sluggish, and I can see why that would happen. If you know that you're going to add a task, you might have better luck prepending a plus sign: if the script detects that the query starts with "+", it skips the more work-intensive data extraction and searching. But I'm going to take a look at its innards right now and see if I can't find another way to speed it up a bit.

Link to comment

Unfortunately, the >+0 syntax is the only way to do it. That syntax is built into Things, and the challenges required for injecting tasks any other way have so far struck me as insurmountable. If I can find a way to make it easier, I'll definitely change it; but for now, that's all you've got.

 

If I use >+0 Things crashes immediately, tried it several times. I use Things 2.2.1, Alfred 2.0.4 with Mac OS 10.8.4.

Edited by Davide
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...