How to abort/break/cancel/exit script execution by script code?

How to abort/break/cancel/exit script execution by script code?

5
NewbieNewbie
5

    Nov 23, 2016#1

    I want to abort/break/cancel/exit a script execution by script code, i.e. after user input via getstring(), I want to abort further processing of the script, depending on input value. I can use if-else(){}, but I want to use abort script command.

    I searched the help and the forum but could not find it.

    Please guide.

    Regards, Anand

    6,681583
    Grand MasterGrand Master
    6,681583

      Nov 23, 2016#2

      Put your entire script code into a function. And main part of script exists of only calling this function. This makes it possible to use in the function return; whenever you want exit the script.
      Best regards from an UC/UE/UES for Windows user from Austria

      5
      NewbieNewbie
      5

        Nov 24, 2016#3

        Thanks a lot Mofi for the tip. I hope this will help many script programmers here who do not know about it, I am one.

        I am using below code to cancel a script. Is there a way to use "YesNoMsgBox" thing for it?

        Code: Select all

        yesno = UltraEdit.getString("Confirm delete lines : (y/n) ",1);
        if( yesno != "y")
        {
           return false;
        }
        
        Regards, Anand

        6,681583
        Grand MasterGrand Master
        6,681583

          Nov 24, 2016#4

          Anand wrote:Is there a way to use "YesNoMsgBox" thing for it?
          There is only UltraEdit.getString() and UltraEdit.getValue() built-in available in UltraEdit.

          And there is New Dialog: Options() for a script customizable dialog with a list box.

          The macros and scripts features in UltraEdit are mainly for reformatting text data automated with no or an absolute minimum of user interaction. For that reason there are not many commands available which interact with a human user using the UltraEdit macro/script.
          Best regards from an UC/UE/UES for Windows user from Austria