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 > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Adding Project and Context Thread Tools Search this Thread Display Modes
Quote:
Originally Posted by roontoon View Post
Thank you for your response, and yes I have done MUCH reading both on the net and here and the OmniFocus applescript dictionary. While scripting may come easy to you for many including myself it is sometimes a struggle so your remark above was pretty much unwarranted. While it is very apparent that you are very knowledgeable with OF and apple scripting it is not apparent why you would want to diminish someone who is trying to learn something that you have mastered. Remember to teach is to be humble and patient. If you have a problem with me or my question that escapes me as to what it would be.
Feeling better now that you've bitten the hand trying to feed you? :)

As for the teaching philosophy, I've found that people who are anything but humble and patient also can be quite effective teachers. Someone else can only make you feel as badly about yourself as you let them. If there's a way to interpret a remark that makes you feel badly, and a way that doesn't, assume it was meant to be the latter and move on. If Rob got enjoyment out of ridiculing the scripting skills of others on the forum, he could be doing so all the time, and yet all we seem to have is this post.
Quote:
But as I have said in my last post the script I have so far does everything I want except enter the project and context. The reason something like set (project name of theTask) to newprojectName does not work escapes me.
It also pretty apparent that Omni needs to create a suite of scripts that demonstrates how scripting in all of it's facets works with OmniFocus.
Some of this that you are struggling with is just coming to grips with the language, and teaching that isn't really their responsibility, in my opinion.

There is an example of the use of parse tasks hidden away in the OmniFocus application bundle. Select the application in the Finder, choose Show Package Contents from the gear menu, open the Contents folder, then the Resources folder, then MailAction.applescript.

Here is a working example:
Code:
property myProject : "Build giant robot"
property myContext : "Lair of doom"

tell application "OmniFocus"
	tell front document
		set myActionText to "Draft plans"
		set myActionText to myActionText & ">" & myProject & "@" & myContext & "#today #+3d"
		parse tasks with transport text myActionText
	end tell
end tell
and the result:

 
If you want to move an action from the inbox into a specific project and context, here's a similar example that does it:

Code:
property myProject : "Build giant robot"
property myContext : "Lair of doom"

tell application "OmniFocus"
	tell front document
		set myActionText to "Draft plans"
		set myActionText to myActionText & "#today #+3d"
		set myResult to parse tasks with transport text myActionText
		set myNewAction to first item of myResult
		set context of myNewAction to context myContext
		move myNewAction to end of tasks of project myProject
	end tell
end tell
You can't just set the project like you can do with the context, because you need to insert the task in the project's tasks data structure.
 
No intention at all to ridicule - very sorry that it came over that way - a cultural difference in sense of humour perhaps. My culture that is at fault - not yours.

The advice I wanted to give indirectly is that while one can certainly learn a lot from reading the code of others, the leverage does increase tremendously if one can find a way of expanding one's lexicon of basic concepts with a bit of background reading.

The role of "Unicode Text" in the Applescript dictionary entry for "parse tasks with transport" would, for example, become less of a stumbling-block as soon as one acquired some familiarity with the range of basic data types, and with the notion of functions expecting parameters of particular types.

Without these elements, forum discussions are bound to become protracted, and possibly a little frustrating.

Matt Neuburg's Definitive Guide to Applescript is probably where I would start - he goes pretty thoroughly through the building blocks of data types and so on.

Good luck with your coding and experimentation !

Rob
 
Quote:
Originally Posted by whpalmer4 View Post
It already is there, see help topic "Processing Mail messages into actions".
Thank you ! I had failed to find that.
 
Quote:
Originally Posted by whpalmer4 View Post
Feeling better now that you've bitten the hand trying to feed you? :)
Actually no. I was pointing out the fact that making a public display of something that was not true was uncalled for and it is something that I personally do not allow anyone, no matter how smart, to do. And it was uncalled for. Yes I was reading, yes I have hit the net, yes I was asking questions in the best way I could. I am a teacher and if someone is spending their time showing someone something, for whatever reason, then they need to be patient and kind. To mock someone with a statement like set theText to "do some reading > Save some time @ Library" is, well just mean and infers laziness. There are MUCH better ways to say what was said.

Yes I am struggling with the syntax of the language and that would have been all that needed to be said. No I wasn't asking to have you guys code for me as that would defeat the purpose of what I was trying to achieve. I was however asking questions of people who I though knew more that I and was hoping for some insight. There were several problems with what I was doing. I was parsing text that is being delivered to me via an email I can't control. Second it was not clear in the examples given that the " Action >Project @Context #1d #2d " line needed to be in the first line parsed. This I discovered for myself after your clearer description and have since parsed successfully except for one thing. There is a balance of information in the original email that also needs to be in the notes and I am at that point in the problem.

Thanks for your help,

d
 
Quote:
Originally Posted by RobTrew View Post
No intention at all to ridicule - very sorry that it came over that way - a cultural difference in sense of humour perhaps. My culture that is at fault - not yours.

The advice I wanted to give indirectly is that while one can certainly learn a lot from reading the code of others, the leverage does increase tremendously if one can find a way of expanding one's lexicon of basic concepts with a bit of background reading.

The role of "Unicode Text" in the Applescript dictionary entry for "parse tasks with transport" would, for example, become less of a stumbling-block as soon as one acquired some familiarity with the range of basic data types, and with the notion of functions expecting parameters of particular types.

Without these elements, forum discussions are bound to become protracted, and possibly a little frustrating.

Matt Neuburg's Definitive Guide to Applescript is probably where I would start - he goes pretty thoroughly through the building blocks of data types and so on.

Good luck with your coding and experimentation !

Rob
Thank you for your help.

d
 
If you need to get multiple lines of stuff in there, I think you need to set the project and context separately, as in my final example. It appears there might be some bugginess with appending the context/project/date/etc. stuff to a multiline action (bug filed, ninja agreed it looked broken, no engineer has told me I'm wrong yet) which I think would interfere. Fortunately, the code to set a known project and context isn't very complicated if it isn't a nested one.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding actions for a context but getting the wrong project gokubi OmniFocus for iPhone 3 2011-07-07 06:56 AM
Adding start date to project removes actions from Context view HSstudio OmniFocus 1 for Mac 5 2010-07-19 03:46 PM
Adding item with no context wmeleis@westernfog.com OmniFocus for iPhone 8 2009-03-29 10:02 AM
Adding New Context on 1.1 denrael OmniFocus 1 for Mac 6 2008-08-04 12:45 PM
Adding Sub-Context by typing gotung OmniFocus 1 for Mac 2 2008-08-04 08:22 AM


All times are GMT -8. The time now is 10:02 PM.


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