- *** New Scripting Syntax: Isn't that the fun of playing with beta-versions? You are part of the flow! Now, for example, you can throw all your old scripts into the garbage and start from scratch! :) I decided to make XY scripting look like most scripting nowadays looks, e.g. JavaScript, CSS, PHP. Statements are separated by ";", function arguments by ",", quoted separators do not count as separators, etc.
Here are the new rules for XY scripting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- commands are separated by ;
- spaces around ; are ignored
- arguments are separated by ,
- spaces around , are ignored
- arguments containing ; or , must be quoted
- arguments that shall begin or end with spaces must be quoted
- all arguments can be quoted
- if quoted arguments contain quotes all inner quotes must be
doubled
Watch especially the following changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- The script marker :: at the beginning of a script is not
necessary anymore but still can be used without problem. There
is, however, still one important use: Only if you prefix a
script with :: you can run it through a location interface
(Address Bar, Goto, Catalog (Goto), Favorites, UDC Goto).
Example:
::set $a, ";"; msg $a;
Paste it into the address bar and press enter.
- The commands copytext, copytexta, msg, text, and set: they do
*not* get special treatment anymore! If their last argument
contains a separator the argument has to be quoted -- just like
with any other command.
- You do not have to put a space behind the , (argument separator)
anymore (but you can).
- Arguments that are in quotes are auto-unquoted. So, if you want
an argument to stay in quotes you have to double-quote it:
::text ""in quotes""
- Captions and Labels in XY script files (XYS) have to be done
slightly different now, namely quoted:
"Caption : Label"...
This is simply prefixed to the script proper, for example:
"Go to C root : croot" goto C:\
"Go to C root : croot"goto C:\
"Go to C root : croot" goto C:\
"Go to C root : croot"
goto C:\
As you see, the spaces after the caption are optional.
Examples
~~~~~~~~
Typical vanilla scripting:
goto Desktop|; sortby m, d; sel 1; focus List;
These are all okay and identical:
msg "Quoted" "Sep,Sep" Unquoted
msg "quoted" "sep,sep" unquoted;
msg ""quoted" ""sep,sep"" unquoted"; (*)
msg """quoted"" ""sep,sep"" unquoted";
(*) Note that this works without dbl-quoting "quoted";
however, it would fail if "quoted" contained a separator.
To be on the safe side always dbl-quote inner quotes.
These arguments MUST be quoted because they contain separators
goto "C:\path,with,commas"
goto "C:\path;with;otherstuff"
goto "C:\path, with; otherstuff"
copyto D:\,"E:\My;File.txt"
This is easy now (was not possible with old syntax):
set $a, ";"; msg $a; ($a = ;)
set $a, """"; msg $a; ($a = ") - - Stepping: dropped command "sep". Not necessary anymore.
- * Stepping through a Script dialog: "Continue Script without Stepping" (in the button context menu) now also disables stepping mode that was previously set by the "step" command.
- + Scripting commands enhanced:
- new
Added a 4th optional parameter "r":
Syntax: new name, [file|dir], [source], [r]
r = invoke rename mode after creation
So, the new default now is to NOT invoke rename mode.
- selpos (now: sel)
Renamed it to "sel" (selpos still works), and added a new
selection method by pattern, and a new optional argument
"count".
Syntax: sel (position)|("pattern")|a|i|f|, [count=1]
- "pattern": If the argument is quoted the next (below current
position) matching item is selected. Note that it does
not wrap around to the top of the list when the bottom
is reached.
Pattern can have wildcards * (0 or more chars), ? (1 char),
and # (1 number). To match the character "#" you have to state
"[#]" in the pattern. It's the same rules as in Find Files.
- count: If any item was selected then "count" items are
selected starting with the first item. If omitted, count
defaults to 1. If set to zero, the sel command can be used to
move the focus in a list with no selections.
Examples:
::sel ""*hi*"", 3
Selects the next file below the current position that
matches "*hi*". If no match is found all selections are
removed. If there is a match, the this item and
the next 2 are selected.
::sel +6, 6
Selects six-packs of files one after the other.
::sel +1, 0
Moves the focus to the next position, but does not select.
::sel 12, 0
Moves the focus to position 12 (or on the last if
less items in list), but does not select. - + New variable: <clipboard> = current clipboard contents.
The returned format depends on the clipboard contents:
- File items: one item per line, CRLF ends a line.
- Text: the text.
- Else (e.g. empty, or images): nothing.
Example:
::copytext Hi!;msg <clipboard> - + Scripting command "msg" now shows a UNICODE aware message box: you will see Chinese. Getting ready for the Olympics...
- ! Only the first occurence of variable
(modified date of current item) was resolved. Fixed. - + Tabs: Now the tooltip tells you about Locked, Locked Home Zone, and Home.
Monday, February 11, 2008
v6.80.0070 - 2008-02-11 22:07
Entry Type: Beta Update Posted by XYplorer user : J_C_Hallgren at 4:07 PM