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

 
Need basic applescript for changing context Thread Tools Search this Thread Display Modes
I want to change the context of a set of selected tasks as part of my applescript. I can't seem to get it to work though. Any help?

I grab the selected tasks and iterate through them. That all works fine. I cant read the context values, and the context names for each task. But running it backwards to set the context isn't working. Can I set them by context name? to just context IDs?

help
 
My Complete and Await Reply script includes code for setting the context. You're welcome to lift from there.
__________________
Cheers,

Curt
 
The section:

set theContextID to id of item 1 of (complete ContextName as context)
set ContextName to first context whose id is theContextID

Not sure I totally understand the first line, what is the "item 1" referring to?

This works mostly. But it doesn't find the context ID for a context name that are a sub-context (i.e. not on a top context)
 
Quote:
Originally Posted by tah View Post
The section:

set theContextID to id of item 1 of (complete ContextName as context)
set ContextName to first context whose id is theContextID

Not sure I totally understand the first line, what is the "item 1" referring to?
The first entry in the list of completions that is returned by (complete ContextName as context). You can specify a maximum number of matches, but the result still comes back as a list, even if you specified that you only want 1. Here's an example of what is given back:

Code:
tell application "OmniFocus"
	complete "Internet" as context
		{{xml:"<span class=\"match\">Internet</span>", name:"Internet", score:315, id:"i9xBJiBMtXH"}, {xml:"<span class=\"match\">Internet</span> : iBook G4", name:"Internet : iBook G4", score:210, id:"n6UfiqlB8WX"}, {xml:"<span class=\"match\">Internet</span> : iMac G5", name:"Internet : iMac G5", score:210, id:"bSidHmTsGvc"}, {xml:"<span class=\"match\">Internet</span> : Macbook", name:"Internet : Macbook", score:210, id:"o8ur1eeK1TQ"}, {xml:"<span class=\"match\">Internet</span> : PC", name:"Internet : PC", score:210, id:"m8gFTgpko7G"}}
	display dialog 5 buttons {"OK"}
		{button returned:"OK"}
end tell
 
Quote:
Originally Posted by tah View Post
This works mostly. But it doesn't find the context ID for a context name that are a sub-context (i.e. not on a top context)
Unfortunately, you have to climb down the context hierarchy yourself. A subcontext is retrieved like 'context Foo of context Bar'.
__________________
Cheers,

Curt
 
Quote:
Originally Posted by curt.clifton View Post
My Complete and Await Reply script includes code for setting the context. You're welcome to lift from there.
Sorry to drift this thread a bit - but -

Curt - I'm using your Complete and Await Reply script (thanks much!) -

How the heck did you add an Icon to the script? I've looked at Script Editor and Googled, and it's eluded me so far.

I want to use an icon for a couple of my home-grown scripts, including my Set Project Dependency script.
 
hmm, I think I may have found it - simple copy/paste in the .scpt file's infopane?

http://forums.macosxhints.com/archiv...p/t-26617.html
 
Right.

My workflow for script icons is to draw the icons in OmniGraffle, typically very large. Then I export to a png, adjusting the scaling to get a 512x512 image. I drag that image on to a new Icon Composer document to get an icns file. (Icon Composer is installed with the Developer Tools from Apple.) I drop the icns file onto the Icon Droplet application to get an "application" file. I can copy from the info. pane of that file and paste onto the info. pane of my script file.

There's probably an easier approach, but this one gets me icons that seem to scale nicely.
__________________
Cheers,

Curt
 
Cool, thanks Curt!

Here are a couple of other pages that explain the copy/paste step better. The icon we want to cut/paste is at the *top* of the infopane, not the Preview at the bottom

http://hubpages.com/hub/How_to_Change_Icons_in_Mac_OS_X
http://pimpmymac.wordpress.com/2007/...-change-icons/

My guilt over hijacking this thread for this is too much - I'm going to post this as a new thread.

Last edited by fudster; 2009-07-30 at 12:54 PM.. Reason: Hadn't seen Curt's response
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Changing an Applescript totoholic OmniFocus Extras 7 2012-08-08 08:14 AM
how to applescript changing a row's background color? wfiveash OmniOutliner 3 for Mac 4 2010-10-28 02:02 PM
Changing Inspector Locations w/ Applescript: OmniGraffle cwingrav AppleScripting Omni Apps 1 2010-05-06 12:10 PM
Context Changing to Stalled if only project is in context SpiralOcean OmniFocus 1 for Mac 1 2010-02-19 06:09 AM
Changing fill color in AppleScript action mduser63 OmniGraffle General 1 2006-06-27 09:23 PM


All times are GMT -8. The time now is 07:35 AM.


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