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

AS to replace the Clip-O-Tron Thread Tools Search this Thread Display Modes
I'm working on a AS that can replace Clip-o-tron until the nice people at OmniGroup have worked out a more useful replacement.

Steps in the script are simple:
  1. Get the selected email
  2. Get the text for the mail
  3. Compile a 'message:MessageID'
  4. Get subject as subject for the OF Document
  5. Insert both in the note field of the OF document
  6. Open Quick Note with the compiled data
  7. Ask Mail to move the message out of Inbox to an 'Action Folder'

:confused: My challenge right now is to verify that OF have added the document before asking Mail to file the message elsewhere. So if any of you friendly OF users has suggestions. AS snippets are more than welcome I'll be brushing up the final script and posting it here.
If you publish your script I can take a look at it...

Also, what OS are you on? And what exactly isn't working about the Clip-o-tron for you?
The reason that I'm working on a replacement for Clip-o-tron is due to it's limitations within Mail actions. I'd like in one workflow to be able to both send the email to an archive within Mail and at the same time post a link and text in OF. If Clip-o-tron could be instructed to do different actions depending on 'shortcuts' or small AS snippets I be dropping my version right away.

Here is the AppleScript. The code is still preliminary - I'm learning AS at the same time. Would like to be able to both handle Actions and Waiting for in the same workflow - depending on the Context selected in the Quick Note.


set MAIL_ACTION_TARGET to "Action"

tell application "Mail"
		set these_selections to selection
		set the current_mail to item 1 of the these_selections
		set theSubject to subject of current_mail
		set umid to message id of the current_mail
		set encodedURI to urlencode(umid) of me
		set mail_URI to "message://%3C" & encodedURI & "%3E"
		set taskTitle to theSubject
		set mail_body to content of the current_mail
		set note_content to "Original massge is: " & mail_URI & return & return & return & "Sender: " & (sender of the current_mail) & return & mail_body
	on error
		log "No message selected"
	end try
	-- Send the email straight to OmniFocus for more processing
	tell application "OmniFocus"
		tell default document
				tell quick entry
					set newTask to make new inbox task with properties {name:taskTitle, note:note_content}
					select {inbox task 1}
				end tell
			on error
				log "error"
			end try
			-- Test and see if the enty made it to Inbox, this is to prevent Mail from moving 
			-- messages that have not been filed in OF
		end tell
	end tell
	-- Move the mail to the mailbox that have been defined as the default target for actions	
	tell application "Mail"
		move current_mail to mailbox MAIL_ACTION_TARGET
	end tell
end tell
	Code snippet extracted from Waiting-For-Mails-to-OmniFocus.scpt

	Waiting For Mails to OmniFocus Script
	by, Sven Fechner

on urlencode(theText)
	set theTextEnc to ""
	repeat with eachChar in characters of theText
		set useChar to eachChar
		set eachCharNum to ASCII number of eachChar
		if eachCharNum = 32 then
			set useChar to "+"
		else if (eachCharNum ≠ 42) and (eachCharNum ≠ 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then
			set firstDig to round (eachCharNum / 16) rounding down
			set secondDig to eachCharNum mod 16
			if firstDig > 9 then
				set aNum to firstDig + 55
				set firstDig to ASCII character aNum
			end if
			if secondDig > 9 then
				set aNum to secondDig + 55
				set secondDig to ASCII character aNum
			end if
			set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string
			set useChar to numHex
		end if
		set theTextEnc to theTextEnc & useChar as string
	end repeat
	return theTextEnc
end urlencode

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
10.8.1 Seems to have broken Clip-o-tron rogbar OmniFocus 1 for Mac 20 2013-02-07 04:25 AM
Clip-o-Tron with or without attachements johnrover OmniFocus 1 for Mac 3 2012-05-02 09:57 AM
Clip-o-tron error jmstovall OmniFocus 1 for Mac 8 2012-04-12 02:13 PM
Cannot set-up Clip-O-Tron on 10.6. Tinchohs OmniFocus 1 for Mac 19 2010-04-28 07:54 PM
Clip-O-Tron 3000... frankmcma OmniFocus 1 for Mac 5 2008-08-01 06:16 AM

All times are GMT -8. The time now is 11:44 PM.

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