Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 06, 2016, 02:20:37 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: Toggle 1.5  (Read 7105 times)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Toggle 1.5
« on: February 13, 2010, 01:24:12 PM »
Toggle may be found on this page: http://www.favessoft.com/hotkeys.html

I have changed the design of Toggle to simply alternate between a "green" and "red" toggle state.  It no longer centers windows. It simply saves the current position and size of the associated window, and moves the window to the other saved position and size.  If the other state has not been initialized, a message dialog pops up to advise you to size and move the window as you like.

It's really for myself to have a hotkey to alternate 2 non-maximized Firefox window sizes.  But especially for browsers you may find it useful.

If you are using a window sizer utility then this is likely way too simple for your taste.

I coded it to just return from the hotkey or mouse double click on the tray icon and do nothing, if the window is in maximized state.  It doesn't try to intercept any windows sizing or movement messages.  It simply uses AutoIt3 functions to remember window size and position and move the window to a saved size/position.

Likely there are still some bugs but I think it's usable as it is at least for a single window browser or editor. If you notice the icon state gets confused or other inconsistency the likely fix is to close it down and delete the Toggle.ini file.  Toggle will create it again on the next run.

Now it enforces single instance and also saves state to an .ini file between runs.
See the included Readme.txt for more info.

« Last Edit: February 18, 2010, 01:26:31 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.11
« Reply #1 on: February 14, 2010, 09:32:02 PM »
Updated to v. 1.11.  A few minor bug fixes. Mostly getting the icon color change to kick in when you double-click the Tray Icon to toggle.

v. 1.2 Fixed Tray Icon Tooltip to update when you change the associated window title.



« Last Edit: February 14, 2010, 09:53:54 PM by MilesAhead »

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,090
    • View Profile
    • Donate to Member
Re: Toggle 1.2
« Reply #2 on: February 15, 2010, 05:28:43 AM »
Can such a thing "easily" be changed into making my Explorer window always open with the size 85% x 87.25%, or do I need something entirely different ? I think I probably have too many 'add-ons' and things; my Vista Explorer simply refuses to remember any other size than the wrong one!

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.2
« Reply #3 on: February 15, 2010, 02:14:04 PM »
Can such a thing "easily" be changed into making my Explorer window always open with the size 85% x 87.25%, or do I need something entirely different ? I think I probably have too many 'add-ons' and things; my Vista Explorer simply refuses to remember any other size than the wrong one!


Do you want something to change the window size when you press a hotkey or launch something at the size?

If you have the 1.0 version of Toggle, set the percentages, and use the WinTitle [ACTIVE] in brackets just as I've typed it.  Then the hotkey should toggle the active window no matter what it is. (Of course you should only use it with one window or windows will end up directly on top of each other eventually.)

If you want something to automatically resize explorer when it comes up let me know.  The [ACTIVE] gimmick would be the quickest thing to try though.

With the newer version of Toggle it doesn't accept percentages but you could still use [ACTIVE] and just drag the explorer window to the size you want and hit the hotkey to save it.

If neither approach does it, give a bit more detail what you want.  It should be an easy one since I have a couple of programs that watch explorer windows anyway.  It would just be adapting.

edit: you could also use this WinTitle  [class:CabinetWClass]
in the brackets as typed.  Then it would only Toggle the last active Explorer window.  Still, you're likely to end up with windows directly on top of each other.  You could also try it directly with rw.exe
as in:

rw 85 87 [class:CabinetWClass]

after explorer is open.
(assuming rw.exe is in your Path)

« Last Edit: February 15, 2010, 02:32:50 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.2
« Reply #4 on: February 15, 2010, 02:34:11 PM »
If you don't still have a copy of rw.exe you can get it in this download:

http://www.favessoft.com/RunAndPlace.zip


Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,090
    • View Profile
    • Donate to Member
Re: Toggle 1.2
« Reply #5 on: February 15, 2010, 02:54:34 PM »
If you want something to automatically resize explorer when it comes up let me know.

Actually, this is my request, if possible. I use Quizo QT Tabbar, so I never have more than one Explorer window. The first time I open Explorer, I almost always would like it to be 870x670 pixels (85% x 87.25% of a 1024x768). If I open more than the eight starting folders (tabs) Explorer will merely start a new row of tabs, not open more windows or resize the window. But as I said, so far this window always has the wrong size.
 :tellme:
« Last Edit: February 15, 2010, 05:17:58 PM by Curt »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.2
« Reply #6 on: February 15, 2010, 03:53:44 PM »
Ok, can you do an experiment and try:
rw 85 87 [class:CabinetWClass]

in a command prompt and see if it sets the size?
If I know I can use that class name then it should be just
a few lines of AHK.

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,090
    • View Profile
    • Donate to Member
