Scrap / script question

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Post Reply
jorkar
New Member
Posts: 2
Joined: 2004 Feb 12, 09:17

Scrap / script question

Post by jorkar »

I'm trying to use the run command/script wizard to do following,

Use Vim to diff files, command for doing this is "gvim -d"
(I use Vim because it's ability to diff up to 4-files simultaneously)

And I want do this with files from different folders.
I figured that dropping the files I want to diff into the scrap container and run the command "gvim -d $A" should work.

The problem is that Vim starts in as many instances as number of files I want to diff.

It's really not that big deal as I just close all but one Vim-instance, but it,s anyway somewhat annoying.

Can I do this in a different way to get just one instace of Vim?

Another thing I noticed is that there is two versions of the right-click menu in the scrap container, the Windows original one and a smaller one and it seems to depend on if the files in the scrap is from different folders or not. Is that possible to configure?

Regards
Jörgen
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

Hello Jörgen,

You must be doing something different then I am, because I get just 1 instance of vim (excellent editor by the way, great job by Bram Moolenaar; for anyone who is interested and not afraid to use a vi-like editor, but definitely improved: http://www.vim.org)

I put the files I want in a scrap frame (Ctrl+S comes in very handy for this; put selected files from X2 into a scrap pane directly; creates scrap frame when non existent or uses last opened one to add items)

Then go to the address bar and type (including the '>' sign, although you could also use $, with the same result):

> gvim -d $A

It opens one instance and shows diff between files as expected.
What are you doing different?? :? I'm using the latest X2 (.57)
Dumb questions are the ones that are never asked :turn:
jorkar
New Member
Posts: 2
Joined: 2004 Feb 12, 09:17

Post by jorkar »

Hello JRz.

Thanks for the reply.

I have found that it works if I write directly in the address bar.
I was using the "ctrl-B" wizard. Anyhow shouldn't that also work?

If I do Execute Dos one instance opens but when i close that, another one comes up, how many times is depending on how many files I want to diff
But when I do Execute Shell, they all opens at once.

I'm using x2 0.57 and winXP.

--
FYI

Further investigation shows following:

I pressed the Preview button in the script wizard, and it says.

gvim -d C:\test_b\prova02.prm C:\test_a\prova01.prm
...

But when pressing edit it looks like this in the editor;

@echo off
cd "C:\test_a"
C:
gvim -d C:\test_b\prova02.prm C:\test_a\prova01.prm
gvim -d C:\test_b\prova02.prm C:\test_a\prova01.prm

Feature or bug?
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

jorkar wrote:I have found that it works if I write directly in the address bar.
I was using the "ctrl-B" wizard. Anyhow shouldn't that also work?
Yes, I guessed that was what you were trying. It does work, but gives a different result then you anticipated. 8) See my remarks below.

The reason you get the next instance of vim when you close the previous one in the DOS environment is that the commands are executed in sequence and the next statement gets executed when the previous one is finished, not sooner.
Execute by shell however doesn't wait for the outcome of the previous statement and executes them all in parallel.
jorkar wrote:Further investigation shows following:

I pressed the Preview button in the script wizard, and it says.

gvim -d C:\test_b\prova02.prm C:\test_a\prova01.prm
...

But when pressing edit it looks like this in the editor;

@echo off
cd "C:\test_a"
C:
gvim -d C:\test_b\prova02.prm C:\test_a\prova01.prm
gvim -d C:\test_b\prova02.prm C:\test_a\prova01.prm

Feature or bug?
Yes, it is a feature and thus, no, it is not a bug :p

The preview shows you only one line from the resulting batch file. What happens is this:

You select say 4 files and hit Ctrl+B.
You specify the command 'gvim -d $A' in the template box
You hit Execute (dos or shell not that much difference), X2 then creates a batch file which executes the command for each file!!

But the command itself states that all files should be appended as parameters to the gvim -d command! That's why you get 4 times a vim session which in turn compares all four files.

The direct use of the address bar is to be preferred in this case (powerful, isn't it?) ;)
Dumb questions are the ones that are never asked :turn:
Post Reply