AppleScript commands to activate Tasks

M

Mike VanHorn

Is there a simple way to tell Entourage to go to a specific module? I want
to be able to assign a button on my keyboard to an AppleScript that tells
Entrourage to go to the Tasks, and another button which tells Entourage to
go to Mail.

Thanks!

---
Mike VanHorn
Senior Computer Systems Administrator
College of Engineering and Computer Science
Wright State University
(e-mail address removed)
937-775-5157
http://www.cs.wright.edu/~mvanhorn/
 
P

Paul Berkowitz

Is there a simple way to tell Entourage to go to a specific module? I want
to be able to assign a button on my keyboard to an AppleScript that tells
Entrourage to go to the Tasks, and another button which tells Entourage to
go to Mail.

Well, keyboards don't have buttons, but yes, it's very simple to write an
AppleScript and provide a keyboard shortcut.

But you don't need to in this case - they're already provided. Check out
View/Go To --> menu item. The six areas of the main window have simple
keyboard shortcuts using command (Apple) key with numbers 1-6. Tasks is
cmd-5 and Mail is cmd-1, for example. They seem to be available from
everywhere in Entourage, no matter what type of window is in the front.

When there is not yet a keyboard shortcut for some menu item, you can add
one in Panther without a script, in System Preferences/Keyboard &
Mouse/Keyboard Shortcuts/Application Keyboard Shortcuts. In this case
they'll only work when that menu item is enabled in your current view.
Sometimes - and when there is no menu item for what you what to do - a
script would be the only solution.

--
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.
 
M

Mike VanHorn

Well, keyboards don't have buttons,

My keyboard does. It's a MacAlly iKey, and has two rows of customizable
buttons across the top.
but yes, it's very simple to write an
AppleScript and provide a keyboard shortcut.

OK, then could you provide some guidance as to how to do that. I looked
through the commands and classes Entrourage provides (using the
ScriptEditor) and didn't see anything that seemed to do something as simple
as going to the Tasks module.
But you don't need to in this case - they're already provided. Check out
View/Go To --> menu item. The six areas of the main window have simple
keyboard shortcuts using command (Apple) key with numbers 1-6. Tasks is
cmd-5 and Mail is cmd-1, for example. They seem to be available from
everywhere in Entourage, no matter what type of window is in the front.

Well, yes, that's fine, if one is already in Entourage, but those keyboard
shortcuts aren't helpful in you're in Safari, and want to switch immediately
to the Task list in Entourage.

Is there a way in AppleScript to "send" a keyboard shortcut to an
application? Something along the lines of "Activate Entourage; Command-5"?


---
Mike VanHorn
Senior Computer Systems Administrator
College of Engineering and Computer Science
Wright State University
(e-mail address removed)
937-775-5157
http://www.cs.wright.edu/~mvanhorn/
 
P

Paul Berkowitz

Well, yes, that's fine, if one is already in Entourage, but those keyboard
shortcuts aren't helpful in you're in Safari, and want to switch immediately
to the Task list in Entourage.

You never explained you wanted to call this function from outside Microsoft.
That puts a different complexion on things. The keyboard shortcuts that can
call scripts in the Entourage script menu are also only available when
Entourage is in the front.
Is there a way in AppleScript to "send" a keyboard shortcut to an
application? Something along the lines of "Activate Entourage; Command-5"?

It's easy to _write_ the AppleScript:

tell application "Microsoft Entourage"
open main window
set displayed area of main window to tasks area -- or mail area
activate
select main window
end tell

But the question becomes: how to call that script when Entourage isn't in
the front? You could put this script (saved as a compiled script) in
~/Library/Scripts/ [not in any subfolder], where ~/ is your OS X user.