Re: Toggle 1.2
« Reply #7 on: February 15, 2010, 05:37:34 PM »
With a Explorer window open, behind PromptPal, command prompting C:\Users\Curt\Downloads\RunAndPlace\rw.exe 85 87 [classCabinetWClass] was "not found" by rw.

But thinking about it, I am not sure if an AHK solution is what I would want. I mean, it would always take me to first press a hotkey, before going into action, wouldn't it? I really want something to get&forget.

Sorry I polluted your thread.
« Last Edit: February 15, 2010, 05:47:26 PM by Curt »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.2
« Reply #8 on: February 15, 2010, 06:59:59 PM »
With a Explorer window open, behind PromptPal, command prompting C:\Users\Curt\Downloads\RunAndPlace\rw.exe 85 87 [classCabinetWClass] was "not found" by rw.

But thinking about it, I am not sure if an AHK solution is what I would want. I mean, it would always take me to first press a hotkey, before going into action, wouldn't it? I really want something to get&forget.

Sorry I polluted your thread.


In the [class:CabinetWClass] you need a colon ':' between the word 'class' and 'CabinetWClass'  then it should work.

I wasn't thinking about a hotkey.  What I had in mind was something that would sit in the tray, and periodically check for a window of that class and take action.  What I would try to do is have a variable for if the window has already been sized, set to False on startup.  It would look for the window, if it finds it, size and/or position it, then set that variable to True.  Periodically it would poll for that window.  If the window has gone away, it would reset the variable to False.(Thereby avoiding resizing the window every time it sees it. It should only resize once, unless it detects the window was not present since and has opened again.)

It might take a bit of playing around to tune the polling so that it's not making the CPU busy.  But it should be pretty easy to do.  Maybe have an .ini file setting for how long to sleep between checking for the window. That type of thing.

In fact if I get it working for you I may use it myself for Download dialogs. It seems like every so often when I download in Firefox, the window is collapsed instead of showing the folders in the sidebar.  Maybe I can use this to resize it somehow to avoid doing it manually.

« Last Edit: February 15, 2010, 07:07:32 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.2
« Reply #9 on: February 15, 2010, 07:49:53 PM »
Sorry I polluted your thread.

Not at all.  aamof you inspired me to try out the [ACTIVE] keyword for using it with the active window.  That way I can use it even if I'm not running Firefox. Makes it more general-purpose.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.3
« Reply #10 on: February 15, 2010, 09:46:11 PM »
Latest is v. 1.3 available on my site for download.  Modified it so that when the keyword [ACTIVE] is in use, the active window is checked for a blank title. In this case the toggle function returns taking no action.

As example, if you double-click the Tray Icon to toggle the active window, the icon window itself becomes active, confusing the issue.  When using [ACTIVE] it's best to use the Alt-F11 hotkey.

The test for blank caption should avoid disappearing windows from double clicking the tray icon or toggling while some control without a caption is active and those coordinates being used when you switch to a regular top level window. At least that's the theory.



MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.46
« Reply #11 on: February 16, 2010, 04:23:31 PM »
Updated to web site v. 1.46.  Now Toggle disables Tray Icon double-click if Window Title is keyword [ACTIVE] as it only makes sense to use the hotkey in that case.  I added Tray Menu commands to change the hotkey, Vista color if Glass enabled.  Also the About Dialog uses Glass if enabled.  The About Dialog shows the current hotkey and window title.

Settings are remembered to Toggle.ini created in the same folder as Toggle.exe.
Memory usage should still be economical since it calls an API to empty the memory working set after each function.  Task Manager seems to show an average range of around 700KB to 3 MB memory usage.

See first post in thread for download page.




MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.5
« Reply #12 on: February 18, 2010, 01:30:29 PM »
Toggle 1.5 updated on my page.  Now has menu command to set the Window Title to the [ACTIVE] keyword to avoid having to type it into the title change dialog.

If you check out AutoIt3 window title matching in the AutoIt3 help docs you can find other keywords for titles, such as matching by class.  For example, and I noted this in the Readme, using a title of [class:CabinetWClass] at least on my Vista64 PC, matches the last active Explorer window.  The other class keyword for explorer is supposed to be [class:ExploreWClass].  If you don't get a match with one you can try the other.

When playing around with class be careful you don't do stuff like match the taskbar or it might disappear on you. :)
« Last Edit: February 18, 2010, 01:39:25 PM by MilesAhead »

sajman99

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 664
    • View Profile
    • Donate to Member
Re: Toggle 1.5
« Reply #13 on: February 18, 2010, 02:37:00 PM »
Cripes, do you ever take a break? ;D You talented coder guys never cease to amaze! :)

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,090
    • View Profile
    • Donate to Member
