Maximizing a minimized application

Hi I am a systems administrator and i am constantly sending emails to staff and they don’t bother reading them :mad:

What i want to do is write a scrit in script Editor to activate Entourage and maximize it if it is minimized in the dock and bring it to the front of the finder.

so far i have worked out i can run this script successfully (as long as Entourage is not minimized to the dock)

tell application “Microsoft Entourage”
activate --Bring “Microsoft Entourage” forward
end tell

The only way i have worked out so far is that i can send this script below to quit entourage and then run the script above to reopen and bring to front Entourage.

tell application “Microsoft Entourage”
quit
end tell

I think the users would really get cheesed off if i did this. Does anyone know how to maximize a current minimized application and bring it to the Front?

Model: PwerBookG4
AppleScript: 2.1.1
Browser: Firefox 2.0.0.14
Operating System: Mac OS X (10.4)

I don’t have entourage so I tested this on safari… it works

tell application "Safari"
	activate
	set visible of windows to true
end tell

Would a rule to open all new messages from you be a better solution?

But addressing the question as asked - I don’t have Entourage, so used Mail for an example to get you started:

tell application "System Events"
	
	if "Mail" is not in name of processes then
		say "Incoming message from the Big Giant Head" --or something to warn them about what's about to happen 
		activate application "Mail"--viewer window automatically opens
		
	else if not (exists window 1 of process "Mail") then
		say "Incoming message from the Big Giant Head"
		activate application "Mail"
		delay 1
		tell process "Mail" to keystroke "n" using command down & option down--opens new veiwer window
		
	else if exists window 1 of process "Mail" then
		say "Incoming message from the Big Giant Head"
		tell application "Mail"
			activate
			set visible of windows to true--shows hidden and minimized windows
		end tell
		
	end if
end tell

Edited for spelling

I tried that but unfortunately i get an Apple script error

Microsoft Entourage got an error: Unknown object type.

tell application “Microsoft Entourage”
activate
set visible of windows to true
end tell

Maybe they’re not called windows in entourage, maybe they’re called documents. If documents doesn’t work then you have to look through the applescript dictionary for entourage… in script editor go file menu-> open dictionary and find entourage

Thanks i have had a look through the dictionary and i am getting closer. I have tried this one below but it only open the inbox on the computer and not the inbox on the users account.

tell application “Microsoft Entourage”
activate
open inbox folder

end tell

How is this script going to Make the user’s read you emails??

If they are not inclined to read them, all they have is minimise again.

Thanks Mark…but not helpful

While it’s true that Mark’s comment was not helpful in finding a solution he does bring up a rather valid point and thats coming from a fellow sysadmin who can’t stand users who refuse to pay attention to things.

Have you made any progress? My suggestion would be you look through the properties of the windows and see what properties you can use. Of course you can look through the dictionary or you might want to try something like this to get the window properties…

tell application “microsoft entourage”
activate
return (properties of window 1)
end

or… properties of front window, or first window, or document 1 etc. That’s how I found the properties of Safari’s windows and found the visible property. Although entourage might not have the visible property it must have something you can use.

My point, which I would have explained more if not running out the door :rolleyes:,
Is you maybe wasting your time, if all they then do is re-minimise the app without reading the email.

I guess i am finding it hard in understanding how you script will make them read the email.

Is the plan really for you to say they had no excuse in not SEEING the email, because it pops up automatically??

This seems to work in opening the inbox on the account.

tell application "Microsoft Entourage"
	activate
	set theUser to inbox folder of Exchange account 1
	open theUser
	
end tell

This will open the window and then set the bounds of the window to fit the whole of the desktop.
Notice the, TopSide + 22, which hides the very top of the window.
You can play with + of - in any or the {LeftSide, TopSide, RightSide, bottomSide} to shape the window

tell application "Finder"
	
	set {LeftSide, TopSide, RightSide, bottomSide} to bounds of window of desktop
	
end tell
tell application "Microsoft Entourage"
	activate
	set theUser to inbox folder of Exchange account 1
	open theUser
	set bounds of window "Inbox" to {LeftSide, TopSide + 22, RightSide, bottomSide}
end tell

Thanks Mark Fantastic this is exactly what i wanted to do:D

Just to clarify for you James.

Even though it never possible to force users to read an email or do exactly what i want i can at least use a little persuasion. It is often the case a user has a problem which needs urgent attention but also they need to carry on with their work and are not aware you have sent them an email. Even though it is possible to add a rule to say when from etc etc run this applescript (could display a popup or maximize and show Entourage i feel this is a little too intrusive to force this on users and i would only use this in urgent cases.

Thanks again Mark, with this script i can use Automator to push this out to a specific machine.

kimpton,

You may want to look at my Post in this , thread

Using Apple Events to send Notification to machines, ( using the eppc:// url protocol which you may already use) and Growl.

Post #10 has the Growl example.

( Also remember Growl can be set to Stay visible to the User clicks the Notification)

Thanks Mark i will have a look at that.

one last thing i am try to do is open a specific folder and i wonder if you might be able to help.

I currently have a IT support call logging system which automatically send me an email. I have found that these clutter up my inbox something crazy so i have set a rule within Entourage to move them to folder logger.

I wish to create a rule in Entourage to say subject contains xxxx run an apple script you display the dialog you have another support request.

I have looked through the dictionary and the forms to see if i could find anything but i am at a loss at the moment.

At the moment the script reads like this but only opens my inbox

display dialog “You have just received a support request!”

tell application “Microsoft Entourage”
activate
set theUser to inbox folder of Exchange account 2
open theUser

end tell

Where is the Logger folder,

This will work if its in the account folder,
But I have not worked out yet how to get a sub folder of the inbox to open


tell application "Microsoft Entourage"
	activate
	set theUser to folder "Logger" of Exchange account 2
	open theUser
	
end tell

Ok, worked out how to get a sub folder of the inbox folder the Exchange account

So depending on where your folder is use this or the above script.

set myFolder_Name to "Logger"
tell application "Microsoft Entourage"
	
	set theUserInbox to inbox folder of Exchange account 2
	set tId to folders of theUserInbox
	repeat with i from 1 to number of items in tId
		set this_item to item i of tId
		if name of this_item is myFolder_Name then
			open this_item
			exit repeat
		end if
	end repeat
end tell

Fantastic thanks Mark you the man and a legend! I am amazed how you have managed to work this out. I am new to applescript and i tried for ages looking through the dictionary to get this working. :smiley:

Your welcome, MS do not make it easy to Applescript Entourage, Normally you can get Properties of the app…
But not with Entourage. IMHO, that just typical of MS.
:slight_smile: