View Single Post
Quote:
Originally Posted by whpalmer4 View Post
m_kuhn, it opens fine here, might be worth downloading it again. I'll also include a text copy of the script below.
Bizarre. I get the same error when I download the script and the icon for the script has a bug on it.

When I copy and paste the script into AppleScript Editor I'm ok. Though it still throws an error of some kind that won't let the script run.

However, I still can't use this in a Hazel workflow because it is a Folder Action script. Is there anyway to change it to a stand alone script that can be triggered on a file from a Hazel workflow?

When I try to compile the script in Hazel I get the following error: Expected “end” but found “property”.

The below script works flawlessly as a Folder Action but I'd love to get it as a stand alone script!:

Code:
property pEmbedFile : true (* if true, file will be embedded
if false, file will be linked *)
property pUseQuickEntry : false (* if true, Quick Entry window used and left open
if false, actions added directly to Inbox *)
property pDefaultProject : "missing value"
property pDefaultContext : "missing value"

on adding folder items to this_folder after receiving added_items
	try
		repeat with i from 1 to number of items in added_items
			set this_item to item i of added_items
			tell application "Finder" to set file_name to (name of this_item)
			tell application "OmniFocus"
				if (pUseQuickEntry) then
					set theContext to (first flattened context where its name = pDefaultContext as rich text)
					set theProject to (first flattened project where its name = pDefaultProject)
					tell quick entry
						open
						tell theProject
							set NewTask to make new task with properties {name:file_name, context:theContext}
							tell the note of NewTask to make new file attachment with properties {file name:this_item, embedded:pEmbedFile}
						end tell
						activate
					end tell
				else
					tell front document
						set theContext to (first flattened context where its name = pDefaultContext as rich text)
						set theProject to (first flattened project where its name = pDefaultProject)
						tell theProject
							set NewTask to make new task with properties {name:file_name, context:theContext}
							tell the note of NewTask to make new file attachment with properties {file name:this_item, embedded:pEmbedFile}
						end tell
					end tell
				end if
				
			end tell
		end repeat
	end try
end adding folder items to

Last edited by m_kuhn; 2012-12-22 at 03:31 AM.. Reason: Update