Horizontal pane view selection via button

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

rattler
Member
Member
Posts: 26
Joined: 2005 Sep 02, 15:26
Location: Arizona

Horizontal pane view selection via button

Post by rattler » 2005 Sep 13, 16:01

I searched and found someone had asked this question but there was no reply.

I switch back and forth from vertical panes to horizontal panes regularly. Making a configuration change via the OPTIONS menu everytime I want to do that seems a little silly. Is there a way I can switch back and forth quickly, perhaps via a button on a toolbar?

The version I'm using is the trial version that I downloaded yesterday.

TIA

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

Post by nikos » 2005 Sep 13, 16:15

there's no way you can switch pane alignment on the fly except through options.

you could define separate vertical/horizontal layouts (Window menu) but that would open a new window every time you switch

Gandolf
Gold Member
Gold Member
Posts: 363
Joined: 2004 Jun 12, 10:47

Post by Gandolf » 2006 Jan 08, 22:12

I finally got round to writing an AutoHotkey script for this. I hope it's documented reasonably well. If you want a toolbar button then create a user command like > "C:\Program Files\AutoHotkey\Extras\Scripts\Toggle x² split.ahk". Any suggestions / ideas to change or improve it will be welcome. It's not very neat but seems to work until Nikos provides a better solution. The hotkey is not required for a stand alone script run from a button.

Code: Select all

#\::	;Toggle x² split - the hotkey I use, Win+\

SetTitleMatchMode,1
IfWinActive, xplorer²
{
	Send, {ESCAPE}	;needed, otherwise does not work first time
	MouseGetPos, xpos, ypos	;store original mouse position
	CoordMode, Mouse, Relative
	Send !lo	;Select Tools | Options
	WinWait, Program options	;wait for options window
	MouseClick, left, 96, 40, ,0	;select Window tab
	ControlGet, Button, Checked,, Button10, Program options	;check if Horizontal selected
	If Button = 0
	{
		Send, !h	;switch to Horizontal
	}
	else
	{
		Send, !v	;switch to Vertical
	}
	Send {ENTER}	;close the options window
	MouseMove, xpos, ypos, 0	;move mouse to original position
	return
}
return

User avatar
snakebyte
Gold Member
Gold Member
Posts: 430
Joined: 2003 May 07, 07:14
Location: Seattle
Contact:

Post by snakebyte » 2006 Jan 09, 08:53

Sweet.

Even I was thinking of writing this script. I wanted to avoid the mouse click, but I guess its difficult to find the active tab pane and switch to windows tab without using a mouse.
Help! I'm an AI running around in someone's universe simulator.

Gandolf
Gold Member
Gold Member
Posts: 363
Joined: 2004 Jun 12, 10:47

Post by Gandolf » 2006 Jan 09, 09:25

snakebyte wrote:Sweet.
Thanks.

The mouse click is what's been bugging me for some time, because it's location is display dependant. I'd love to find a different way of opening the Window tab and I'm going to keep thinking.

Gandolf
Gold Member
Gold Member
Posts: 363
Joined: 2004 Jun 12, 10:47

Post by Gandolf » 2006 Feb 15, 13:02

I have another approach, not totally sure what the "SysTabControl321" command does but I found it mentioned in another script. Seems to work O.K. and it does avoid the mouse movement.

Code: Select all

#\::	;Toggle x² split

SetTitleMatchMode,1
IfWinActive, xplorer²
{
	Send !lo	;Select Tools | Options
	WinWait, Program options	;wait for options window
	SendMessage, 0x130C, 0,, SysTabControl321, Program options	;0x130C is TCM_SETCURSEL
	Send ^{TAB}
	WinWait, Program options	;wait for options window
	ControlGet, Button, Checked,, Button10, Program options	;check if Horizontal selected
	If Button = 0
	{
		Send, !h
	}
	else
	{
		Send, !v
	}
	Send {ENTER}
	return
}
return

User avatar
Alec_Burgess
Member
Member
Posts: 13
Joined: 2006 Oct 20, 03:09

AHK script for toggle Horiz-Vert split

Post by Alec_Burgess » 2006 Oct 20, 04:23

Gandolf wrote:I have another approach, not totally sure what the "SysTabControl321" command does but I found it mentioned in another script. Seems to work O.K. and it does avoid the mouse movement.
Hi Gandolf (others)
I found your AHK script to toggle Horiz-Vert split by searching for Vertical.
Per its description its exactly what I want.

This is what I've done so far before running into problems ...

Upstream in the thread "xplorer2 HACK : Convert any menu item to a toolbar button !!" I first found the hack (an executable AHK script). Downloading and installing to C:\bin as "C:\bin\xplorer2MenuHack.exe" worked perfectly. I had previously put C:\bin in my path just for little things like this.

So .. I created the two samples (List and Detail) in Customize - User Commands, verified they worked as expected and added them to one of my toolbars. Beautiful.

