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

Discuss and share scripts and script files...
Post Reply
otis_lewd
Posts: 10
Joined: 10 Jul 2009 01:43

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

Post 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.

admin
Site Admin
Posts: 65446
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

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

Post 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>

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

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

Post by TheQwerty »

admin wrote:Shouldn't we also have this:???
No, we should have GetControlInfo().

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

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

Post 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.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

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

Post 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.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

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

Post 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.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

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

Post 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).

otis_lewd
Posts: 10
Joined: 10 Jul 2009 01:43

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

Post 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.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

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

Post 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
Last edited by serendipity on 22 Mar 2010 20:59, edited 1 time in total.

otis_lewd
Posts: 10
Joined: 10 Jul 2009 01:43

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

Post 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.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

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

Post 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.

otis_lewd
Posts: 10
Joined: 10 Jul 2009 01:43

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

Post 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.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

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

Post 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";

Post Reply