Hi,
***Cross posted as it relates to both technologies***
I’ve asked this question before, but no one seems to know the answer. I’ve been
hacking around with this both in an AppleScript and from Objective-C using the
Scripting Bridge as well as the AppleScriptObjC Bridge, but nothing I’ve tried
works, so if anyone has *any* idea how to make this work I’d be so happy to
hear from you,
on run
tell application id "com.microsoft.outlook"
activate
set myTrickFlag to false --Set to true to close and open the
window
set myWindow to the front window
if class of myWindow is not draft window then
return "Error not Draft Window"
end if
save myWindow
set myObjectID to the id of (object of myWindow)
set myContent to the plain text content of message id myObjectID
set myContent to myContent & return & "Line Added" & return
set the plain text content of (message id myObjectID) to
myContent
--
-- Doing this is the only way I can find to make the update
appear in the window
--
if myTrickFlag = true then
close myWindow without saving
open message id myObjectID
end if
end tell
end run
When I run this with myTrickFlag = false, you can see the message get updated
in the Main Outlook Message Browser Window, but the Draft window that contains
the text is NOT updated. If the user saves the window at this point, the
updated content is lost.
Under normal circumstances (e.g. not running a Script), Outlook would I
suppose, would copy the window to the message at the appropriate point, so, if
I could do the operation on the window version of the data, I suppose this
stands a good chance of getting into the content, or I could just change both.
I suppose I could keystroke into the content field, but I’ve been avoiding
doing that as this is running in a time critical part of the code and I want
the best performance as possible. I am assuming that keystroking is way more
time consuming that just setting the data, please correct me if I’m wrong.
I’ve also got the Scripting Bridge setup, so I can poke directly at the exposed
properties, so if anyone can think of an event I could send that would do the
trick please let me know.
The other thing that occurs to me is that I can get the Global Window ID, so
could drop into CF/CG if necessary.
From my experimenting, I added this SB Code:
myObjectPropertiesDictionary = myDraftObject.properties;
//Equivalent of myDraftObject - the”object” property of the Draft Window in the
above AS
NSLog(@"%@",[myObjectPropertiesDictionary allKeys]);
myContentString = [myObjectPropertiesDictionary
objectForKey:@"plainTextContent"];
[myDraftObject setValue:myNewContentString forKey:@"plainTextContent”];
When I run this code, I get the following properties logged, but it crashes on
the setValue:forKey statement as the class is not key-code compliant. Is there
a way I can make use these properties to set a new value?
hasHtml,
sender,
id,
headers,
isPartiallyDownloaded,
repliedToAll,
subject,
smimeSigned,
timeSent,
modificationDate,
isRightsProtected,
account,
redirected,
folder,
sendReadReceipt,
priority,
objectClass,
dueDate,
timeReceived,
isMarkedForDelete,
source,
imapUid,
smimeEncrypted,
reminderDateTime,
edited,
isRead,
completedDate,
content,
isMeeting,
todoFlag,
plainTextContent,
repliedTo,
categories,
wasSent,
isReadReceiptRequested,
forwarded,
startDate,
exchangeId
Anyway, if anyone has anything that they think might stand a chance of working,
please let me know!
Thanks a lot,
All the Best
Dave
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]