Re: How to tell Window Class/Type in Outlook 2011
Re: How to tell Window Class/Type in Outlook 2011
- Subject: Re: How to tell Window Class/Type in Outlook 2011
- From: Dave <email@hidden>
- Date: Mon, 29 Feb 2016 10:36:04 +0000
Hi Again Christopher,
> You've tried this?
>
> tell application "Microsoft Outlook"
> class of front window
> end tell
When I started digging deeper I’ve found that depending how I get the Class it returns different results. Please see this test Script:
property pWindowInfoDictionary : {kWindowInfoWindowID:"", kWindowInfoWindowClass:"", kWindowInfoMessageID:"", kWindowInfoMessageClass:""}
on getOutlookFrontWindowID()
tell application id "com.microsoft.Outlook"
set myActiveWindow to the front window
set myWindowID to the id of myActiveWindow
end tell
return myWindowID as string
end getOutlookFrontWindowID
on getOutlookWindowInfoDictionaryWithWindowID:(theWindowID as string)
set myWindowID to theWindowID as number
copy the pWindowInfoDictionary of me to myWindowInfoDictionary
tell application id "com.microsoft.Outlook"
set myWindow to (get window id myWindowID)
set myWindowObject to the object of myWindow
set myWindowClass to (the class of myWindow as string)
set kWindowInfoWindowID of myWindowInfoDictionary to myWindowID
set kWindowInfoWindowClass of myWindowInfoDictionary to myWindowClass
if myWindowObject is not equal to missing value then
set myMessageID to id of myWindowObject
set myMessage to (get message id myMessageID)
set myMessageClass to (the class of myMessage as string)
set kWindowInfoMessageID of myWindowInfoDictionary to myMessageID
set kWindowInfoMessageClass of myWindowInfoDictionary to myMessageClass
end if
end tell
return myWindowInfoDictionary as record
end getOutlookWindowInfoDictionaryWithWindowID:
on getOutlookFrontWindowInfoDictionary()
set myWindowID to my getOutlookFrontWindowID()
set myWindowInfoDictionary to my getOutlookWindowInfoDictionaryWithWindowID:myWindowID
return myWindowInfoDictionary as record
end getOutlookFrontWindowInfoDictionary
on run
tell application id "com.microsoft.Outlook"
set myDict to my getOutlookFrontWindowInfoDictionary()
log myDict
set myClass to the class of the front window as string
log myClass
end tell
end run
The Log Results for this are as follows:
(*kWindowInfoWindowID:150, kWindowInfoWindowClass:window, kWindowInfoMessageID:, kWindowInfoMessageClass:*)
(*main window*)
(*kWindowInfoWindowID:161, kWindowInfoWindowClass:window, kWindowInfoMessageID:1750, kWindowInfoMessageClass:outgoing message*)
(*draft window*)
(*kWindowInfoWindowID:163, kWindowInfoWindowClass:window, kWindowInfoMessageID:1190, kWindowInfoMessageClass:outgoing message*)
(*window*)
What am I doing wrong in my Script to make it return the wrong class?
Thanks a lot for looking at this.
All the Best
Dave
> On 28 Feb 2016, at 20:11, Christopher Stone <email@hidden> wrote:
>
> On Feb 28, 2016, at 13:55, Dave <email@hidden> wrote:
>> Does anyone know of a reliable way of telling the Class or Type of an Outlook Window? By this I mean one of the following:
> ______________________________________________________________________
>
> Hey Dave,
>
> You've tried this?
>
> tell application "Microsoft Outlook"
> class of front window
> end tell
>
> --
> Best Regards,
> Chris
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden