OneNote Tips

Open new window^M
open existing note as SideNote^M, F11
Open new SideNoteWinkey-N, N
  • Some useful enhancements to OneNote: OneTastic

Places Where Windows Commonly Runs Things From the Registry

Windows auto-runs things from your Startup folder (see Start/All Programs/Startup) when you login to Windows. It also runs things via the registry.

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run*
  • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run*
  • HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run* (Note: This one is relevant for running 32-bit programs on 64-bit Windows.)

There are others, but these are the common ones.

Voice Control and the Connected Home

A man signed up for the ‘connected home’ with voice control.

As he was leaving his bedroom, in order to extinguish the overhead light, he said, “Lights off!” The overhead light turned off, but a table lamp turned on.

He repeated himself: “Lights off!” The overhead light turned on and the table lamp turned off.

He repeated himself: “Lights off! Off. Off! OFF!”

One at a time, each of his connected clothes hangers dropped its garment to the ground.

(This is not original. I do not remember the origin.)

How to install Edimax EW-7811UTC AC600 Wireless USB - Linux Ubuntu (Lubuntu 15.04)

sudo apt-get update
sudo apt-get install linux-headers-generic build-essential git 
git clone https://github.com/gnab/rtl8812au.git
cd ~/rtl8812au
make
sudo make install
sudo modprobe 8812au

Worked for me 2015.05.20.

Fluid.app Tips

I wasn’t using Fluid. I was a heavy Chrome user and I opened many, many tabs and pinned them. That worked well for me except that Chrome started draining my battery too fast. Firefox wasn’t any better. Safari seems to be less demanding on my battery, but it won’t pin tabs and, in general, it doesn’t work so well with many tabs open. So I’m using Fluid apps in order to move my constantly-present tabs into apps.

  • With Google Voice, it will show a cut-down page, missing some elements. It also adds a funky mini-menu across the top. To fix this:
    • Select the app-name menu item (“Google Voice” is what I named the app, but yours may be different)
    • Choose “User Agent” and then choose Safari.
  • I wanted two different icons for two different Gmail accounts. There are two strategies. One is to give each Fluidapp its own cookies and give each app the URL https://mail.google.com/mail. The other is to let the apps share cookies and give one the URL https://mail.google.com/mail/u/0/ and the other https://mail.google.com/mail/u/1/. The problem with the second approach is that it assumes that you ALWAYS sign in to one account before signing in to the other. I prefer consistency, so I paid the $5 to buy the ability to give each app its own cookies.
    • When you create the app with Fluid.app, give the URL https://mail.google.com/mail and pick one of the icons from http://om.id.au/gmail-icons-for-use-with-fluid-app-in-multiple-colours/
    • Open your app, open the Preferences pane, navigate to the Security tab, and choose “Separate from Safari” cookie storage.
    • Restart the app, and login to the desired Google account.
    • Note: The disadvantage of the separate cookies approach is that you must sign in to each app (Voice, Calendar, Mail) separately. Since I use 2-factor, this is a royal pain every 30 days. I may revisit my decision and go back to the login-to-accounts-in-same-sequence approach.
  • I also wanted to block inline adds with my RSS reader.
    • Window » UserStyles
    • Add a site name to the left column.
    • In the right column (upper area), set the URL pattern to mysitename.com
    • In the right column (lower area), paste the content of http://www.floppymoose.com/userContent.css
    • I had to add the following line to the user style (near the similar lines)

    A:link[HREF*=”da.feedsportal.com”] IMG,

Change the user agent for a Fluid app:

You’ll read about changing it via the app-name » User Agent menu. That doesn’t appear to persist between app restarts. Here’s how I changed it:

  • Right-click on app-name.app and Show Package Contents
  • Edit resources/UserAgentStrings.plist and replace the string under the value under Default Fluid App

Make Nirvana (nirvanahq.com) work as a fluid app:

It redirects to a login page, and the login page opens in your default browser (Chrome/Safari/Firefox/etc). When you login in the browser, that does not put a cookie in Fluid and Fluid is still not logged in.

  • Launch the created app.
  • Nirvana » Preferences » Whitelint (the red heart icon)
  • Double-click on the first blank line and enter: *www.nirvanahq.com*
  • Close and re-launch Nirvana.

