Monday, January 21, 2008

v6.80.0030 - 2008-01-21 14:44

  • +++ Scripting: I took some time to decide about the scripting syntax to have it maximally easy, efficient and robust at the same time. Here's what I came up with.

    General Rules
    - A script begins with "::". Scripts can be concatenated to script batches:
      ::script::script::script ...
    - A script consists of a command name plus a couple of arguments separated by a separator. The separator is by default a comma (,) that MUST be followed by a blank. While the number of arguments varies between commands (some have even none), the general form of a script looks like this:
      ::command arg1, arg2, arg3
      ::goto C:\
    Abundant blanks are okay. The following line works identical as the one above.
      ::command arg1 , arg2 , arg3
    - The order of arguments is fixed and given in each command definition. Any arguments can be left out in which case the default is taken.
      ::command arg1, , arg3 'arg2 are set to the default
      ::command arg1         'arg2 and arg3 ~ ~ ~ ~ ~ ~ ~
    - If one of your arguments happens to contain the argument separator + blank, parsing would fail. In this case you have to redefine the separator by the following command:
      ::sep [new separator]
      ::sep ;::new a, b.txt; ; <curitem>
      creates a copy of the current item and calls it "a, b.txt"
    The redefined separator is valid until you redefine it again, or until the current script batch ends. IOW, it is automatically reset to comma if you call another script or script batch.
    - All predefined keywords in scripting ignore case, so A=a.
    - All arguments have leading and trailing blanks trimmed off.
    Abundant blanks are okay. The following two lines are equivalent
      ::command arg1, arg2, arg3
      ::command   arg1   ,   arg2   ,     arg3

    New Commands
    Now, let's add some flesh to the bones! A couple of important commands are now available through scripting: Goto, Open, Openwith, and New! All four work identical to the corresponding UDC categories, so you can think of them as the UDC GUI rolled out into a line of characters.
    To test the examples paste them into the address bar and Enter.

    - Goto
      Syntax: goto [target location]
         ::goto C:\
         ::goto %temp%
    - Open
      Syntax: open [item to open]
         ::open "winzip32" -min
         ::open firefox
         ::open C:\Programme\Mozilla Firefox\firefox.exe
      Note that locations containing blanks do not have to be quoted.
    - OpenWith
      Syntax: openwith [application], s|m {= single|multi instance}
         ::openwith UEdit32
         ::openwith UEdit32, s
         ::openwith UEdit32, m
      Note that "s|m" means you have the option between s and m. The first option in such kind of arguments is always the default. So in this case, passing nothing is equivalent to passing s.
    - New
      Syntax: new [name], file|dir, [source]
         ::new new file.txt
         ::new NewFolder, dir
         ::new <dyyyy-mm-dd>.txt
         ::new <curbase>_<curver>.<curext>, , XYplorer.exe
  • ! Renaming files while they are previewed. Some heavy apps like Word and Acrobat Reader did not get enough time by XY to release their documents to let them be renamed. Fixed.