Re: Toggle 1.5
« Reply #14 on: February 18, 2010, 04:24:48 PM »
I wonder if your next project maybe could be to humanize the manual/readme?
- or is it supposed to be from one coder to another?
 :(

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.5
« Reply #15 on: February 18, 2010, 05:38:25 PM »
I wonder if your next project maybe could be to humanize the manual/readme?
- or is it supposed to be from one coder to another?
 :(

It turns to gibberish as I update apparently.  :)
The thing is stabilizing.  Once that happens then I try to go over the readme and make it concise.
This one is a bit more jumbled than usual because I changed the design in the middle.

If you run it out of the box, it will toggle the active window.
If you set a window title, it will toggle any window that contains the
substring.

For example if you want to toggle Opera browser, use Opera as the title.
I'll try to clean up the readme in the next few days.
« Last Edit: February 18, 2010, 05:43:16 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.5
« Reply #16 on: February 18, 2010, 05:44:48 PM »
Cripes, do you ever take a break? ;D You talented coder guys never cease to amaze! :)

Hmmmmmmm, do you owe me some money I don't know about or something? :)

Shucks.




MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.5
« Reply #17 on: February 18, 2010, 06:01:56 PM »
I wonder if your next project maybe could be to humanize the manual/readme?
- or is it supposed to be from one coder to another?
 :(

btw did you find something to auto-size explorer with the addon tab utility?

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,090
    • View Profile
    • Donate to Member
Re: Toggle 1.5
« Reply #18 on: February 19, 2010, 05:23:30 AM »
did you find something to auto-size explorer with the addon tab utility?

No, I didn't, but I haven't really tried to. I *imagine* that the reason my Explorer always will open with 'wrong' size is that some time ago I right-clicked AnVir Task Manager Pro's title bar's "Resize > 800x570", in a Explorer window, and now I am apparently stucked with this size.

-
Regarding 'humanizing' the readme; I was merely trying to tell that I don't understand what it is telling.  :-[

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.5
« Reply #19 on: February 19, 2010, 01:49:12 PM »
I understand about the readme.  That's a fair criticism. There's something about uploading when doing revisions that makes me want to upload it asap.  Don't know why.  It's not like the Taxi meter is running.  But the Readme just gets stuff stuck in it to cover new stuff and changes until I can get a chance to rewrite it so it's somewhat coherent.

Just for grins I'll try whipping up an explorer monitor thing that resizes the window automatically.  If it works well, then I'll set it so the dimensions can be saved to an .ini file that's read on start-up.

The coarse test version should only take a bit.  Maybe I'll have something later today.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.5
« Reply #20 on: February 19, 2010, 02:48:44 PM »
Curt, try this one as a test.  If it works, then I can spiff it up a tad.

What will happen when run, the first time is sees an Explorer window, it will move it to the top left corner(0,0) at width 600 height 600.  Right click the tray icon and Exit.  Then in the same folder as ResizeExplorer.exe there should be ResizeExplorer.ini.  Set the x, y, width, height you want, and run it again. (You should only have to do this once unless you want to change the settings.)

Also you can look in Task Manger and make sure it doesn't run up the CPU, but the defaults I'm using in my machine don't register any significant CPU and memory is around 700KB. The way to cut down on CPU is the "SleepMSec" param.  Valid range is 100 to 2000 which is 1/10th second to 2 seconds.
Every time it checks for an Explorer window it will take the appropriate action, then go to sleep for that amount of time. I have it at 1000 for 1 second.  I'm guessing that will work fine as is.

I compiled it without the UPX compress just so it won't trigger a virus warning on DonationCoder.
When I spiff it up and post on my site it will likely have a few features and a custom icon etc..


« Last Edit: February 19, 2010, 02:51:53 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.5
« Reply #21 on: February 19, 2010, 03:45:38 PM »
btw I uploaded Toggle.zip to my site with a new Readme.  I think this one is more succinct. :)

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,090
    • View Profile
    • Donate to Member
Re: Toggle 1.5
« Reply #22 on: February 19, 2010, 04:41:28 PM »
Curt, try this one as a test. 


* ResizeExplorer.zip (341.35 KB)

PERFECT!!  :) 

Thanks a lot, Miles!  :Thmbsup:

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,283
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Toggle 1.5
« Reply #23 on: February 19, 2010, 06:31:06 PM »
Glad it worked.  I'll stick a custom icon on it and put on my site in case somebody may have a use.  Since it only moves the first Explorer window to open then it might be usable in other scenarios.  I'll play around with it. Maybe add the thing so you can size Explorer the way you want and hit a menu command to save it to .ini rather than having to manually edit the .ini.



Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,090
    • View Profile
    • Donate to Member
Re: Toggle 1.5
« Reply #24 on: February 19, 2010, 06:56:50 PM »
-however; it seems that once it has done the job, it will automatically pause the script permanently. I have not been able to "unpause" it, but is forced to exit, once it has resized the window the first time.