Jump to content

Spritzr: an Alfred Speed-Reading workflow


Recommended Posts

Spritzr
an Alfred Speed-Reading workflow
 
Current Version 1.0
Available on Packal

spritzr.png
 
Spritzr is a relatively simple workflow that allows you to speed-read text on your Mac using Spritz-style techniques. The simple idea is that one word of your input text is displayed at a time in quick enough succession that you are no longer Sub-Vocalizing, which is the largest impediment to reading at a comfortable, yet swift pace. The added layer of nuance, however, is that each word is positioned around the so-called Optimal Reading Position. To borrow an image from the Spritz website, the difference between most electronic speedreaders and Spritz-style speedreaders is the alignment of the words:
word_positioning_blog3.png

This workflow achieves a similar affect, thus making reading simpler and faster.

NOTICE: I wrote all of this software from scratch and have no affiliation with the Spritz company. I was inspired by other open-source projects that attempt to mirror the Spritz functionality: OpenSpritz and spritz-cmd, but this software bares no relation to Spritz aside from appearances.

Spritzr currently only has one command: spritz. This takes text input which will be parsed and displayed in the Spritzr window.

spritzr.png

Alternatively, you can pass text files (.txt, .md, .mmd) into Spritzr using the File Action File Spritzr. This will parse and display the text content of that file in the Spritzr window.

spritzr_file.png

There are two settings, which can be changed using the spritzr:set keyword:

  • Words per Minute
  • Reading Mode

If you which to change your wpm, simply invoke spritzr:set and input an integer (the default is 250). If you which to change the reading mode, invoke spritzr:set and input either dark or light (the default is light).

Dark Mode:
spritzr_dark.png

Light Mode:
spritzr_light.png

Other than that, you can just start spritzing!

Edited by smarg19
Link to comment

I can not get it to work. It produces:

 

