intermittent failure in script execution

intermittent failure in script execution

4
NewbieNewbie
4

    Jul 19, 2007#1

    I have a script which automatically generates and autonumbers memo template files for me. It reads a master memo template file, searches for the memo index number which appears in two different locations, increments the numbers, then saves the master template. It also saves a copy of the now updated memo template to a new file which contains the new memo number as part of the filename.

    It is very handy for cranking out a new memo, with file name and memo sequence number automatically numbered, and ready to fill in.

    The problem is that, under conditions I have not been able to identify (I haven't checked the phase of the moon yet, nor the level of oil in my car), the script will fail. I will get a (script-generated) error message that the memo number could not be found. It will continue to fail on subsequent executions. However, I have noticed that if I have the memo template master already open, the script will execute successfully. And it will continue to execute successfully after I close the master template file--until... what? maybe the number of jelly beans on the cute administrative assistant's desk reaches an even number again? Or something like that.

    Does anyone else have a problem with intermittent failure of scripts? (Probably it's related to the find operation.)

    262
    MasterMaster
    262

      Jul 19, 2007#2

      Hmm scripting is still a new feature of UE and has some known bugs here and there. But I do not experience intermittent failures as such.

      6,687587
      Grand MasterGrand Master
      6,687587

        Jul 19, 2007#3

        For me it looks like this is an internal synchronization problem as it also have existed for some macro commands in the past. For example on opening a file many steps are done in the background like checking file format, line termination with conversion to DOS or not, encoding, wrapping, syntax highlighting, updating function list, updating auto-complete list, execute macro (because one is specified for "OnLoad"), ...

        If the script engine continues before all this procedures have finished, the next script command(s) can fail. So I guess, there are some internal "synchronization" problems between all the threads and procedures executed for some commands and the script engine.

        Well, I'm not familiar with the Windows task and thread handling mechanism. I only know about the principles because I have written a small real-time operating system for one PCB of our protective devices where such problems must be also avoided by using semaphores and interrupt routines called by other programs already running. That's really not easy to handle (especially in real-time).
        Best regards from an UC/UE/UES for Windows user from Austria