Exporting list of projects?

B

bongoman

Hi there

Is there a way to export a list of projects out of Entourage? I'm using it
to implement GTD (an approach to productivity) and having a list of projects
is a crucial aspect.

Of course, I have this in Project Centre but want to generate a text file
that I can then sync to the Palm so I have a project list there as well.

bongoman
 
P

Paul Berkowitz

Is there a way to export a list of projects out of Entourage? I'm using it
to implement GTD (an approach to productivity) and having a list of projects
is a crucial aspect.

Of course, I have this in Project Centre but want to generate a text file
that I can then sync to the Palm so I have a project list there as well.

I'm not quite sure why you think it needs to be a text file: wouldn't making
an Entourage Note be simpler? Entourage Notes sync as Palm Memos.

You just need to run this AppleScript in Script Editor, or save it as a
Script in the Entourage Script Menu Items folder to run whenever you want.
I've set it to make both a text file and a Note. You can remove either if
you don't need it.

If you make a text file, the file will be made on the desktop. If there's
already a previous Projects List.txt file there, it will overwrite it. If
you make a note, it will make a new note with the Date Created as now. If
you want the note to be opened for inspection, remove the "--" before 'open
n'.



tell application "Microsoft Entourage"
set theProjects to name of every project
set AppleScript's text item delimiters to {return}
set projectString to (theProjects as string) & return
set AppleScript's text item delimiters to {""}

-- remove next line if you don't want a note
set n to make new note with properties {name:"Projects List",
content:projectString}
--open n
end tell

--remove remainder of script if no text file needed
set fileSpec to (path to desktop as Unicode text) & "Projects List.txt"
try
close access alias fileSpec
end try
set f to open for access file fileSpec with write permission
set eof f to 0
write projectString to f
close access f



--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
B

bongoman

I'm not quite sure why you think it needs to be a text file: wouldn't making
an Entourage Note be simpler? Entourage Notes sync as Palm Memos.

Of course. An Entourage note does work better.
You just need to run this AppleScript in Script Editor...

Thank you Paul: that is very cool indeed and is greatly appreciated.

bongoman
 
B

bongoman

You just need to run this AppleScript in Script Editor, or save it as a
Script in the Entourage Script Menu Items folder to run whenever you want.
I've set it to make both a text file and a Note. You can remove either if
you don't need it.

This is working very well for me. I've tried modifying it to create another
script that will generate a note that contains a listing of only those
projects that have no tasks associated with them, but to no avail.

I'm guessing it has to do with this line in the original script:

set theProjects to name of every project

But am not sure how to only grab task-less projects.

Any clues appreciated!!

bongoman
 
P

Paul Berkowitz

This is working very well for me. I've tried modifying it to create another
script that will generate a note that contains a listing of only those
projects that have no tasks associated with them, but to no avail.

I'm guessing it has to do with this line in the original script:

set theProjects to name of every project

But am not sure how to only grab task-less projects.

