Thread: AddingTags
View Single Post
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.

-- Script To Populate OmniFocus Tags
-- Written by Yury German <yury (at)>
-- 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
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!
	set myText to (return & myDivider & return & return & "*** Tags: ***" & return & listchoice & return & myDivider & return)
	set the clipboard to myText as text
end if