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 Today's Posts

 
Add Text to the Start of an Action Thread Tools Search this Thread Display Modes
Thanks for recompiling and reposting, skillet. Maybe Script Debugger was having a bad day when it compiled for me. I agree the compiled script in my original post doesn't appear to run after downloading it, so I installed a fresh copy and verified that it works here (at least on Snow Leopard).
 
Even better! That makes the workflow way easier. Thanks a lot!

If anybody is interested, I added a little bit to one line so when you enter text manually the script puts it into brackets and adds a blank/space between the added prepend and the task title.

Example: you enter "Wait for". With the original, you would get "waitfortasktitle". With my addition you get "[Wait for] task title".

Just exchange the part

Quote:
set varChoice to text returned of (display dialog ¬
"String to prepend to selected actions" default answer "" buttons {"OK", "Cancel"} default button "OK")
With

Quote:
set varChoice to "[" & "text returned" of (display dialog ¬
"String to prepend to selected actions" default answer "" buttons {"OK", "Cancel"} default button "OK") & "]" & ” ”
 
Your proposed change mangles the syntax a bit. A simpler change to apply would be to insert

Code:
				set varChoice to "[" & varChoice & "] "
as the next statement after the line you proposed changing, so it looks like

Code:
		if (varChoice is not false) then
			if (first item of varChoice is pOtherChoice) then
				set varChoice to text returned of (display dialog ¬
					"String to prepend to selected actions" default answer "" buttons {"OK", "Cancel"} default button "OK")
				set varChoice to "[" & varChoice & "] "
			end if
			return varChoice as text
		else
			return pNoChoice
		end if
 
I was so proud that I figured out how to do it!! :(

Yeah yours sounds a tad easier and it's probably more robust. Thanks :)
 
Hey, jumping in and tinkering with stuff like this is the best way to get started, I think. There are some aspects of how OmniFocus data is exposed in Applescript that caused me to scratch my head for a long time, and would probably have dissuaded me from attempting to create a script of any utility from scratch, but tinkering with a script that does something similar helps surmount that obstacle. If you look at the scripts posted here in the OmniFocus Extras forum, most of them are easily seen to be one of a small number of classes, with only a few huge beasts like RobTrew's Where in OF that aren't just different uses of the same general structure. It usually helps to have an idea of how you would implement your desired script in some language, of course — not knowing any Applescript and not knowing how to put a program together would be a daunting challenge.

Last edited by whpalmer4; 2012-07-17 at 09:26 AM.. Reason: Update link
 
Christian, speaking of tinkering, I think you've now got essentially all of the pieces to put together that script that applies a "tag" to the beginning of a row if the action is assigned to a certain context :-)
 
I like the new additions to this script!


Quote:
Originally Posted by whpalmer4 View Post
If you look at the scripts posted here in the OmniFocus Extras forum, most of them are easily seen to be one of a small number of classes, with only a few huge beasts like RobTrew's Where in OF that aren't just different uses of the same general structure.
Thanks for the encouragement here, it helped me push through and start to make some more sense out of these scripts!

I don't know if the following script is squerly or not but it's a way to use QuicKeys, Quick Silver, LaunchBar or whatever to run these quickly without a dialog or mouse click. Obviously you would have to create individual scripts for each action.

Hopefully I can figure out a way to make it so it duplicates the action, adds the prepended text and then marks as complete for the day. This way it will at least show some history that I got an action started and is in progress.

Code:
--Prepend text to select actions
--http://forums.omnigroup.com/showthread.php?p=101754#post101754
property prependText : "[In Progress] "

tell application "OmniFocus"
	tell front document
		tell document window 1
			set oTrees to selected trees of content
			set IngTrees to count of oTrees
			if (IngTrees > 0) then
				set strPrepend to prependText
				
				repeat with iTree from 1 to IngTrees
					set oTask to value of (item iTree of oTrees)
					set name of oTask to strPrepend & name of oTask
				end repeat
			else
				display alert "No content selected!"
			end if
		end tell
	end tell
end tell
 
I actually thought about that script request yesterday, whpalmer. Hwever, the issue with tools is exactly what you described yourself: if you have the parts and no idea how to assemble them then you still have to be extremely lucky ;)

I basically have no idea of coding, all I do sometimes is to take scripts that look remotely like what I want and try to figure out which parts/variables to modify to make "my" script. From what I can tell that put-into-folder-assign-tag would need the "on run" part to be replaced with some sort of trigger that activates when I put one or more actions into a certain context. Tht leaves me with one question though: how the hell do I do that? :p
 
Another question:

I tried to add color to the text. So if I select the free entry in the dialog and write "Important" it would add the [Important] tag in front and would color the text in the brackets in red.

To do this I added the line
Quote:
Set color of varChoice to {255,0,0}
Unfortunately, in OF I get an error telling that could not be executed. Any ideas?
 
Quote:
Originally Posted by Christian View Post
Another question:

I tried to add color to the text. So if I select the free entry in the dialog and write "Important" it would add the [Important] tag in front and would color the text in the brackets in red.

To do this I added the line


Unfortunately, in OF I get an error telling that could not be executed. Any ideas?
I'm pretty sure this can't be done currently in OmniFocus because all the colors of actions and projects etc are handled globally in preferences and not individually.
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Unwanted Loc. reminders now for an action due in Jan [A: add start date to action] jman995x OmniFocus for iPhone 4 2011-12-01 01:39 PM
Should I start with the Text Editor example? gopi Omni Frameworks 4 2010-09-14 10:28 PM
Action status: "next action" and start dates dondo OmniFocus 1 for Mac 3 2008-08-06 08:48 PM
Start / end of line key nav inside text object ? Leon Starr OmniGraffle General 2 2008-07-02 12:11 PM
Possible to search Action text containing text value? Journey OmniFocus 1 for Mac 3 2007-11-28 03:25 PM


All times are GMT -8. The time now is 08:41 AM.


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