Further down the thread I found the file(s): Hotkeys.txt and Menu_Commands.txt

As I sort of expected - no numeric code which would do the split-change (though a code to bring up the Options is there).

Continuing in the thread I found your script. I'd previously installed but never really used AutoHotKey. I copied your script, opened AutoHotKey and created a script named:
"C:\Program Files\AmbPF\AutoHotkey\amb_Scripts\ToggleXplorer2split.txt"

then renamed it to: ToggleXplorer2split.ahk

I was hoping that double-clicking "ToggleXplorer2split.ahk" from a pane in Xplorer2 would make the panes toogle from Horizontal to Vertical and back.

Instead I get just a systray icon indicating that AutoHotKey is running that script.

Any ideas what I'm missing? Even better ... could you post a compiled script as an EXE so it can be used the same as the MenuHack.exe ... allowing me to defer having to figure out how AHK actually works, a little bit longer.  :)

Last step I tried was this:
Create a Customize - User scripts as follows:
Name: Toggle x² split
Description: >ToggleXplorer2split.ahk

As above - when executed (or clicked as a button on my toolbar) it just runs AHK putting an icon in systray who's tooltip is the name of the script but doesn't do anything else I can detect. :x
Regards .. Alec

Gandolf
Gold Member
Gold Member
Posts: 363
Joined: 2004 Jun 12, 10:47

Post by Gandolf » 2006 Oct 20, 06:00

Gosh, it's a long time since I did that so I'll have to do some thinking.

First, I run AHK at system startup so it's already running. That may be part of the problem (I doubt it - see later).

Secondly, it may be version dependant - I'm running AHK 1.0.44.13, I haven't installed the latest version yet - 1.0.44.14.

The way I run it is from a user command:

Name   Toggle x² split
Description   > "C:\Program Files\AutoHotkey\Extras\Scripts\Toggle x² split.ahk"

The only difference I can see in your user command and mine is that I use the full path to the AHK script and there is a space between the > and the command. I doubt if either is relevant since AHK runs for you so I assume x² is executing the AHK script.

I've just exited AHK and run the script from x² - it works fine. No AHK tray icon even appears but the windows toggle so AHK runs the script and then closes.

What is your O.S.?  That may also be relevant. I'm running XP SP2.

This is the script I actually run, it has some additional lines that are commented out. At a quick glance it looks the same but I may have accidentally deleted something I shouldn't have when I removed the comments before posting the script.

Code: Select all

;<^>!/::	;Toggle x² split

;#\::	;Toggle x² split

SetTitleMatchMode,1
IfWinActive, xplorer²
{
	Send !lo	;Select Tools | Options
	WinWait, Program options	;wait for options window

;	SendMessage, 0x130C, 0,, SysTabControl321, Program options	;0x130C is TCM_SETCURSEL
;	Send ^{TAB}

	SendMessage, 0x1330, 1,, SysTabControl321, Program options	;0x1330 is TCM_SETCURFOCUS

	WinWait, Program options	;wait for options window
	ControlGet, Button, Checked,, Button10, Program options	;check if Horizontal selected
	If Button = 0
	{
		Send, !h
	}
	else
	{
		Send, !v
	}
	Send {ENTER}
	return
}
return
That's all I can think of at the moment, perhaps snakebyte has an idea as to what may be your problem.

User avatar
Alec_Burgess
Member
Member
Posts: 13
Joined: 2006 Oct 20, 03:09

Post by Alec_Burgess » 2006 Oct 20, 07:34

Gosh, it's a long time since I did that so I'll have to do some thinking.

First, I run AHK at system startup so it's already running. That may be part of the problem (I doubt it - see later).

Secondly, it may be version dependant - I'm running AHK 1.0.44.13, I haven't installed the latest version yet - 1.0.44.14.
Just checked - the version I have is AHK 1.0.44.10 (probably later than when you created it in February)

The way I run it is from a user command:

Name   Toggle x² split
Description   > "C:\Program Files\AutoHotkey\Extras\Scripts\Toggle x² split.ahk"

The only difference I can see in your user command and mine is that I use the full path to the AHK script and there is a space between the > and the command. I doubt if either is relevant since AHK runs for you so I assume x² is executing the AHK script.

I first created the MenuHack.exe User Command as you did - full path quoted but put it in C:\bin (which I had previously put in my $PATH) and eliminated spaces in the exe name so that I don't need path or quotes in the command-description. That worked, so I followed that model when trying to create the user command for the toggle

I've just exited AHK and run the script from x² - it works fine. No AHK tray icon even appears but the windows toggle so AHK runs the script and then closes.
What is your O.S.?  That may also be relevant. I'm running XP SP2.

WinXP Media Edition (ie. Win XP PRO SP2 + some media related stuff)

Note: xplorer2 version is 1.6.0.0 [Unicode] - I doubt that makes any difference (?)

This is the script I actually run, it has some additional lines that are commented out. At a quick glance it looks the same but I may have accidentally deleted something I shouldn't have when I removed the comments before posting the script.

