Tuesday, October 21, 2008

v7.70.0004 - 2008-10-21 14:41

  • + Scripting got a new function.
      Name:   WriteFile
      Action: Write data to file.
      Syntax: writefile(filename, data, [on_exist], [mode])
        filename: file full path/name;
                  will be created if does not exist yet
        data:     string data to write
        on_exist:
          o: [default] create new file/if existing: overwrite
          a: create new file/if existing: append
          n: create new file/if existing: do nothing
        mode:
          t: [default] text ASCII (1 byte per char);
             wide chars (upper Unicode) are represented by "?"
          u: utf16: 2 bytes per char; with LE BOM at file beginning
             LE BOM = Little Endian Byte Order Mark: 0xFFFE
          b: binary: raw bytes (also 2 bytes per char, but no BOM)
        return: 1 on success, 0 on failure
      Examples:
        ::$a = writefile("C:\Temp\test_A.txt", "text");
          Creates a 4 byte file.
        ::$a = writefile("C:\Temp\test_A2.txt", "text ".chr(20000));
          Creates a 6 byte file.
        ::$a = writefile("C:\Temp\test-U.txt", "text ".chr(20000), ,"u");
          Creates a 14 byte file (2 bytes BOM + 2 * 6).

    Note: WriteFile() is implemented as a function (instead of a statement) because the return value will be useful once If/Then blocks are implemented. You may, however, call functions without using a dummy variable. See here below.
  • + Scripting: Now you may call functions without caring for the return. For example,
      ::writefile("C:\Temp\test_A.txt", "text");
    instead of
      ::$success = writefile("C:\Temp\test_A.txt", "text");
    Internally, the dummy statement "call" is prepended:
      ::call writefile("C:\Temp\test_A.txt", "text");
    In step mode you will see the return of writefile() as argument of
    "call".
  • + Scripting: Comparisons now support the Like (LikeI) operator.
    General form:
      String Like Pattern (case-sensitive)
      String LikeI Pattern (case-insensitive)
    Where string is any string expression and Pattern may contain the usual wildcards and special chars used in XY patterns (*?#[]).
    Examples:
      ::echo "abc" Like "a*"; //1
      ::echo "Abc" Like "a*"; //0!
      ::echo "Abc" LikeI "a*"; //1!
      ::echo "It's " . (<date> Like "20??"?:"not ") .
        "the 21st century";

    Note that capitalization matters: "LIKE" or "Likei" won't work.
  • * File List: From now on, "Rename On Slow Double-Click" (menu View List Style) will only happen when no other than the clicked item is selected. This is a wonderful and relaxing detour from the Windows Explorer standard where clicking on any out of a bunch of selected files will enter rename mode -- did you really ever want this to happen??