UI Scripting of Lotus Notes...anyone?

Are there any brave souls who have ever tried to UI script this wierd application?

I’m trying to get it to send a pre-preared e-mail, but have two problems:

–There is no keyboard shortcut to send mail

–The menus UI Browser is revealing do not match the actual ones available on screen. UI Browser (and UI scripting) seem to be “seeing” some phantom, behind-the-scenes menus and options, and the one I want isn’t among them, :-/

I can explain the problem in excruciating detail if anyone has any experience in this area.

Calvin,
Wish I could help more, but I’ve also tried to script that beast and eventually gave up. Isn’t that dictionary a treat?

:mad:

Mark

Yeah the Notes dictionary gave me hives…lots of commands, no clue as to the syntax, depsite dozens of tried iterations. Honestly, the commands and properties look very java-like, though I don’t think Notes is based on Java (nor do I think Domino is based on Java). Which is why I tried to UI script but keeping hitting my head on invisible low overhangs while negotiating the corridors. :stuck_out_tongue:

I think it may have something to do with the server-side nature of Notes and it’s database and programmability aspects, and the fact that Notes has never been a very Mac-friendly port of Windows software. I was suprised it had a dictionary at all.:wink:

Kevin,
This helper function was recently posted at MacOSXHints, and it really works well with Lotus Notes for UI scripting:

A better way to activate menu items from AppleScript
http://www.macosxhints.com/article.php?story=20060921045743404

I replaced a UI tool that I had been using with Notes, and the solution above is SO much faster to execute. I hope this helps you out!

Mark

Well the problem isn’t selecting menus per se, it’s selecting the right one. For reasons beyond my comprehension AppleScript (and by nature Prefab’s UI Browser) “see” a different set of menus than the user does. This “phantom” menu set doesn’t have the commands I need, and of course no keyboard shortcuts.

I can’t give a super-clear example but basically if say the third menu item in the 6th menu set was, for example “Reply” to the user, but System Events/AppleScript/UI Browser all see “Actions.” Exploring using UI Browser I discover “Reply” isn’t even showing up, despite clearly being available to the user.

It’s all very, very odd. In the interim I’ve made the entire automation two steps instead of one so that the user can get past the part I can’t automate.

Hi Calvin and Mark,

I’m not sure if this will help or not, but on occasion I’ve used Lotus’ example applescripts that can be found at this link:

http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/e6621c730727e8a3852567f4007eaba1?OpenDocument&Highlight=0,applescript

Like the two of you, I’ve played with the idea of scripting LN, but have never had the patience for it!

PC

Well, and I just realized these examples are for R5, and we’re on R6.5. :confused:

Any idea where to find this “Lotus Notes Programmer’s Guide” that is reference both in the URL you gave and in the documentation provided with the examples?

I love the way the examples are provided as a Notes file (.nsf) rather than as actual AppleScripts. IBM still doesn’t quite get it. :stuck_out_tongue:

As luck would have it, I’m revisiting this project. Works fine, but now needs some new modifications due to process changes. So now would be a good time to streamline it if I can.

Hi Kevin,

I saw that the nsf file was in R5, but I use plenty of templates from R5 without any trouble, so I thought I’d send along the link. I did some hunting around, and saw that the Programming Guide is only available as a manual–and an expensive one at that! Maybe you could find it in a second-hand book shop, or in your IT Dept for free!

After looking at your response I had a look at scripting LN myself…and all the memories (or should I say, nightmares!) started coming back. What is strange is that the examples they give in their beloved notes structured format actually do compile, they just don’t do anything. This tells me that the AS dictionary was never fully implemented–you can see this from time to time with some apps. Sorry about sending you on a wild goose chase!

What sorts of things are you trying to UI script? I know that the LN 6.5 client for the mac actually allows some of the functionality of Domino Designer, which means you can design and edit some features of the databases and templates. Oftentimes the agents will do the trick as well.

My gripes with LN tend to be on the email side of things, which is why I just use OS X Mail app to do the mail side of things and then switch to LN for calendars, etc.

Patrick

Oh I still planned on checking them out when I got a chance. Figured it couldn’t hurt.