[ERROR: alfred.workflow.action.script] Code 1: /Users/raguay/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-aries/bundler.sh: line 20: [: too many arguments

17:58:07 workflow.py:1265 ERROR    [Errno 2] No such file or directory: u'/Users/raguay/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-aries/assets/utility/viewer/default/viewer.app --args/Contents/document.wflow'

Traceback (most recent call last):

  File "/Users/raguay/Dropbox (Personal)/Richard/rag/Alfred/Sync/Alfred.alfredpreferences/workflows/user.workflow.9B0CF2BF-6F91-49A4-9159-61EB9F48F9D0/workflow/workflow.py", line 1263, in run

    func(self)

  File "spritzr.py", line 290, in main

    Spritzr(args[0], wpm, wf).read()

  File "spritzr.py", line 77, in read

    self.prepare_viewer()

  File "spritzr.py", line 151, in prepare_viewer

    viewer_info = plistlib.readPlist(viewer_plist)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 75, in readPlist

    pathOrFile = open(pathOrFile)

IOError: [Errno 2] No such file or directory: u'/Users/raguay/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-aries/assets/utility/viewer/default/viewer.app --args/Contents/document.wflow'

Link to comment

I can not get it to work. It produces:

 

[ERROR: alfred.workflow.action.script] Code 1: /Users/raguay/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-aries/bundler.sh: line 20: [: too many arguments

17:58:07 workflow.py:1265 ERROR    [Errno 2] No such file or directory: u'/Users/raguay/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-aries/assets/utility/viewer/default/viewer.app --args/Contents/document.wflow'

Traceback (most recent call last):

  File "/Users/raguay/Dropbox (Personal)/Richard/rag/Alfred/Sync/Alfred.alfredpreferences/workflows/user.workflow.9B0CF2BF-6F91-49A4-9159-61EB9F48F9D0/workflow/workflow.py", line 1263, in run

    func(self)

  File "spritzr.py", line 290, in main

    Spritzr(args[0], wpm, wf).read()

  File "spritzr.py", line 77, in read

    self.prepare_viewer()

  File "spritzr.py", line 151, in prepare_viewer

    viewer_info = plistlib.readPlist(viewer_plist)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 75, in readPlist

    pathOrFile = open(pathOrFile)

IOError: [Errno 2] No such file or directory: u'/Users/raguay/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-aries/assets/utility/viewer/default/viewer.app --args/Contents/document.wflow'

Hmm... I'm using the Alfred Bundler to get this utility, and I'm not sure why it's not downloaded. It should download on the first run (so the first run takes a bit of extra time), but then should work smoothly from then on.

Could you open the workflow folder, open the test_space.py in an editor and just paste this code in then run it. Tell me what happens then:

from workflow import bundler
bundler.utility('viewer')
This is what should download the viewer app.
Link to comment

It then gives:

 

/Users/raguay/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-aries/bundler.sh: line 20: [: too many arguments
/Users/raguay/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-aries/bundler.sh: line 20: [: too many arguments
22:22:26 workflow.py:1265 ERROR    'modes'
Traceback (most recent call last):
  File "/Users/raguay/Dropbox (Personal)/Richard/rag/Alfred/Sync/Alfred.alfredpreferences/workflows/user.workflow.9B0CF2BF-6F91-49A4-9159-61EB9F48F9D0/workflow/workflow.py", line 1263, in run
    func(self)
  File "test_space.py", line 20, in main
    print wf.settings['modes']
KeyError: 'modes'
Link to comment

Since the bundler isn't my area of expertise, I'm not entirely sure what the problem is. But I suspect it may be a minor versioning issue. Try going to $USER/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-aries and deleting that entire folder (that is, the alfred.bundler-aries folder). Once it's deleted try to run that test_space.py code again (also, you can delete everything in that code and just paste in these two lines:

from workflow import bundler
print bundler.utility('viewer')
The other stuff in that code is unnecessary. It will take a bit of time for the bundler to install itself and get going, but hopefully a fresh start will get things working properly.
Link to comment

Hey Smarg,

 

I tried to run the workflow, but I'm getting this error: (I edited out my short name)

 

<?xml version="1.0" encoding="utf-8"?>
<items><item valid="no"><title>Error in workflow 'com.hackademic.spritzr'</title><subtitle>[Errno 13] Permission denied: u'/Users/xxxx/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-aries/assets/utility/viewer/default/viewer.app/Contents/document.wflow'</subtitle><icon>/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns</icon></item></items>
 
I got this error by adding a "copy to clipboard" output to the workflow when it wouldn't work. Any ideas?
I tried the method you gave to raguay, and the bundle downloaded fine. It just will not run. 
Link to comment
This appears to be an issue with Gatekeeper settings. To be honest, Gatekeeper is a real bugaboo. I've tried to set things up to circumvent this, but it's quite complicated. 

 

Did this error only pop up after you added the copy to clipboard? If so, the simple reason is that there is nothing to copy. Could you remove that option and try to run the workflow as is with the debugger on and report that error?

Link to comment

 

This appears to be an issue with Gatekeeper settings. To be honest, Gatekeeper is a real bugaboo. I've tried to set things up to circumvent this, but it's quite complicated. 
 
Did this error only pop up after you added the copy to clipboard? If so, the simple reason is that there is nothing to copy. Could you remove that option and try to run the workflow as is with the debugger on and report that error?

 

Starting debug for 'Spritzr'

[INFO: alfred.workflow.trigger.action] Processing output 'alfred.workflow.action.script' with arg '(
    "/Users/xxxx/Downloads/Seven.Speed.Reading.2014.v14.3.Mac/Instructions.txt"
)'
[ERROR: alfred.workflow.action.script] Code 1: 11:28:09 workflow.py:1265 ERROR    'utf8' codec can't decode byte 0x92 in position 695: invalid start byte
Traceback (most recent call last):
  File "/Users/xxxx/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.B221076E-3705-4AC6-B44F-3BDC6C817DC9/workflow/workflow.py", line 1263, in run
    func(self)
  File "spritzr.py", line 286, in main
    article = wf.decode(file_obj.read())
  File "/Users/xxxx/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.B221076E-3705-4AC6-B44F-3BDC6C817DC9/workflow/workflow.py", line 1496, in decode
    text = unicode(text, encoding)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 695: invalid start byte
[INFO: alfred.workflow.action.script] Processing output 'alfred.workflow.output.clipboard' with arg '<?xml version="1.0" encoding="utf-8"?>
<items><item valid="no"><title>Error in workflow 'com.hackademic.spritzr'</title><subtitle>'utf8' codec can't decode byte 0x92 in position 695: invalid start byte</subtitle><icon>/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns</icon></item></items>'
Link to comment

This is a somewhat odd error. It means that this text file is encoded oddly. Can you open up Terminal and use this command to try and see the character encoding for thatInstructions.txt file:

file -I {filename}

For {filename} put the full path to that file.

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...