Unfortunately this is not simple. 'project' as a class is very minimally
scriptable. You'll notice that the dictionary does not show any elements for
class 'project'. A proper implementation would show tasks, events, contacts,
groups and notes (and hopefully even 'file references' and 'clipping
references') as elements of a project - just as they appear to be in the UI
of projects in the Project Center. Then we would be able to say something
like

every project where its tasks = {}

but we can't do that since projects - in AppleScript - don't have tasks, nor
any other element.

So the first thing you should do, PLEASE, is to send a feedback via the Help
menu to request better scriptability of 'project' such that you can get all
the items of a project as elements.

Projects, instead, are only findable as items of the 'project list' property
of the individual Entourage objects which happen to belong to the project :
the other way around. That means that you have to trick Entourage to avoid
doing a very tedious repeat loop through all objects in Entourage. This
trick, still somewhat tedious, should work:

tell application "Microsoft Entourage"
set projectsWithoutTasks to {}
set allProjects to every project -- not name
repeat with i from 1 to (count allProjects)
set theProject to item i of allProjects
set projectTasks to (every task whose project list contains
{theProject})
if projectTasks = {} then set end of projectsWithoutTasks to name of
theProject
end repeat
projectsWithoutTasks
end tell





--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
B

bongoman

Thanks Paul.

So I'm trying to work that into the original script thus:
--
tell application "Microsoft Entourage"
set projectsWithoutTasks to {}
set allProjects to every project -- not name
repeat with i from 1 to (count allProjects)
set theProject to item i of allProjects
set projectTasks to (every task whose project list contains
{theProject})
if projectTasks = {} then set end of projectsWithoutTasks to name of
theProject
end repeat
projectsWithoutTasks
-- remove next line if you don't want a note
set n to make new note with properties {name:"Projects without tasks",
content:projectsWithoutTasks}
--open n
end tell

--remove remainder of script if no text file needed
set fileSpec to (path to desktop as Unicode text) & "Taskless Projects
List.txt"
try
close access alias fileSpec
end try
set f to open for access file fileSpec with write permission
set eof f to 0
write projectsWithoutTasks to f
close access f
 
P

Paul Berkowitz

But with no luck. I'm thinking it is around these lines I need to do some
sort of formatting?
--
if projectTasks = {} then set end of projectsWithoutTasks to name of
theProject
end repeat
projectsWithoutTasks

No, it's the line you added:

set n to make new note with properties {name:"Projects without tasks",
content:projectsWithoutTasks}


projectsWithoutTasks is an AppleScript list. 'content' has to be text (see
the dictionary). So you're getting no content, naturally. Similarly with
writing to a file. (Actually you could write a list to file - explicitly 'as
list' - if you wanted to, but you'd just see a strange-looking double-byte
when trying to read it as text.)

Before the line above, insert:

set AppleScript's text item delimiters to {return}
set projectsWithoutTasks to projectsWithoutTasks as string
set AppleScript's text item delimiters to {""}


(I used string rather than Unicode text to make writing to the file
simpler.)


--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
B

bongoman

OK, thanks for that. It is greatly appreciated.

Now I'm trying to alter the script so that it only generates a list of those
projects that have no completed tasks.

I'm unsure how to properly alter this line:

set projectTasks to (every task whose project list contains {theProject})

to set projectTasks to only those tasks whose property completed is false
and whose project list contains {theProject} but am getting syntax errors.

Cheers

bongoman
 
B

bongoman

Now I'm trying to alter the script so that it only generates a list of those
projects that have no completed tasks.

That is, a list of projects with no incomplete tasks. If a project has
completed tasks associated with it but no incomplete tasks, then it needs to
be written to the list of taskless projects.

bongoman
 
P

Paul Berkowitz

That is, a list of projects with no incomplete tasks. If a project has
completed tasks associated with it but no incomplete tasks, then it needs to
be written to the list of taskless projects.
and

to set projectTasks to only those tasks whose property completed is false
and whose project list contains {theProject} but am getting syntax errors.


Maybe it's time for you to learn AppleScript? There's one first-rate book:
AppleScript:The Definitive Guide by Matt Neuburg, published by O'Reilly.
It's at quite an advanced level. Before that you might want to check Bill
Briggs' AppleScript Primer articles at
http://maccentral.macworld.com/features/applescriptprimer00/

The AppleScript Language Guide is free from
http://www.apple.com/applescript/

You can't just write any old conversational English and expect it to work. I
mean, where are you getting "only" from? You can't ever include the word
'property' even when you're referring to a property.

set projectTasks to every task whose project list contains {theProject}
and completed is false

(or
set projectTasks to every task where its project list contains
{theProject} and its completed is false

if you prefer the sound of it).

is proper AppleScript but is not what you want. It will find you the
incomplete tasks of the particular project, no matter how many or how few.
You're not thinking it through clearly. You'd do better to use the previous
effort as a model. Once again, you need to check tasks project by project
and you really need to look for incomplete tasks of that project (as you
realized). If there aren't any, add the project's name to your list.

tell application "Microsoft Entourage"
set completedOnlyProjects to {}
set allProjects to every project -- not name
repeat with i from 1 to (count allProjects)
set theProject to item i of allProjects
set incompleteProjectTasks to (every task where its project list
contains {theProject} and its completed is false)
if incompleteProjectTasks = {} then set end of completedOnlyProjects
to name of theProject
end repeat
completedOnlyProjects
end tell



--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
B

bongoman

Maybe it's time for you to learn AppleScript?

Yes!

I do feel I have been taking liberties in this thread and waiting for
answers to come back to me rather than doing the heavy lifting for myself. I
am very grateful for the assistance you have rendered but also realise that
at some point I need to do the ground work for myself and it is
inappropriate to keep stabbing in the dark and waiting for usenet in
general, and you in particular, to come to my rescue.
You can't just write any old conversational English and expect it to work. I
mean, where are you getting "only" from?

Well, I wasn't actually trying that in Script Editor but was "pseudo-coding"
it in my post for the sake of illustrating what I was trying to achieve. I
had been trying various permutations in what I thought was valid applescript
but am lacking the foundations to do it justice.

Again, thanks for your troubles here Paul. I'll use what you have given me
as a springboard into further explorations..

Many thanks

bongoman
 
Top