Well, for various confidential reasons, my IT department isn’t an option. Any chance you have a link for the book? Depending on what “expensive” is, I might be able to get my manager to spring for it. You should see the collection of AppleScript and FileMaker books I’ve amassed in the last couple of months because of scripting and database projects. :wink:

Yeah it may “technically” be AppleScript, but it doesn’t follow the premise of “English language” syntax very well. Their names for things are really whacky, even worse than stuff I’ve seen Microsoft do. O.o

I’ll still check em out. As for “never fully implemented” AppleScript, I’ve never seen it. Notes would be the first time if that’s the case. :stuck_out_tongue_winking_eye:

I have seen commands listed that don’t work in software, but the dictionary has always been explicit about it being “not implemented yet” or depricated in some fashion.

Figures…I’m after the e-mail side. It’s our corporate e-mail, so I have no choice in the matter. Just trying to do simple things like Reply or Create New Mail or Send, fill in e-mail fields, and highlight text within the e-mail.

My current script manages to Reply, but only if the e-mail being replied to is the third “tab” open…if it’s any other tab, it doesn’t work for some reason. I can train to that, annoying as it is. It probably stems from using UI scripting, but having to do it somewhat “blindly” because the UI references and the current state of menues never matches…it’s as if Notes “displays” one thing, but “behind the scenes” is doing something else. At least the best way I can describe it based on hours poking around.

Create New Mail doesn’t work, nor does Send. Despite being menu commands, UI scripting can’t “see” them.

Highlighting or otherwise manipulating text within the mail window has to be done by UI scripting and extracting to the clipboard, then off to another editor (like TextEdit), and back to Notes. Awkward and slow, but functional.

Hi Kevin,

I’ve been looking at this over the past few days, and I’m finding I can actually do some things here. A bit of background first…

I did a clean install of 6.5.3, and imported my old LN settings. I then used LN to open the AppleScript Sample nsf. Magically, as I copied and pasted the scripts into the editor and ran them, they all worked! As I began looking at the scripts, it looked as if they simply referenced items in the LN database. It is important to remember that the email funtion in LN is just an extension of Notes databases–which is why it can be so frustrating to do things in Notes mail that other programs handle simply. However, given these new discoveries, I think I may be able to script this thing.

To convince yourself of this, have a look at the sample scripts, then switch to LN. Select a document and then view the properties of the document (File–>Document Properties…). A floating window will come up, and you can look at the field properties in that window. You will notice these are the names used to AppleScript LN. Very interesting! What you’ve described could be straightforward with these references.

I’ll update you after (and if) I do anything substantial to help you out. Feel free to have a look too. Right now it is time to shut down for the night in Germany!

Patrick

Well, direct scripting of Lotus Notes is now off-limits in my book. I tried their send e-mail script…


property ToAddress : "Joe_User@iris.com"
property CCAddress : "Joe_User@iris.com"

tell application "Notes"
	set myDB to make new database with data {"", ""}
	try
		openmail myDB
	on error
	end try
	
	set myDoc to make new document with data {myDB}
	replaceitemvalue myDoc itemname "SendTo" newvalue ToAddress
	replaceitemvalue myDoc itemname "Subject" newvalue "Untitled"
	replaceitemvalue myDoc itemname "Body" newvalue "I'm actually trying to send this one"
	replaceitemvalue myDoc itemname "CopyTo" newvalue CCAddress
	send myDoc without attachform
end tell

…and it was like AppleScript Shop of Horrors:

–First time I tried, it seemed to do nothing, then destabilized Notes, then Script Debugger, then Notes wouldn’t relaunch, requiring a reboot of the system. That never happens. As in, the first time anything like that has happened since the OS 9 version of Notes.

–After the relaunch, apparently it actually did send the e-mail to the Joe address in the sample (oops!) because I got a bounce. But what scares me is it apparently bypassed the normal e-mail mechanism because there was nothing in my “sent” folder. This is corporate bad-mojo and I’ll be lucky if I don’t get an annoyed phone call soon from IS since we’re not supposed to tamper with the underpinnings like that. Good thing I’m on good terms with IS… O.o

