Script wizard bug in 1.0.0.2

Support for xplorer² free lite version

Moderators: fgagnon, nikos, Site Mods

rogers
Member
Member
Posts: 11
Joined: 2004 Jul 18, 11:10

Script wizard bug in 1.0.0.2

Post by rogers »

Hello,

there is something wrong with the Script wizard:

When I have two files selected on Drive F: and add "G:\Programs\ExamDiff\ExamDiff.exe $A" to the Template box and press "Preview", I get:

G:\Programs\ExamDiff\ExamDiff.exe "F:\Test\Copy of Test.txt" F:\Test\Test.txt
...

That's OK (what's the reason for the ... ?), but the whole command will be executed twice.

When viewing the batch with "Edit", it becomes clear why:

@echo off
cd "F:\Test"
F:
G:\Programs\ExamDiff\ExamDiff.exe "F:\Test\Copy of Test.txt" F:\Test\Test.txt
G:\Programs\ExamDiff\ExamDiff.exe "F:\Test\Copy of Test.txt" F:\Test\Test.txt

The command was added twice.
The lines two and three are also in the wrong order, because you have to change the drive before you cd to another folder.

Using the whole command in the address bar works fine, btw.

Bye
User avatar
nikos
Site Admin
Site Admin
Posts: 16295
Joined: 2002 Feb 07, 15:57
Location: UK

Post by nikos »

that's exactly what happens when you use tokens out of context :)
see tip # 108 in x2tips.rtf
rogers
Member
Member
Posts: 11
Joined: 2004 Jul 18, 11:10

Post by rogers »

nikos wrote:that's exactly what happens when you use tokens out of context :)
see tip # 108 in x2tips.rtf
Mmff, OK, sorry :-(

But this order is wrong:

cd "F:\Test"
F:
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

rogers wrote:
nikos wrote:that's exactly what happens when you use tokens out of context :)
see tip # 108 in x2tips.rtf
Mmff, OK, sorry :-(

But this order is wrong:

cd "F:\Test"
F:
Well, 'wrong' is not the right word here, because it does work!! It seems more logical to first go to drive F: and then do the changeDir, but it is not required.

CD changes the current folder on any drive. The command prompt doesn't actually have to be focused on that drive. So the sequence is quite valid. 8)

In Win2000 and up, you can also do this in one step, like this:

Code: Select all

cd /d "F:\Test"
This will get you to the folder in one step, doesn't matter where you started from.
Quotes are optional here because there are no spaces in the path specification, but it's good pratice to use them always (especially in scripts where you can have a variable path to be CD'ed to :) )

Note this won't work in Win9x (and ME I believe), because the '/d' parameter is not supported by the command processor of those Windows versions. [Edit:add]That is to say: command.com doesn't support this switch, but cmd.exe does :) [/Edit]
Last edited by JRz on 2004 Jul 19, 14:09, edited 1 time in total.
Dumb questions are the ones that are never asked :turn:
User avatar
nikos
Site Admin
Site Admin
Posts: 16295
Joined: 2002 Feb 07, 15:57
Location: UK

Post by nikos »

didn't know that!