The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
AddingTags Thread Tools Search this Thread Display Modes
So the one thing that was really annoying me about OmniFocus was the inability to tag my projects. As I posted in another forum I am not using tags to supplement the GTD workflow, instead I'm using it only for reference for easy searching.

With the OmniFocus search feature you could search for every word in the notes field. Unfortunately this would also search within attached emails, webpages, etc. So instead I came up with a system that would search for my keywords as I call them "tags".

To do that I created this AppleScript to easily pick my keywords from a file and put them into the clipboard for easy pasting into OmniFocus.

My file contains keywords with various formats that I could easily use for searches. Here are some examples:

*** Heading ***
@Action
#
$

The file has to be set up with one of these per line. So that it looks good you also want to insert a space before the "tag" and a comma after the tag.

The applescript will just read a selectable file display a multi select function and add it to the clipboard so you can easily paste it in to any selection. This script will not limit you to OmniFocus only but will let you use this functions with any programs.

Hope this helped you like it helped me, and if you find it useful have any suggestions etc just post here.

Code:
-- Script To Populate OmniFocus Tags
-- Written by Yury German <yury (at) technologysecure.com>
-- Version: 1.00
-- Date of Change: 2013-07-10

set myDivider to {"__________________________________________"}
set myTags to {""}

-- This opens a file name 
-- I will have another script that will just open up a file location as it might be easier
set myNames to paragraphs of (read (choose file with prompt "Pick text file containing Tags"))
repeat with nextLine in myNames
	if length of nextLine is greater than 0 then
		set myTags to (myTags & nextLine)
	end if
end repeat

choose from list myTags with title "Tags" with prompt "Choose One or Multiple Tags" OK button name "Insert" with multiple selections allowed
set listchoice to result as text
set myText to (return & myDivider & return & return & "*** Tags: ***" & return & listchoice & return & myDivider & return)
--set oldClipboard to the clipboard
set the clipboard to myText as text
 
This is the same script but now instead of pasting in to the clipboard you want to select the field that you want to paste this in to OmniFocus (yes I am lazy, so this helps.

Code:
-- Script To Populate OmniFocus Tags
-- Written by Yury German <yury (at) technologysecure.com>
-- Version: 1.01
-- Date of Change: 2013-07-10

set myDivider to {"__________________________________________"}
set myTags to {""}

-- This opens a file name 
-- I will have another script that will just open up a file location as it might be easier
set myNames to paragraphs of (read (choose file with prompt "Pick text file containing Tags"))
repeat with nextLine in myNames
	if length of nextLine is greater than 0 then
		set myTags to (myTags & nextLine)
	end if
end repeat

choose from list myTags with title "Tags" with prompt "Choose One or Multiple Tags" OK button name "Insert" with multiple selections allowed
set listchoice to result as text
set myText to (return & myDivider & return & return & "*** Tags: ***" & return & listchoice & return & myDivider & return)
set oldClipboard to the clipboard
set the clipboard to myText as text

tell application "OmniFocus"
	activate
end tell

tell application "System Events"
	keystroke "v" using {command down}
	delay 0.5
end tell
set the clipboard to oldClipboard
 
Noticed an Error in the Script as there was no exit routine so we are now at 1.2 (boy that was fast)

I included by default a number of modification instructions on which sections to comment out via the -- variable of applescript if you want it to run differently.

By Default the file is set to /Users/USERNAME/Desktop/Tags.txt

You can change it to whatever you want it to be, or simply pop up a dialog.

Also I removed the section of pasting it in to OmniFocus directly, as if you do not have any field selected it would put in a whole bunch of text in to it.

I will also Post another Script in a second to help with the searching, by using the same script just wording some things differently.

Code:
-- Script To Populate OmniFocus Tags
-- Written by Yury German <yury (at) technologysecure.com>
-- Version: 1.02
-- Date of Change: 2013-07-10

-- These variables always need to be here
-- 
-- Change the Variable below if you do not like my divider in to whatever you want a s a divider
set myDivider to {"__________________________________________"}

-- Leave this one alone as you want the variable empty just in case
set myTags to {""}


-- This opens a file name 
-- This is to automatically select the file comment out the block if you want to select each time
-- === START COMMENT HERE ===
set userName to short user name of (system info)
-- My location is the destkop for easy editing, you can change it where you want it to be.
set myFilePath to "/Users/" & userName & "/Desktop"
-- This is the name Tags.txt
set myFile to ("Tags.txt")
set readThisFile to (myFilePath & "/" & myFile)
set myNames to paragraphs of (read readThisFile)
-- == STOP Comment Here ====

-- NOTE: If you want to pick the files manually, just comment out the above as detailed and
-- uncoment the line below to be able to pick the file each time.
-- set myNames to paragraphs of (read (choose file with prompt "Pick text file containing Tags"))

-- Reads the file one line at a time
repeat with nextLine in myNames
	if length of nextLine is greater than 0 then
		set myTags to (myTags & nextLine)
	end if
end repeat

-- Displays the Actual Pop Up List
choose from list myTags with title "Tags" with prompt "Choose One or Multiple Tags" OK button name "Insert" with multiple selections allowed
set listchoice to result as text
-- Check if Cancel was pressed or the List is empty and quit
if listchoice is equal to "false" then
	return 30
	-- Otherwise Go to Town!
else
	set myText to (return & myDivider & return & return & "*** Tags: ***" & return & listchoice & return & myDivider & return)
	set the clipboard to myText as text
end if
 
This script is the same as above accept the nice stuff removed so you can just paste the output in to the search bar.

I call it SearchOmniTag.scpt

Code:
-- Script To Search OmniFocus Tags
-- Written by Yury German <yury (at) technologysecure.com>
-- Version: 1.00
-- Date of Change: 2013-07-10

-- These variables always need to be here
-- 
-- Change the Variable below if you do not like my divider in to whatever you want a s a divider
set myDivider to {"__________________________________________"}

-- Leave this one alone as you want the variable empty just in case
set myTags to {""}


-- This opens a file name 
-- This is to automatically select the file comment out the block if you want to select each time
-- === START COMMENT HERE ===
set userName to short user name of (system info)
-- My location is the destkop for easy editing, you can change it where you want it to be.
set myFilePath to "/Users/" & userName & "/Desktop"
-- This is the name Tags.txt
set myFile to ("Tags.txt")
set readThisFile to (myFilePath & "/" & myFile)
set myNames to paragraphs of (read readThisFile)
-- == STOP Comment Here ====

-- NOTE: If you want to pick the files manually, just comment out the above as detailed and
-- uncoment the line below to be able to pick the file each time.
-- set myNames to paragraphs of (read (choose file with prompt "Pick text file containing Tags"))

-- Reads the file one line at a time
repeat with nextLine in myNames
	if length of nextLine is greater than 0 then
		set myTags to (myTags & nextLine)
	end if
end repeat

-- Displays the Actual Pop Up List
choose from list myTags with title "Tags" with prompt "Choose One or Multiple Tags" OK button name "Insert" with multiple selections allowed
set listchoice to result as text
-- Check if Cancel was pressed or the List is empty and quit
if listchoice is equal to "false" then
	return 30
	-- Otherwise Go to Town!
else
	set myText to (listchoice)
	set the clipboard to myText as text
end if
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -8. The time now is 06:33 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.