–I decided to try-again (commenting-out the last line which seems to do the sending), and Script Debugger had issues opening the AppleScript dictionary for Notes. It could compile the script, but attempts to save it would cause ScriptDebugger to hang, requiring a force quit. I’ve had to force quit Script Debugger now and again for random things, but never 100% repeatable like this.

–Compiled the script in Script Editor and saved it well enough. But did nothing on execution…or apparently nothing. It might have done more “background magic” but without the “send” line nothing came of it. Then Notes and Script Editor both promptly crashed.

Sounds like a damaged or malformed dictionary issue, at the very least; poor AppleScript support also likely.

Admitedly my company’s way of doing things is often non-standard in their perpetual goal of uber-security and customization, so it’s possible my company’s fiddling on the back-end or in the NotesID file is the culrpit. Still, I never see applications do the wierd stuff Notes does (and we’re not talking just AppleScript here).

Frankly, that’s enough to make me stick to kludgy UI scripting. I don’t have the luxury of a re-install because of the quirkyness of the software and corporate needs it would mean blowing 30-60 minutes of the tech’s time. Been there, done that, painful it was. Notes has a come a long way since OS 9, but apparently still needs work. :frowning:

Ah well, I have a laundry list of things I hate about Notes, this is just another checklist item. :stuck_out_tongue:

[EDIT: Forgot to mention, when I go into any of the various “property” items scattered in Notes, none of them give me any field information. This is a corporate system (i.e. the databases generally live server-side) so it’s possible I’m not allowed to see that information.]

Hi Kevin,

I’ve been looking at this off-and-on over the past couple of weeks, and then the REAL situation dawned on me. What is actually going on in that AppleScript delivering LotusScript commands to LN. THAT is why there is no real AS library, and everything seems a black-box with no clear descriptions etc. Once I realized that, I was able to get a few things going based upon their sample scripts, but nothing of any value. I can tell you that using their sample scripts “as is” would probably cause the problems you described since LN would hang the system while looking for a server. In other words, you would need to provide your actual LN server and mail file in the AS to get LN to do anything. For example,

property mailServer : “Your/LN/Server” --this needs to be a real server
property mailFile : “:maila:yourMailFile.nsf” --with your real mail file

tell application “Notes”
activate
set myDB to make new database with data {mailServer, mailFile} --this seems to create a “virtual” DB for LN to work with
set dbName to server of myDB --again, this is redundant, but makes sense if myDB is just a place-holder
set dbOpen to isopen of myDB
if dbOpen is not equal to true then
openmail of myDB
end if
set dbView to getview of myDB viewname “($Inbox)” --these commands, like others, look an awful lot like Lotus Script!
end tell
tell me to activate
if dbName is not equal to “” then
display dialog “Mail server name is: " & dbName &” "& dbOpen
else
display dialog “No server name came back”
end if

will return the appropriate server name and whether or not the mail file is open. Vanilla stuff.

The way LotusScript interacts with LN is a bit of a mystery to me. It seems to create “alias” databases on the fly using the mail file. This means that changing views and seeing things via your LN application be unlikely. Strange–but that is par for the course here.

The good news is that if you have a LotusScript wizard around, they might have a reference that can help you.

I’ll still look at this more, but I’m not as optimistic as I was a week ago :frowning: I may try some scripting through the GUI as well…though I won’t stop using OS X mail as my unofficial email interface for Notes!

Patrick

Yeah and that all kinda shoots any chances for me…aside from the Notes client itself, nothing else gets direct access to the Notes Mail server, and I need records of all sent mails (which it sounds like I can’t have short of cc’ing myself maybe).

If this was some sort of personal use or a corporate-wide initiative I’d be more curious, but since it’s neither it looks like a dead-end as far as this project is concerned. bleh

Hey I do really appreciate your help and thoughts on this, at least I know with some certainty that this isn’t a wall worth beating my head on. :slight_smile:

Hi Kevin,

I know the thread is a bit stale, but…I found a LotusScript 6 quick reference online.

http://cseh.best.vwh.net/n6classesxref.html

I’ve been able to tweak the samples (mentioned above) using the LotusScript commands, and the scripts work. I haven’t had a chance to work with them much, but I know that reading, sorting, and sending emails are all tolerably easy. It also looks like there is direct access to the user interface, calendars, notes, etc.

Could be of interest…or not!

Patrick