AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tile Windows Horizontally/ Vertically With Only Left Click

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Info10020
Guest





PostPosted: Mon Feb 28, 2005 9:42 pm    Post subject: Tile Windows Horizontally/ Vertically With Only Left Click Reply with quote

The code:

Menu, Tray, Add, Tile&Horizontally, TileHorizontally
Menu, Tray, Default, Tile&Horizontally

Menu, Tray, Add, Tile&Vertically, TileVertically
Menu, Tray, Add, E&xit, MenuExit

etc...

The default command set the tile horizontally as default action whenever I click it with left mouse, now how to do this: after clicking once, the default will change to tile vertically by the same left click and after clicking again, it will change to tile horizontally? In other words, I only want to use the left mouse to click to change the tiles in stead of right clicking the tray button, which will show the options of tilehorizontally, tilevertically and exit.

Thanks.
Back to top
Titan



Joined: 11 Aug 2004
Posts: 5390
Location: /b/

PostPosted: Mon Feb 28, 2005 10:39 pm    Post subject: Reply with quote

I'm not sure if this is the best way to do it but assigning a Hotkey could do the trick:
Code:
LButton::Send, {RButton}
(Win 2k/XP/+ required)
_________________

Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Tue Mar 01, 2005 2:14 am    Post subject: Re: Tile Windows Horizontally/ Vertically With Only Left Cli Reply with quote

Info10020 wrote:
after clicking once
If you want one click instead of two clicks to activate the default menu item, use:
Menu, Tray, Click 1

Quote:
the default will change to tile vertically by the same left click and after clicking again, it will change to tile horizontally?
You could just have the script remember what it did last:
Code:
TileHorizVert:  ; Called by the default menu item.
if LastActionWasVertical
{
   ; ... do commands to tile horiz.
}
else
{
   ; ... do commands to tile vert.
}
LastActionWasVertical := not LastActionWasVertical  ; Invert
return
You can also change the default item in the menu if you want to have two menu items instead of one:

TileHorizontally:
Menu, Tray, Default, Tile&Vertically
...
return

TileVertically:
Menu, Tray, Default, Tile&Horizontally
....
return
Back to top
View user's profile Send private message Send e-mail
Info10020
Guest





PostPosted: Tue Mar 01, 2005 5:52 pm    Post subject: Tile Windows Horizontally/ Vertically With Only Left Click Reply with quote

Thanks for the help. I post herewith the solution:-

Objective:
To tile the open windows into horizontally or vertically alternately by only left clicking the icon in tray. It's useful if you always hide your taskbar.

First Step:
Create scripts for Tile Windows Horizontally. Copy the bold (new ActiveXObject("Shell.Application")).TileHorizontally() to notepad and save as "TileHorizontally.js" (yes, Include the quotation mark).

Create scripts for Tile Windows Vertically. Copy the bold (new ActiveXObject("Shell.Application")).TileVertically() to notepad and save as "TileVertically.js" (yes, Include the quotation mark).

These are JScript Script File type. Test the script by double-click it. Visit this link http://www.pcworld.com/howto/article/0,aid,107861,pg,2,00.asp for further details if you need to. Perhaps someone can write them by using AutoHotkey code in stead of JScript.

Second Step:
The AutoHotKey code:-
Code:
#Persistent

Menu, Tray, NoStandard 
Menu, Tray, Click, 1

Menu, Tray, Add, Tile&Horizontally, TileHorizontally
Menu, Tray, Add, Tile&Vertically, TileVertically
Menu, Tray, Add, E&xit, MenuExit

TileHorizontally:
Menu, Tray, Icon, C:\My Documents\My Icons\Horiz.ico ;Path to your icon.
Menu, Tray, Default, Tile&Vertically
Run, C:\My Documents\MyAutoHotKey\TileHorizontally.js ;Path to your JScript that created above.
return

TileVertically:
Menu, Tray, Icon, C:\My Documents\My Icons\Vert.ico ;Path to your icon.
Menu, Tray, Default, Tile&Horizontally
Run C:\My Documents\My AutoHotKey\TileVertically.js ;Path to your JScript that created above.
return

MenuExit:
ExitApp


Well, it's just a small program that suits my style. I welcome all comments.
Back to top
axm85
Guest





PostPosted: Thu Apr 21, 2005 6:04 pm    Post subject: Nice.. Reply with quote

It worked for me. Thanks for the script. I'm new to AutoHotkey; i've used Linux before and have used various tiling window managers on there, such as Ion and my favorite WMI. I wish a script or program like this could emulate a tiling window manager, such as being able to resize windows tiled beside eachother and have both horizontal and vertical tiling. Is that just impossible on Windows shell?

Shawn
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Thu Apr 21, 2005 8:08 pm    Post subject: Reply with quote

You could search for alternative shells, but I doubt there's anything quite like Ion. Also, it's probably possible with AutoHotkey but there may be some overhead involved. Still, it sounds interesting, and I'll look into it later.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group