I replaced my first version of ToggleXplorer2split.ahk (which I had copied from this thread as you included in <code></code>) with your current version.

Now the systray icon doesn't appear (as you say it doesn't for you) but still the window split doesn't toggle. :-(

Question: If you run it by clicking a toolbar button (or from Customize-User Commands-script name do you see the Options dialog popup or does the orientation just instantly toggle?

FWIW: I'd been using DOpus so when I started using xplorer2 and found I could only toggle the Horiz/Vert split by going into Options, I wasted a lot of time trying to find reference in the PDF HELP to a non-existent button that would do the toggle. At least I'm sure now I didn't overlook it.  :?

Btw(2) In the MenuHacks thread (from back in February/06(?)) I noticed a comment (I think from Nickos) that use of the MenuHacks.exe would be documented in the PDF. I guess this didn't happen?
Regards .. Alec

Gandolf
Gold Member
Gold Member
Posts: 363
Joined: 2004 Jun 12, 10:47

Post by Gandolf » 2006 Oct 20, 23:40

Alec_Burgess wrote:... Note: xplorer2 version is 1.6.0.0 [Unicode] - I doubt that makes any difference (?) ...
I bet it does!
What's your title bar? Is xplorer² at the start of the line? If not try changing "SetTitleMatchMode,1" to "SetTitleMatchMode,2". From AHK help:

Code: Select all

MatchMode
 One of the following numbers:
1: A window's title must start with the specified WinTitle to be a match.
2: A window's title can contain WinTitle anywhere inside it to be a match. 
3: A window's title must exactly match WinTitle to be a match.
In 1.6.0.0 I think that xplorer² appeared at the end of the line (which prevented Dirkey from working). There was a change in 1.6.0.1

Code: Select all

* registry option DPF_X2TITLETRAIL forces xplorer2 to appear last in titlebar
	(see registry.txt; if set you lose dirkey compatibility)
I think the default in 1.6.0.1 is to be at the start of the line.

I now try to use ahk_class in all new scripts since it's a better way of checking a window. You could also try changing the AHK script:

Replace the lines:
SetTitleMatchMode,1
IfWinActive, xplorer²

With:
IfWinActive, ahk_class ATL:ExplorerFrame

I've just changed my AHK script and it works O.K. with x² 1.6.0.5 DBG.

User avatar
Alec_Burgess
Member
Member
Posts: 13
Joined: 2006 Oct 20, 03:09

Post by Alec_Burgess » 2006 Oct 21, 03:35

Gandolf wrote:
Alec_Burgess wrote:... Note: xplorer2 version is 1.6.0.0 [Unicode] - I doubt that makes any difference (?) ...
I bet it does!
What's your title bar? Is xplorer² at the start of the line? If not try changing "SetTitleMatchMode,1" to "SetTitleMatchMode,2".
Gandolf: YOU ARE THE MAN !!! JRT would be proud of you  :D

Works perfectly now.

After getting method 1 to work, I then changed it to use:

Code: Select all

IfWinActive, ahk_class ATL:ExplorerFrame 
That works too, and before too long, maybe I'll understand why  :lol:
Regards .. Alec

narayan
Platinum Member
Platinum Member
Posts: 1430
Joined: 2002 Jun 04, 07:01

Post by narayan » 2006 Oct 21, 04:40

use of the MenuHacks.exe would be documented in the PDF. I guess this didn't happen?
This is why I don't include scripts in UM: There are too many variables and preferences. besides, in implementation also there's the AutoHotkey vs. AutoIT choice/dilemma.

As a compromise, we should start a new section at the forum for cleaned up and authenticated scripts; so that users who do not know scripting also can trustingly use these scripts.

There are two possible methods:
1. In the separate section at forum, start a new topic for each script.
2. In the main download page, put zipped scripts for various purposes. Each zip file should also contain a readme file that has a step-by-step explanation about how to use the script.

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

Post by nikos » 2006 Oct 21, 08:17

of if there are any "standard" scripts i could host them somewhere and people can be referred to the URL for downloading

User avatar
Alec_Burgess
Member
Member
Posts: 13
Joined: 2006 Oct 20, 03:09

Post by Alec_Burgess » 2006 Oct 21, 08:57

nikos wrote:of if there are any "standard" scripts i could host them somewhere and people can be referred to the URL for downloading
From the newbie ... It would be "nice" to be able to toggle a couple of the other Options:

Specifically:
Options-Windows-Folders sorted: as files, separately, mixed mode AND
Options -Advanced [o] Quick view docked to the right of folder tree.
Regards .. Alec

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

Post by nikos » 2006 Oct 21, 10:08

instead of fumbling with scripts, you can try the "official" way to change these settings, that is layouts

so you have your normal layout and then save "other" layouts with quickview on the right or whatever. Then, if you want to switch, you just launch the new layout (the latest alpha has an option to close the original window)

no programming required!

Post Reply