Scripting the Entourage browser filter

Nowhere in the Entourage dictionary (v. 2004) can I find a reference to the filter box that appears at the top of each browser window. I’m trying to write a script that filters the contents of the currently selected folder to show only messages received from the sender of the current message. Effectively I want to capture the sender’s name and paste it into the browser filter’s text box, setting the two drop-down menus to “from” & “contains” [pasted sender name]. But I can’t find the syntax for doing this.

Alternatively, I have to think that one can filter through scripting but I don’t know the mechanism for filtering. That is, are the non-compliant messages moved out of the current folder, or is a temporary folder created, or messages made invisible or what? Thanks for any ideas.

Browser: Safari 416.12
Operating System: Mac OS X (10.4)

Yes, the idea of applescripting (or this should be the idea) is that you can be able to send a message without simulating typing Apple+N, then “”, then tab, then tab, then tab, then “subject”, then tab, then “body”, then Apple+Return. Try this:

tell application "Microsoft Entourage"
	messages of inbox folder whose sender's address contains "foo"
end tell

This one should return a list of references to existing messages in your inbox folder whose sender’s address contains “foo” (as you see, the AppleScript statement is very similar to the further explanation :wink: )

Thanks, jj, for the response. I had actually tried something similar, but the result, of course, is a list in the form of {incoming message id 26930 of application “Microsoft Entourage”, incoming message id 26945 of application “Microsoft Entourage”}.

I’m trying to get Entourage to show the current folder, say, the inbox, to look exactly as it does after the filter string is entered in the filter text box. That is, I want my screen to look exactly the same after running the script as it would if I had entered the text in the box. The browser window would still be visible. Maybe this can’t be done. But there are certainly shortcomings in my scripting talents, so perhaps somebody knows how to do it. For my part, I don’t understand how the Entourage filter actually works, so it’s difficult to figure out how to script it.

Well, this gets the job done in the end:

tell application "Microsoft Entourage"
	-- target the current message
	set myMessage to current messages
	--if no message is selected, dd then quit
	if myMessage is {} then
		display dialog "no messages selected!"
	end if
	-- get the sender's name from current message
	repeat with eachMessage in myMessage
		set SenderName to display name of sender of eachMessage
	end repeat
end tell
-- enter the sender's name into the clipboard, then paste into the filter box
set the clipboard to SenderName
tell application "System Events"
	tell application process "Microsoft Entourage"
		keystroke tab
		keystroke tab
		keystroke "v" using command down
	end tell
end tell

would you pleae explain what,

   keystroke tab
   keystroke tab
   keystroke "v" using command down

Thank you.

These lines are a command sent through application “System Events” to application “Microsoft Entourage” to mimic, through scripting, a series of keystrokes. The effect is the same as typing TAB, TAB, COMMAND-V. In other words, striking the tab key twice, followed by the standard key combination for the “paste” command, command-v. Does this help?

By the way, this script works if the current folder is the INBOX folder, where I use it most often. Other folders have, apparently, a bit different structure and it takes only one tab stroke to get to the filter field. Certainly a neater script could be crafted.

Thanks, appreciate the comeback.