• Using NotesUIWorkspace

    By Nathan T Freeman/NotesOSS 2 decades ago

    I notice the GetWindowTitle feature in the Lotuscript version uses a NotesUIWorkspace. Has this been tested to ensure that it doesn't interfere with the execution on server-only (scheduled, for instance) agents?

    • Somewhat tested, although more is welcome

      By Julian Robichaux 2 decades ago

      Nathan -



      I'd say it's "somewhat" tested, although I'd certainly welcome more testing (I've tried a backend agent, a scheduled agent, and a web service all on a server).



      I know that you can read code, but for anyone else who's reading this thread and doesn't have the code in front of them, here's what happens:


      1. Check to see if there is a session.CurrentAgent object. If so (which should be the case for all server processes like backend/scheduled agents and web services), don't even go to the new method where we're looking for NotesUIWorkspace.


      2. If we do end up in the GetWindowTitle function, Dim the local workspace variable as a VARIANT, not a NotesUIWorkspace. This is what used to screw up the server agents (not sure if it still does, but just in case).


      3. Try to set the workspace variable to a New NotesUIWorkspace. We're using On Error Resume Next here, so if anything completely unexpected happens, we shouldn't crash or totally dump out.


      4. If we successfully set the NotesUIWorkspace reference, look for CurrentDocument and CurrentView. That should catch most of the cases where we're not running an agent.


      5. If none of that works, default back to the old "[View or Form Action]" document title.



        The problem with older versions of Notes (I think it got fixed somewhere in the Notes 6 codestream) was that just doing a "Dim ws As [New] NotesUIWorkspace" in a backend agent caused things to blow up. These days Notes is much more well-behaved, and I tried to protect against error conditions before I even go down the NotesUIWorkspace route.



        But again, more testing would be great. Thanks!


      6. Julian
    • By Martin Pradny 2 decades ago

      I'm using OpenLog for quite a while and now I got first problems regarding to GetWindowTitle - one customer running 8.0 on Suse Linux. The agent cannot load the library (throwing USE/USELSX error). I've removed this part end it work afterward. Tested same agent on other servers with no problems, weird.



      Martin