Page 1 of 1

Script popup instead of running

Posted: 06 Apr 2016 15:14
by e-volusian
Hey all, I use xyplorer every day but never got into the scripting. Am now trying this very simple script:

Code: Select all

$orig_path=<curpath>
msg $orig_path
I save this as:

C:\Users\me\AppData\Roaming\XYplorer\Scripts\test.xys

Then type:

::load "test.xys";

In xyplorer address bar.

Expected result: a message box that says the current path.

Actual result: a popup with two lines that are each of the two lines of the script. I can click on each of those lines and it seems to execute that line only.

This seems to me like it might be the result of "Step Mode" however Step Mode is definitely NOT turned on (no check next to it in the Scripting menu-bar drop-down).

What am I doing wrong?

[mod edit: title adapted, script in code blocks]

Re: Very newbie question - script popup instead of running

Posted: 06 Apr 2016 15:24
by highend
Welcome to the club.

1. Script commands generally end with ";"
2. Scripts needed to be indented
So, e.g. indent both lines by e.g. 4 spaces (at least one space or tab, while the first script command line doesn't need to be indented. And there are a few other exceptions (read the help file for more details, especially on multi-line scripts, labels...)

E.g.:

Code: Select all

$orig_path=<curpath>;
    msg $orig_path;

Re: Script popup instead of running

Posted: 07 Apr 2016 16:28
by bdeshi
highend wrote:E.g.:

Code: Select all
$orig_path=<curpath>;
msg $orig_path;
Rather, it looks better if the first line of a script is also indented.

Code: Select all

    $orig_path=<curpath>;
    msg $orig_path;
You should separate different scripts with labels.

Code: Select all

"script 1"
    $orig_path=<curpath>;
    msg $orig_path;
"script 2"
    $orig_file=<curitem>;
    msg $orig_file;