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

 
Applescript error number -1728 when trying to specify a project name for a new task Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
I'm writing some applescript to create new tasks and assign them to projects.

I want the user to be able to select which project to assign the task to by selecting the project out of a list.

The list appears and it returns a project name like I would expect it to, but it doesn't seem to be a valid project name.

I'm getting an error similar to the following when I try to run my script

error "OmniFocus got an error: Can’t get project \"Example Project\" of document id \"e4Z5K4sRLLL\"." number -1728 from project "Example Project" of document id "e4Z5K4sRLLL"

This is the code I am trying

Code:
set oDoc to default document
tell oDoc

set projNames to (name of (flattened projects of oDoc where hidden of its folder is false and its status is active))

set selectedProject to choose from list projNames with prompt "Choose project from the list." without multiple selections allowed

set strProject to first item of selectedProject
set theProject to project strProject
set assigned container of newTask to theProject

end tell
The problem could be related to the structure of my data. The project "Example Project" is not a project at root level of the Library. It is in a folder.

I think "flattened projects" is the wrong way to get the list of projects for what I am trying to do. I think I might need something that returns the folder name as well, but I didn't see anything in the applescript library like that.

I'm new to AppleScript and this forum, so any pointers toward examples or other documentation are also appreciated.
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Applescript to change the Project of a task? Kha OmniFocus Extras 2 2011-12-19 02:10 PM
Add quick entry task with project using AppleScript iNik OmniFocus Extras 2 2011-08-30 12:40 PM
Error when syncing to WebDAV if there's a port number specified gmichaud Other WebDAV 12 2008-09-03 09:13 AM
AppleScript help: Create sub-task, project from task iNik OmniFocus Extras 3 2007-12-05 08:53 AM
Extract the Legal para number using Applescript Simon Knight OmniOutliner 3 for Mac 1 2007-12-02 04:29 AM


All times are GMT -8. The time now is 11:38 AM.


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