Thursday, September 18, 2008

v7.60.0015 - 2008-09-18 12:47

  • +++ Scripting proudly presents its first function!
      Name:   quote
      Action: Double-quote a string.
      Syntax: quote([string])
              return: quoted string
        ::msg quote("a"); // "a"
        ::msg quote(1);   // "1"
        ::msg QUOTE(1);   // "1"
        ::msg quote();    // ""
        ::msg quote;      // quote
      Of course, nesting and concatenating is no problem:
          msg "Quotes added using function quote(): $a";

      Notes on functions
      (1) Function names are not case-sensitive: QUOTE() = quote().
      (2) Even without any argument -- e.g. quote() -- the parentheses
          are mandatory, else the function is not recognized.
      (3) Functions are not interpolated when inside double-quotes.
          ::$a = "clever"; msg "Wow, quote($a)!";
            = Wow, quote(clever)!
          ::$a = "clever"; msg "Wow, ".quote($a)."!";
            = Wow, "clever"!
      (4) Step Mode: Functions are individually stepped. The current
          script line is marked green when a contained function is
          stepped as opposed to the main command of the line.
          You can even skip (button Skip) functions individually, in
          which case the function name is returned with the resolved
          arguments. For example:
            ::msg quote(chr(64));
          If you continue both functions the result is:
          If you skip chr() and continue quote() the result is:
          If you continue chr() and skip quote() the result is:
          If you skip both functions the result is:
      (5) Step Mode: When you "Continue without Stepping" on a function,
          the stepping is only suspended for all functions in the
          current script line / command.
  • + Scripting got a new function.
      Name:   chr
      Action: Return a specific character.
      Syntax: chr(charcode)
              charcode: valid range 0-65535 (0xFFFF)
              return: character
        ::msg chr(88).chr(89);
        ::msg chr(28888); // looks Chinese to me
        ::msg quote(chr(28888)); // yep, of course you can mix 'em
        Values outside the valid range but inside 32 bit are silently
        corrected using a bit mask (AND 0x0000FFFF). Values outside 32
        bit are set to 0.
  • + Scripting got a new function.
      Name:   confirm
      Action: Pops message box with OK/Cancel, returns result.
      Syntax: confirm(message)
              return: 1 on OK, 0 on Cancel
        ::msg confirm("Ok?");
        ::msg "You pressed " . (confirm("Ok?")==1?"OK":"Cancel") . ".";
        ::msg confirm("Ok?") . confirm("Are you sure?");
  • + SC "input" in its single-line variant would accept multi-line default values, e.g. when the default was retrieved from clipboard as in:
      ::input $a, "Enter URL", <clipboard>;
    Fixed: Now only the first line is taken in such cases.
  • + Scripting | Step dialog: Now you can view a list of all variables currently on the stack. There is a button which is only shown when there are any variables. You may also use the context menu, or simply press "V".
    Note that if the Step dialog is used for showing an error message, currently no variables can be shown. Might be added later.
  • * Scripting | Step dialog: Some design changes.
  • + Scripting: Now commenting is supported everywhere. So you can paste this into the Address Bar and it will work:
      ::msg /*they can be inserted anywhere!*/ "hi!" /* anytime */;
    Same for Favorites, PFA/POM, and wherever Quick Scripting is supported.
  • * Scripting: Comparisons are now done as in PHP. The rule is: "If you compare an integer with a string, the string is converted to a number. If you compare two numerical strings, they are compared as integers."
      ::msg (0 == "a");     // 0 == 0 -> true
      ::msg ("1" == "01");  // 1 == 1 -> true
      ::msg ("1" == "1e0"); // 1 == 1 -> true
      ::msg ("1" < "2");    // 1 <> true
      ::msg (" 1" < " 2 "); // 1 <> true
      ::msg ("-2" < "-1");  // -1 < -2 -> true
      ::msg ("0"?"true":"false"); // 0 -> false
      ::msg ("2"?"true":"false"); // 2 -> true
      ::msg ("a"?"true":"false"); // 0 but not "0" -> true!!
    If both parts are non-numeric then the comparison is alphabetical:
      ::msg ("2a" < "10a"); // -> false!
    The valid range of compared integers is -2147483648 - 2147483647 (32 bit). Numbers outside that range are silently converted to 0 (zero) before the comparison takes place.
  • ! Scripting: Closing the app while a script was running could lead to a crash. Fixed.
  • ! Scripting: A comment like /* ' */ (containing a single or double quote) would take out everything following it. Fixed.
  • ! List: Doing menu Go | Up while a long search (> 500 msecs) was in progress would lead to a confused list. Fixed: Now this action will first stop the search. Then you have to Go Up again to continue.