Page 1 of 1

Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 17:35
by otis_lewd
I set up a script that takes two highlighted files in the same pane and passes those file names to a file compare program that then shows the differences between the two files. This works fine. But how do I get the script to pass one highlighted file in one pane and another highlighted file in the OTHER pane to my file compare program? What do I need to do to accomplish this? Thank you.

Here is my present script:

Action: Open selected List item(s) with specified application.
Caption: Compare 2 files
Application: "C:\Program Files\Compare It!\wincmp3.exe" <items>
Mode: Single instance (pass all the items to the same instance of the application).

The program Free Commander does this and it is really nice.

Re: Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 19:48
by admin
OK, I'm no scripting guru, but it looks like there 's a hole in the system. We have this:

Code: Select all

getinfo("Path", [pane])
Returns the unslashed path of any of the two panes.

a = [default] active pane 
i = inactive pane
1 = pane 1
2 = pane 2
Shouldn't we also have this:???

Code: Select all

getinfo("Item", [pane])
Returns the focused item of any of the two panes.

a = [default] active pane 
i = inactive pane
1 = pane 1
2 = pane 2
The otis_lewd could do:
"C:\Program Files\Compare It!\wincmp3.exe" <get item 1> <get item 2>

Re: Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 19:55
by TheQwerty
admin wrote:Shouldn't we also have this:???
No, we should have GetControlInfo().

Re: Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 19:57
by serendipity
admin wrote:OK, I'm no scripting guru, but it looks like there 's a hole in the system. We have this:

Code: Select all

getinfo("Path", [pane])
Returns the unslashed path of any of the two panes.

a = [default] active pane 
i = inactive pane
1 = pane 1
2 = pane 2
Shouldn't we also have this:???

Code: Select all

getinfo("Item", [pane])
Returns the focused item of any of the two panes.

a = [default] active pane 
i = inactive pane
1 = pane 1
2 = pane 2
The otis_lewd could do:
"C:\Program Files\Compare It!\wincmp3.exe" <get item 1> <get item 2>
True, its not there.
I use "focus PI;" after copying current pane's item. I can remove two lines of script with your new command.

Re: Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 20:03
by serendipity
TheQwerty wrote:
admin wrote:Shouldn't we also have this:???
No, we should have GetControlInfo().
I skimmed through this and looks good to me.

Re: Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 20:16
by Stefan
serendipity wrote:
admin wrote:OK, I'm no scripting guru, but it looks like there 's a hole in the system. We have this:

Code: Select all

getinfo("Path", [pane])
Returns the unslashed path of any of the two panes.

a = [default] active pane 
i = inactive pane
1 = pane 1
2 = pane 2
Shouldn't we also have this:???

Code: Select all

getinfo("Item", [pane])
Returns the focused item of any of the two panes.

a = [default] active pane 
i = inactive pane
1 = pane 1
2 = pane 2
The otis_lewd could do:
"C:\Program Files\Compare It!\wincmp3.exe" <get item 1> <get item 2>
True, its not there.
I use "focus PI;" after copying current pane's item. I can remove two lines of script with your new command.
Yes, right now we use "Focus PI" in an script.
==> otis_lewd, here are >Examples< how you could do it right now.

But for an simple UDC command without involving an script
such <item i> <item a> would be nifty to simplify the use.

Re: Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 20:27
by serendipity
otis_lewd wrote:I set up a script that takes two highlighted files in the same pane and passes those file names to a file compare program that then shows the differences between the two files. This works fine. But how do I get the script to pass one highlighted file in one pane and another highlighted file in the OTHER pane to my file compare program? What do I need to do to accomplish this? Thank you.

Here is my present script:

Action: Open selected List item(s) with specified application.
Caption: Compare 2 files
Application: "C:\Program Files\Compare It!\wincmp3.exe" <items>
Mode: Single instance (pass all the items to the same instance of the application).

The program Free Commander does this and it is really nice.
What you are asking is not currently possible in an elegant way, but you can make it work like this:

Action: Go to Location
Caption: Compare 2 files
Application:
$item1=getinfo ("SelectedItemsPathNames");
focus PI;
$item2=getinfo ("SelectedItemsPathNames");
openwith """C:\Program Files\Compare It!\wincmp3.exe"" $item1 $item2";
Mode: Single instance (pass all the items to the same instance of the application).

Re: Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 20:47
by otis_lewd
Okay, I have this:

focus P1; $f1 = getinfo("SelectedItemsPathNames"); focus P2; $f2 = getinfo("SelectedItemsPathNames"); run '"C:\Program Files\Compare It!\wincmp3.exe" $f1, $f2'

But when I try to run the script the '"C:\Program Files\Compare It!\wincmp3.exe' command uses $f1 and $f2 and as the names of the files instead of the real file names. What am I doing wrong? Thank you.

Re: Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 20:57
by serendipity
otis_lewd wrote:Okay, I have this:

focus P1; $f1 = getinfo("SelectedItemsPathNames"); focus P2; $f2 = getinfo("SelectedItemsPathNames"); run '"C:\Program Files\Compare It!\wincmp3.exe" $f1, $f2'

But when I try to run the script the '"C:\Program Files\Compare It!\wincmp3.exe' command uses $f1 and $f2 and as the names of the files instead of the real file names. What am I doing wrong? Thank you.
Its should be:
run """C:\Program Files\Compare It!\wincmp3.exe"" $f1, $f2";

Why? See here: http://88.191.26.34/XYwiki/index.php/Sc ... parameters

edit: By the way the syntax here does not use comma between file1 and 2, so remove the comma

Re: Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 20:58
by otis_lewd
This worked:

$f1 = getinfo("SelectedItemsPathNames", ""); focus PI; $f2 = getinfo("SelectedItemsPathNames", ""); openwith "C:\Program Files\Compare It!\wincmp3.exe" "$f1" "$f2";

Now I just have to figure out where to put it so I can call it.

Re: Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 21:04
by serendipity
otis_lewd wrote:This worked:

$f1 = getinfo("SelectedItemsPathNames", ""); focus PI; $f2 = getinfo("SelectedItemsPathNames", ""); openwith "C:\Program Files\Compare It!\wincmp3.exe" "$f1" "$f2";

Now I just have to figure out where to put it so I can call it.
You can put it in the Catalog, Toolbar or assign a shortcut.

Re: Manage User-defined Commands - how do I? . . .

Posted: 22 Mar 2010 21:11
by otis_lewd
Okay, I put the following in the SCRIPT textbox in the Manage User-Defined Commands form under the RUN SCRIPT category:

$f1 = getinfo("SelectedItemsPathNames", ""); focus PI; $f2 = getinfo("SelectedItemsPathNames", ""); openwith "C:\Program Files\Compare It!\wincmp3.exe" "$f1" "$f2";

It seems to work.

Thank you for all your help.

Re: Manage User-defined Commands - how do I? . . .

Posted: 23 Mar 2010 15:21
by serendipity
@otis_lewd:
If you are a registered user, since today you can use:

Code: Select all

   $f1 = <get item 1>; 
   $f2 = <get item 2>; 
   openwith "C:\Program Files\Compare It!\wincmp3.exe" "$f1" "$f2";