Page 1 of 1

Throw-away clone script

Posted: 27 Jan 2024 12:55
by Daniel0312
I want to run a long task in the background while I continue using XY.

The following code ONLY works if the $Scripfile is situated in the main instance script folder and with full path.

Code: Select all

  $cmd = <<<>>>
"<xy>" /new /readonly /win=normal /script="$ScriptFile"
    >>>;
  run $cmd, "%TEMP%", 2;
$ScriptFile = "LongTask.xys" » no OK
$ScriptFile = "C:\Users\Daniel\Desktop\LongTask.xys" » no OK
$ScriptFile = "<xyscripts>\LongTask.xys" » OK

Is it a bug or is there (again) something I don't understand ?

Re: Throw-away clone script

Posted: 27 Jan 2024 13:23
by admin
" and with full path." but later you say "no OK" at full path?

Re: Throw-away clone script

Posted: 27 Jan 2024 13:33
by Daniel0312
What I meant was that it's only OK with full path given AND if this path is the original XY script folder

Re: Throw-away clone script

Posted: 27 Jan 2024 13:35
by admin
Confusing. Show the complete script.

Re: Throw-away clone script

Posted: 27 Jan 2024 15:08
by Daniel0312
hum...
This is just a test script I arrived at after trying for a very long time to understand why my real case wasn't working as expected, and you've got it right here ! But you were right to ask for the full script !
It seems the problem is with an INCLUDE statement at the beginning of my real case "LongTask" script file.

Code: Select all

INCLUDE 'inc\Tools.xyi'
Replacing the line with

Code: Select all

INCLUDE 'E:\Partage\Mes Programmes\XYplorer\XYdata\!Scripts\Inc\Tools.xyi'
solved it.
I guess this has something to do with relative paths, and the fact that my XY folder structure isn't the default one.
The "longTask" script is actually looking for the included file in "E:\Partage\Mes Programmes\XYplorer\Data\Scripts\inc", the "default" location, when it actually in "E:\Partage\Mes Programmes\XYplorer\XYdata\!Scripts\Inc".

When it isn't found, the script just stops loading (or so it seems) and no further lines are read.
Not sure there is something really wrong there.

Re: Throw-away clone script

Posted: 27 Jan 2024 18:21
by admin
Can't tell from here, but it shouldn't be too hard to add some test lines to the script to find out what you want to know.

Re: Throw-away clone script

Posted: 27 Jan 2024 18:43
by Daniel0312
Well... a little scripting and I've found a way :)
But I feel that not finding an included file should display an error message, or at least not prevent the excecution of the rest of the script : if there's something missing the script itself will generate an error.
Thank you for taking the time.

Re: Throw-away clone script

Posted: 27 Jan 2024 18:52
by admin
It normally displays an error message, but sometimes (I haven't fully understood this yet) the error messages don't appear at startup when the main window is still invisible.

Re: Throw-away clone script

Posted: 27 Jan 2024 19:09
by Daniel0312
Now I know, next time I'll get it faster :)
Thanks again