Then go (once only) to /Applications/AppleScript/Install Script Menu and
double-click it (in Jaguar it's called ScriptMenu.menu), and you'll find a
script menu over on the right side of the menu bar, in all apps and the
Finder. So you could call the script by selecting it in the script menu. But
- so far - there's no mechanism provided by the system for keyboard
shortcuts for this script menu. You'd need to get a utility that runs
scripts from a key shortcut. iKey is supposed to be the best one:

http://www.scriptsoftware.com/ikey/

v1.0.x seems to be still available at $20; it looks like there's a new v2.0
at $30 coming out. You can run a script from a file: that's the feature you
want. (Link to the script you save in ~/Library/Scripts/ . Don't save the
script as an application or it will be slow to start up every time. Save it
as a compiled script. I think iKey can run compiled scripts. Try it out - I
think it has a Demo period.)


--
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.
 
M

Mike VanHorn

It's easy to _write_ the AppleScript:

tell application "Microsoft Entourage"
open main window
set displayed area of main window to tasks area -- or mail area
activate
select main window
end tell

Thanks! That's what exactly I needed. I knew everything except
"set displayed area of main window to tasks area". Where did you find this
documented, that each different module in Entourage is referred to as an
"area"?
But the question becomes: how to call that script when Entourage isn't in
the front?

That's easy; I just compile the script to an Application, and assign a
button to it. Granted, it's not as quick as when using iCal (where all the
button press had to do was activate the application, and it didn't have to
start up the AppleScript), but it's not unuseably slow, either.

Is there a way, if you save a script as a .app with "stay open" checked to
get the script to do what it does every time it is activated? Meaning, when
the script is called the first time, it does it's work, then stays open, and
the next time it's activated, it does it's work again (basically, a loop
that depends on the script being activated)?

Thanks!

---
Mike VanHorn
Senior Computer Systems Administrator
College of Engineering and Computer Science
Wright State University
(e-mail address removed)
937-775-5157
http://www.cs.wright.edu/~mvanhorn/
 
P

Paul Berkowitz

Thanks! That's what exactly I needed. I knew everything except
"set displayed area of main window to tasks area". Where did you find this
documented, that each different module in Entourage is referred to as an
"area"?

In the Entourage AppleScript dictionary, naturally. 'window' in the Standard
Suite shows several subclasses (which are not standard) including 'browser
window'. Also 'application' in Standard Suite has a property 'main window'
(which is of type 'reference' meaning an Entourage object. It's a little
vague, but I suppose that must date from before the subclass 'browser
window' existed - it was just introduced in Entourage X. The main window is
a browser window.) 'browser window' is in the Entourage Mail & News Suite.
It has a property (at the bottom, after all the inherited properties from
its superclass 'window') called 'displayed area', which has several
enumerations, among them 'tasks area' and 'mail area'.
That's easy; I just compile the script to an Application, and assign a
button to it. Granted, it's not as quick as when using iCal (where all the
button press had to do was activate the application, and it didn't have to
start up the AppleScript), but it's not unuseably slow, either.

Is there a way, if you save a script as a .app with "stay open" checked to
get the script to do what it does every time it is activated? Meaning, when
the script is called the first time, it does it's work, then stays open, and
the next time it's activated, it does it's work again (basically, a loop
that depends on the script being activated)?

Yes there is, using 'reopen' . It will work double-clicking it or an alias,
and probably you could drag this app to the dock. and click it there once.
Make sure to save it as Stay Open. It would be slow only the first time
it's run, after that instantaneous.


on run
my OpenTasks()
end run

on reopen
my OpenTasks()
end reopen

on OpenTasks()
tell application "Microsoft Entourage"
open main window
set displayed area of main window to tasks area
activate
select main window
end tell
end OpenTasks



--
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.
 
M

Mike VanHorn

In the Entourage AppleScript dictionary, naturally.

I looked there, but apparently didn't dig deep enough. Thanks!
Is there a way, if you save a script as a .app with "stay open" checked to
get the script to do what it does every time it is activated?
[snip]

Yes there is, using 'reopen' .

Awesome! Thanks!

---
Mike VanHorn
Senior Computer Systems Administrator
College of Engineering and Computer Science
Wright State University
(e-mail address removed)
937-775-5157
http://www.cs.wright.edu/~mvanhorn/
 
R

Richard Shaw

You can switch between the modules using the command key and numbers 1-6

cmd-1 email
cmd-2 address book
cmd-3 calendar
cmd-4 notes
cmd-5 tasks
cmd-6 project center

Another possibility is to Control-Click on a module's icon to open it in a
separate window. Then you can use Command-` to switch between windows.

Richard

====================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top