Visual Studio 2013 Community Edition Install Fails/Crashes

I was totally unable to get the install for Visual Studio 2013 to run to completion. I kept running it. It kept running a little farther than the previous time and silently quitting. There are 3 parts to the answer:

  1. Download and install the 8 GB DVD ISO file from VisualStudio.com. Do not use the much smaller online installer.
  2. After it appears to run to completion, there will still be a vs_community.exe plus two “vs…KB…..” processes running in task manager. Let them run to completion.
  3. Then reboot and it will complete installation.

Make GMail the Default Email Client for mailto URLs in Chrome

  • Open a window in Chrome and load GMail in it
  • Press Ctrl+Shift+J (or Cmd+Opt+J on a Mac) to open Chrome’s JavaScript console
  • Paste this code into the JS console

    navigator.registerProtocolHandler(“mailto”,”https://mail.google.com/mail/?extsrc=mailto&url=%s”,”Gmail”);

  • It will tell you “undefined”.
  • Open a new window in Chrome and open your Gmail in it.
  • Look in the address bar, at the right edge. There will be a double diamond. Click it.
  • Chrome will ask you if you really want Gmail to handle your email. Tell it ‘yes.’

To-do Again (February 2015 Edition)

I’m tweaking my task management system again. I’ve been using Nirvana. I got really good at capturing everything into it. Then I got so much stuff in it that I just couldn’t bear to look at it.

I thought to myself, “Self, you need more powerful tools. So I wrote an AppleScript to import my Nirvana data into OmniFocus. Then I realized that I still had too much ‘stuff’ in it, so I needed to get my fuzzy, non-committed stuff off my plate. The canonical way to do that would be to dump my stuff into OmniOutliner. Then I started thinking that this was getting to be entirely too complex

Maybe I could keep all my stuff in OmniFocus, and use two contexts: “@yes” and “@no”. “@yes” would be stuff I’m really going to do. “@no” would be all the stuff that could have gone into OmniOutliner. Since OmniFocus has filter-by-context and also a no-context context, I could ensure everything was tagged (contexed).

This just feels too complex. If I explained it to my wife, she’d ask why I was making it so complicated. How would I do task management without a computer? I’d use a big notebook or index cards. The problem with a notebook is that it is a chore to move a task from one page/section to another. I also like the ability of an outliner to fold pieces of the outline, so I can focus on an area.

  • I could use Circus Ponies Notebook. There is still friction in moving lines around, but copy/paste is easier than re-writing pages. Getting new items into Circus Ponies isn’t something I can do from a command line, and that’s important to me. Bring-to-foreground doesn’t happen. They sync due dates to Calendar, but that’s not what I’m looking for. You can tell it to sync those with Calendar/Reminders, but you have to sync it and it doesn’t change the presentation in Notebook.
  • I can get things into Evernote or OmniFocus or OmniOutliner from a command line. Evernote has outlines, but no folding; and Evernote’s presentation leaves a lot to be desired. Evernote is my file cabinet, not my notebook. I’d never attempt to manage my tasks via a file cabinet.
  • I think I need sub-projects/folders. Projects have sub-projects in real life. Maybe I could manage the sub-projects outside of my task manager?
  • Some people like nvAlt. It is a lovely piece of software. It doesn’t do outlining and it doesn’t move things to the foreground at a future date.
  • The thing I like about a real task manager (such as OmniFocus), is that I can tell it to move an item into the foreground at a future date. That’s important.

Simplicity. Foldable outline. Bring to foreground on a date (start date and deadline). Easy capture. Sub-projects. I don’t think I can get all of these.

Work-arounds:

  • I have a strong preference for simple, because complex just might not happen.
  • Foldable outline: I have to have this, but I might not have to have it in my task manager. I could just put tasks in my task manager, and keep projects and sub-projects in my project support repository.
  • Start/Due dates: I could put these in the calendar. I might have to shuffle tasks around in my task manager on the start/due date. This is bad because you might update the task but forget to update the calendar item.
  • Easy capture: I could capture in a million different ways. The issue is easily entry of the items into my task manager (or my stuff repository, if it isn’t actionable yet). Copy/paste is high friction. Easy entry includes entry from my Mac and my PC.

Any way I go, I must have a good project support system and stuff repository, separate from the task manager.

  • Notebook gets simplicity, outline, repository. It misses on dates and easy entry. You’ll have to use the calendar for dates.
  • OmniFocus misses on simplicity. It has everything else if I use Notebook or OmniOutliner for project support.
  • nvAlt gets simplicity, misses on outlines, misses on dates (No, searching for a date tag doesn’t suffice.), easy capture.
  • Evernote gets simplicity, misses outlines, gets dates (via reminders and shuffling the items), and easy capture. But it has 10,000 other things in it. Big cringe factor.

OK. I’m going to have to use OmniFocus and hope that complexity fades with experience. I can combine it with Evernote, OmniOutliner, Notebook, or even OneNote for project support.

Principle: Evernote is my filing cabinet (and for a few other items that I must have on all my platforms). That leaves OO, Notebook or OneNote for project support. If I need to put project support into the file cabinet at the end of a project, I can print to PDF and load the PDF to Evernote. I don’t like OneNote on the Mac because it uses solely cloud storage.

OO or Notebook? I like Notebook. Really, I do. But I keep thinking I’ve found a use for it and then I discover it doesn’t really work for me. My concern here is the lack of AppleScript or API support. Without that, the data is locked up in Notebook. I think I’m going to want scripts to shuffle stuff between my task manager and my project/stuff support system.

I could move stuff from Notebook to OF by selecting the item and using Alfred to cut it and paste it into the OF inbox. Because my capture goes to the OF inbox, I’m going to need to move from OF into my support system. Often. That points to OO.

Ohmygosh. I just discovered nvremind. nvAlt can do dates, albeit somewhat roughly. It still misses outlines. Maybe combine nvAlt with Notebook? No. It is just too unstructured. And I still couldn’t move stuff into Notebook.

Wait. Wait. There is a way to move stuff into Notebook. They call it a “clipping service.” Maybe I could use two clipping services – one for uncommitted stuff and one for project support. With OO, I could do something more refined (as in move from OF to OO ).

Convert Nirvana to OmniFocus

I have been using Nirvana for my task list. I’d like to try OmniFocus. To get there, I had to convert my data.

First step is to export Nirvana data to CSV from their web site. The export isn’t perfect. They don’t identify which reference-items belong to which reference lists, for example.

Then import, using the following AppleScript. IT isn’t perfect, but it is a good start.

set theFile to (choose file with prompt "Select input file:" of type {"csv"})

global myOnHold, myActive, myDone, singletonProject, whenCowsComeHome
set taskLimit to 99000
set whenCowsComeHome to date "Thursday, December 31, 2099 at 1:00:00 PM"

set RefListName to "Reference Lists"
set RefListManualName to "Reference Item to Manually Move to Reference List"
tell application "OmniFocus"
	set myOnHold to on hold
	set myActive to active
	set myDone to done
end tell

set progress total steps to 1
set progress additional description to "Starting up"
-- set progress completed steps to 1

-- First item is just column names, and it may contain a UTF BOM
set firstTime to true
set debugging to false
set myCounter to 1

set refList to mkFolder(RefListName)
set refListBad to mkProject(RefListManualName, myOnHold, "")
set singletonProject to mkProject("Miscellaneous", myActive, "")
tell application "OmniFocus" to tell default document to set singleton action holder of singletonProject to true
tell application "OmniFocus" to tell default document to set default singleton action holder of singletonProject to true

-- I use att and kpk as "Areas of Responsibility"
set kpkList to mkFolder("kpk")
set attList to mkFolder("att")

set csvText to csvToList(read theFile, {})
set progress completed steps to 1

set progress total steps to count of csvText
set progress additional description to "Projects"

with timeout of 300 seconds
	
	---------------------------------------------------------------------
	-- first time through, create projects
	---------------------------------------------------------------------
	repeat with anItem in csvText
		if not firstTime then
			set {aType, aParent, aState, aCompleted, aFocus, aName, aTags, aTime, aEnergy, aWaitingFor, aStartDate, aDueDate, aNotes} to text items of anItem
			if aType is "Project" and aState is not "Trash" then
				if aState = "" then
					-- these are reference lists (Standalone), or items within reference lists (Standalone*).
					if aParent = "Standalone" then
						set newProj to mkProject(aName, myOnHold, aNotes)
						-- handleFocus(aFocus, newProj)  -- I do not focus my reference lists
						-- handleCompleted(aCompleted, newProj)  -- reference lists never get marked complete!
						moveItemToFolderName(newProj, RefListName)
					end if
				else
					set newProj to mkProject(aName, nirvanaStatusToOmniFocus(aState), aNotes)
					handleFocus(aFocus, newProj)
					handleCompleted(aCompleted, newProj)
					
					-- I use att and kpk as "Areas of Responsibility"
					set splitTags to split(aTags, ",")
					if splitTags contains "att" then
						moveItemToFolderName(newProj, "att")
					else if splitTags contains "kpk" then
						moveItemToFolderName(newProj, "kpk")
					end if
				end if
			end if
		end if
		set firstTime to false
		set progress completed steps to myCounter
		set progress additional description to "Projects, record " & myCounter as text
		set myCounter to myCounter + 1
	end repeat
	
	-- display dialog "Completed projects.  Continue to Tasks?" giving up after 30000
	
	set firstTime to true
	set myCounter to 1
	set progress total steps to count of csvText
	set progress additional description to "Tasks"
	
	---------------------------------------------------------------------
	-- next time through, create tasks
	---------------------------------------------------------------------
	repeat with anItem in csvText
		if not firstTime then
			set {aType, aParent, aState, aCompleted, aFocus, aName, aTags, aTime, aEnergy, aWaitingFor, aStartDate, aDueDate, aNotes} to text items of anItem
			if aState is not "Trash" then
				if aType is "Project" and aState is "" and aParent is "Standalone*" then
					-- these are reference lists (Standalone), or items within reference lists (Standalone*).
					--				display dialog "adding reference item:" & aName giving up after 30000
					tell application "OmniFocus" to tell refListBad to set newTask to make new task with properties {name:aName, defer date:whenCowsComeHome}
					-- handleCompleted(aCompleted, newTask) -- do not "complete" reference list items.
					-- handleFocus(aFocus, newTask)  -- I do not focus my reference lists.
					moveTaskToProjectBasedOnTag(newTask, aTags)
					
				else if aType is equal to "Task" then
					set newTask to mkTask(aName, aParent, aState, aTags)
					handleFocus(aFocus, newTask)
					handleStartDate(aStartDate, newTask)
					handleDueDate(aDueDate, newTask)
					handleTaskNote(aNotes, newTask)
					if aState is "Someday" and aStartDate is "" then
						tell application "OmniFocus" to tell default document to set defer date of newTask to (current date) + weeks * 56 + (days * (random number from 1 to 30))
					end if
					if aState is "Inactive/Later" and aStartDate is "" then
						tell application "OmniFocus" to tell default document to set defer date of newTask to (current date) + (days * 14) + (days * (random number from 1 to 7))
					end if
					handleCompleted(aCompleted, newTask)
				end if
			end if
		end if
		set firstTime to false
		set progress completed steps to myCounter
		set progress additional description to "Tasks, record " & myCounter as text
		set myCounter to myCounter + 1
		if myCounter > taskLimit then
			display dialog "Quit early at task limit" giving up after 30000
			error number -128
		end if
	end repeat
	display dialog "Caution.  \nThe repeat pattern on repeating tasks is not exported by Nirvana, so I can't import that.  These items have had ' #REPEATING' appended  to the subject.\r\n\n* Nirvana does not export sequetian/parallel.  All projects have been marked sequential (because I'm feeling overwhelmed).\n* Tags have been dropped, because OmniFocus does not do tags.\n* Someday tasks are brought in with a start date of now + 13 months plus a random number of days (so you don't have to deal with them all at once)\n* 'Later' tasks come in as startDate of now + 2 weeks plus a small random number of days." giving up after 30000
end timeout

(* 
  From Nigel Garvey at http://macscripter.net/viewtopic.php?id=32322 ...
  Assumes that the CSV text adheres to the convention:
   Records are delimited by LFs or CRLFs (but CRs are also allowed here).
   The last record in the text may or may not be followed by an LF or CRLF (or CR).
   Fields in the same record are separated by commas (unless specified differently by parameter).
   The last field in a record must not be followed by a comma.
   Trailing or leading spaces in unquoted fields are not ignored (unless so specified by parameter).
   Fields containing quoted text are quoted in their entirety, any space outside them being ignored.
   Fields enclosed in double-quotes are to be taken verbatim, except for any included double-quote pairs, which are to be translated as double-quote characters.
       
   No other variations are currently supported. *)

on csvToList(csvText, implementation)
	-- The 'implementation' parameter must be a record. Leave it empty ({}) for the default assumptions: ie. comma separator, leading and trailing spaces in unquoted fields not to be trimmed. Otherwise it can have a 'separator' property with a text value (eg. {separator:tab}) and/or a 'trimming' property with a boolean value ({trimming:true}).
	set {separator:separator, trimming:trimming} to (implementation & {separator:",", trimming:false})
	
	script o -- Lists for fast access.
		property qdti : getTextItems(csvText, "\"")
		property currentRecord : {}
		property possibleFields : missing value
		property recordList : {}
	end script
	
	-- o's qdti is a list of the CSV's text items, as delimited by double-quotes.
	-- Assuming the convention mentioned above, the number of items is always odd.
	-- Even-numbered items (if any) are quoted field values and don't need parsing.
	-- Odd-numbered items are everything else. Empty strings in odd-numbered slots
	-- (except at the beginning and end) indicate escaped quotes in quoted fields.
	
	set astid to AppleScript's text item delimiters
	set qdtiCount to (count o's qdti)
	set quoteInProgress to false
	considering case
		repeat with i from 1 to qdtiCount by 2 -- Parse odd-numbered items only.
			set thisBit to item i of o's qdti
			if ((count thisBit) > 0) or (i is qdtiCount) then
				-- This is either a non-empty string or the last item in the list, so it doesn't
				-- represent a quoted quote. Check if we've just been dealing with any.
				if (quoteInProgress) then
					-- All the parts of a quoted field containing quoted quotes have now been
					-- passed over. Coerce them together using a quote delimiter.
					set AppleScript's text item delimiters to "\""
					set thisField to (items a thru (i - 1) of o's qdti) as string
					-- Replace the reconstituted quoted quotes with literal quotes.
					set AppleScript's text item delimiters to "\"\""
					set thisField to thisField's text items
					set AppleScript's text item delimiters to "\""
					-- Store the field in the "current record" list and cancel the "quote in progress" flag.
					set end of o's currentRecord to thisField as string
					set quoteInProgress to false
				else if (i > 1) then
					-- The preceding, even-numbered item is a complete quoted field. Store it.
					set end of o's currentRecord to item (i - 1) of o's qdti
				end if
				
				-- Now parse this item's field-separator-delimited text items, which are either non-quoted fields or stumps from the removal of quoted fields. Any that contain line breaks must be further split to end one record and start another. These could include multiple single-field records without field separators.
				set o's possibleFields to getTextItems(thisBit, separator)
				set possibleFieldCount to (count o's possibleFields)
				repeat with j from 1 to possibleFieldCount
					set thisField to item j of o's possibleFields
					if ((count thisField each paragraph) > 1) then
						-- This "field" contains one or more line endings. Split it at those points.
						set theseFields to thisField's paragraphs
						-- With each of these end-of-record fields except the last, complete the field list for the current record and initialise another. Omit the first "field" if it's just the stub from a preceding quoted field.
						repeat with k from 1 to (count theseFields) - 1
							set thisField to item k of theseFields
							if ((k > 1) or (j > 1) or (i is 1) or ((count trim(thisField, true)) > 0)) then set end of o's currentRecord to trim(thisField, trimming)
							set end of o's recordList to o's currentRecord
							set o's currentRecord to {}
						end repeat
						-- With the last end-of-record "field", just complete the current field list if the field's not the stub from a following quoted field.
						set thisField to end of theseFields
						if ((j < possibleFieldCount) or ((count thisField) > 0)) then set end of o's currentRecord to trim(thisField, trimming)
					else
						-- This is a "field" not containing a line break. Insert it into the current field list if it's not just a stub from a preceding or following quoted field.
						if (((j > 1) and ((j < possibleFieldCount) or (i is qdtiCount))) or ((j is 1) and (i is 1)) or ((count trim(thisField, true)) > 0)) then set end of o's currentRecord to trim(thisField, trimming)
					end if
				end repeat
				
				-- Otherwise, this item IS an empty text representing a quoted quote.
			else if (quoteInProgress) then
				-- It's another quote in a field already identified as having one. Do nothing for now.
			else if (i > 1) then
				-- It's the first quoted quote in a quoted field. Note the index of the
				-- preceding even-numbered item (the first part of the field) and flag "quote in
				-- progress" so that the repeat idles past the remaining part(s) of the field.
				set a to i - 1
				set quoteInProgress to true
			end if
		end repeat
	end considering
	
	-- At the end of the repeat, store any remaining "current record".
	if (o's currentRecord is not {}) then set end of o's recordList to o's currentRecord
	set AppleScript's text item delimiters to astid
	
	return o's recordList
end csvToList

-- Get the possibly more than 4000 text items from a text.
on getTextItems(txt, delim)
	set astid to AppleScript's text item delimiters
	set AppleScript's text item delimiters to delim
	set tiCount to (count txt's text items)
	set textItems to {}
	repeat with i from 1 to tiCount by 4000
		set j to i + 3999
		if (j > tiCount) then set j to tiCount
		set textItems to textItems & text items i thru j of txt
	end repeat
	set AppleScript's text item delimiters to astid
	
	return textItems
end getTextItems

-- From Nigel Garvey at http://macscripter.net/viewtopic.php?id=32322 ...
-- Trim any leading or trailing spaces from a string.
on trim(txt, trimming)
	if (trimming) then
		repeat with i from 1 to (count txt) - 1
			if (txt begins with space) then
				set txt to text 2 thru -1 of txt
			else
				exit repeat
			end if
		end repeat
		repeat with i from 1 to (count txt) - 1
			if (txt ends with space) then
				set txt to text 1 thru -2 of txt
			else
				exit repeat
			end if
		end repeat
		if (txt is space) then set txt to ""
	end if
	
	return txt
end trim

on mkFolder(fname)
	with timeout of 300 seconds
		tell application "OmniFocus"
			tell front document
				if not (folder fname exists) then
					make new folder with properties {name:fname}
				end if
				return first folder whose name is fname
			end tell
		end tell
	end timeout
end mkFolder

on mkProject(pname, pstatus, pnotes)
	with timeout of 300 seconds
		
		tell application "OmniFocus"
			tell front document
				if (flattened project pname exists) then
					return first flattened project whose name is pname
				end if
				set tmpProject to make new project with properties {name:pname, status:pstatus, note:pnotes}
				--				if pnotes is not "" then
				--					set note of tmpProject to pnotes
				--				end if
				
				set sequential of tmpProject to true
				return tmpProject
			end tell
		end tell
	end timeout
end mkProject

on nirvanaStatusToOmniFocus(aState)
	if aState is "Active" then
		return myActive
	else if aState is "Logbook" then
		return myDone
	else if aState is "Someday" then
		return myOnHold
	else
		display dialog "Unable to convert state:" & aState giving up after 30000
		error number -128
	end if
end nirvanaStatusToOmniFocus

on moveItemToFolderName(aProj, aFolder)
	with timeout of 300 seconds
		
		tell application "OmniFocus"
			tell front document
				move aProj to (end of sections of (first folder whose name is aFolder))
			end tell
		end tell
	end timeout
end moveItemToFolderName

on split(theString, theDelimiter)
	-- save delimiters to restore old settings
	set oldDelimiters to AppleScript's text item delimiters
	-- set delimiters to delimiter to be used
	set AppleScript's text item delimiters to theDelimiter
	-- create the array
	set theArray to every text item of theString
	-- restore the old setting
	set AppleScript's text item delimiters to oldDelimiters
	-- return the result
	return theArray
end split


on moveTaskToProject(aTask, aProjectName)
	with timeout of 300 seconds
		-- set progress additional description to aProjectName
		if isProjectName(aProjectName) then
			tell application "OmniFocus"
				tell default document
					set theProject to (first flattened project whose name is aProjectName)
					move aTask to end of tasks of theProject
				end tell
			end tell
		end if
	end timeout
end moveTaskToProject

on moveTaskToProjectBasedOnTag(aTask, aTags)
	with timeout of 300 seconds
		set myList to my split(aTags, ",")
		repeat with theItem in myList
			if isProjectName(theItem) then
				tell application "OmniFocus"
					tell default document
						set theProject to (first flattened project whose name is theItem)
						move aTask to end of tasks of theProject
					end tell
				end tell
				return
			end if
		end repeat
	end timeout
	display dialog "Nirvana does not identify the parent of a reference item in the export.  If you will tag the ITEMS (not the containing list) with the name of the reference list (exactly), that will also tag the items and  I can use that to put it in the right list." giving up after 30000
	error number -128
end moveTaskToProjectBasedOnTag


on isProjectName(aName)
	with timeout of 300 seconds
		-- handle the special case, testing for a literal, because it is faster than talking to OmniFocus
		if aName is "Standalone" then
			return false
		end if
		
		tell application "OmniFocus"
			tell default document
				if flattened project aName exists then
					return true
				else
					return false
				end if
			end tell
		end tell
	end timeout
end isProjectName

-- It is an active task if Parent is Standalone or project; state is Next or Inbox
on mkTask(aName, inParent, aState, aTags)
	with timeout of 300 seconds
		set tmpName to aName
		if aState is "Scheduled/Repeating" then
			set tmpName to aName & " #REPEATING"
		end if
		
		set aParent to inParent
		if aParent is "Standalone" or aParent is "Standalone*" then
			set aParent to "Miscellaneous"
		end if
		
		tell application "OmniFocus"
			tell default document
				if flattened project aParent exists then
					set interestingProject to first flattened project whose name is aParent
					if task tmpName of interestingProject exists then
						set interestingTask to first task of interestingProject whose name is tmpName
						delete interestingTask
					end if
				end if
				set newTask to make new inbox task with properties {name:tmpName}
			end tell
		end tell
		
		if aState is "Inbox" then
			-- nothing.  Leave it in Inbox, where it was created
		else if aState is "Next" or aState is "Scheduled" or aState is "Scheduled/Repeating" or aState is "Someday" or aState is "Inactive/Later" or aState is "Logbook" then
			moveTaskToProject(newTask, aParent)
		else
			display dialog "Unexpected state:" & aState & " for task:" & aName giving up after 30000
		end if
		
		if aState is "Logbook" then
			tell application "OmniFocus"
				tell default document
					set completed of newTask to true
				end tell
			end tell
		end if
		
	end timeout
	return newTask
end mkTask

--  convert yyyy-mm-dd to mm/dd/yyyy STRING
on parseNirvanaDate(nvDate)
	set yyyy to text 1 thru 4 of nvDate
	set mm to text 6 thru 7 of nvDate
	set dd to text 9 thru 10 of nvDate
	return date (mm & "/" & dd & "/" & yyyy & " 1:00:00 PM")
end parseNirvanaDate


on handleFocus(aFocus, aItem)
	with timeout of 300 seconds
		if aFocus is "Yes" then
			tell application "OmniFocus" to tell default document to set flagged of aItem to true
		end if
	end timeout
end handleFocus

on handleCompleted(aCompleted, aItem)
	-- if class of aItem as string is "project" then
	--	display dialog ("aCompleted:" & aCompleted & ", class:" & class of aItem as string) & ", " & name of aItem
	-- end if
	with timeout of 300 seconds
		if aCompleted is not "" then
			tell application "OmniFocus"
				tell default document
					if (class of aItem as string) is "project" then
						set status of aItem to done
					else
						set completed of aItem to true
					end if
					set completion date of aItem to my parseNirvanaDate(aCompleted)
				end tell
			end tell
			
		end if
	end timeout
end handleCompleted

on handleStartDate(aStartDate, aItem)
	with timeout of 300 seconds
		if aStartDate is not "" then
			tell application "OmniFocus" to tell default document to set defer date of aItem to my parseNirvanaDate(aStartDate)
		end if
	end timeout
end handleStartDate

on handleDueDate(aDueDate, aItem)
	with timeout of 300 seconds
		if aDueDate is not "" then
			set tmpDate to parseNirvanaDate(aDueDate)
			tell application "OmniFocus"
				tell default document
					set due date of aItem to tmpDate
				end tell
			end tell
		end if
	end timeout
end handleDueDate


on handleTaskNote(aNotes, aTask)
	with timeout of 300 seconds
		tell application "OmniFocus" to tell default document to set note of aTask to aNotes
	end timeout
end handleTaskNote

</code>