Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[module] Dock 1.0        (testing 2.0 b3)


  • Please log in to reply
367 replies to this topic
LimeAndSugar
  • Members
  • 5 posts
  • Last active: Jul 25 2013 07:02 AM
  • Joined: 07 Mar 2013

Anyone made this script work in Windows 8 ?



LimeAndSugar
  • Members
  • 5 posts
  • Last active: Jul 25 2013 07:02 AM
  • Joined: 07 Mar 2013

Bump



LimeAndSugar
  • Members
  • 5 posts
  • Last active: Jul 25 2013 07:02 AM
  • Joined: 07 Mar 2013

Bump of shame



DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008

I can not get dock.ahk to work at all. In the example below the client window is created but does not move with the host nor does it get destroyed when notepad is exited.
 

I verified the Dock_HostID has a value.

I am using ansi 32bit ahk version 1.1.11.02, and dock.ahk version  2.0 b3. I tried it on Windows 7 32bit and WinXp.
    

   #Include dock.ahk ;version 2.0.b3
   Run notepad,,,nPID
   WinWait ahk_pid %nPID%
   Dock_HostID := WinExist("ahk_pid " . nPID)

   Gui +LastFound -Caption +ToolWindow +Border
   Gui Add, Text,,Docked Window
   Gui Show, ;NoActivate
   WinGet,Client2ID,ID, Docked Window
  
   Dock(Client2ID, "x() y(,-1,-5) w(1)  h(,30)")
   return
  

The return value is Ok when using the following code. 

var := Dock(Client2ID, "x() y(,-1,-5) w(1)  h(,30)")


Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.

Dorian
  • Members
  • 85 posts
  • Last active: Apr 16 2016 07:57 AM
  • Joined: 16 Oct 2014

I can't get it to work. The code must check that every window that belong to MyGroup gets one Gui inside them.

I can't get more than one gui working at the same time. THANKS a lot!

 

 
PosX := 200
PosY := 200
PosW := 100
PosH := 100
 
GuiCounter := 0
 
SetTimer, DrawGui, 10
 
RETURN
 
 
DrawGui:
 
 
WinGet, ListWindows, List, DesiredName
WinGet, ListWindowsN, Count, DesiredName
 
 
Loop %ListWindowsN%
{
Checking := ListWindows%A_Index% 
 
IfWinExist, TitleId%Checking% ; skip if it already has a gui
Continue
 
Loop 
{
IfWinExist, TitleGui%GuiCounter%
GuiCounter++
else
Break
}
 
Dock_HostID := Checking
 
Gui, %GuiCounter%: +Lastfound -dpiscale -caption +Toolwindow  +E0x20 +hwndTitle%GuiCounter%
Gui, %GuiCounter%: Add, Text, Dorian in trouble!
Gui, %GuiCounter%: Show, x%PosX% y%PosY% w%PosW% h%PosH% NoActivate, TitleId%Checking%TitleGui%GuiCounter%
 
Dock(Title%GuiCounter%, "x(.5,-.5) y(,-1) w(,PosW) h(,PosH)")  
}
 
 
RETURN


Skrell
  • Members
  • 384 posts
  • Last active: Jul 07 2016 05:03 PM
  • Joined: 23 Aug 2011

Can someone please repost the latest version of this script?   And maybe the documentation if possible?  None of the links in OP work. 



lblb
  • Members
  • 120 posts
  • Last active: Dec 02 2015 08:05 AM
  • Joined: 22 May 2012

Have you tried kdoske's AHK_L version from post #357? I haven't tested it lately but it worked for me the last time I needed it on recent versions of AHK. I have an html file of the documentation but this forum is nightmarish when attempting to share files so I've pasted the content of the file below. Hopefully it's readable.

 

Edit:

Here's a pdf of the documentation: https://www.dropbox....o/Dock.pdf?dl=0

 

 

 

Dock desired top level windows (dock clients) to any top level window (dock host)

 

Using dock module you can glue your or third-party windows to any top level window.  Docked windows in module terminology are called Clients and the window that keeps their position relative to itself is called Host.  Once Clients are connected to the Host, this group of windows will behave like single window - moving, sizing, focusing, hiding and other OS events will be handled by the module so that the “composite window” behaves like the single window.

Module uses system hook to monitor windows changes, so it’s idle when it is not arranging windows.

Summary
Dock desired top level windows (dock clients) to any top level window (dock host)
Instantiate dock of given client upon host.
Uninitialize dock module.
Toggles the dock module ON or OFF.
This section contains some common docking setups.
Dock
Dock( pClientID,        pDockDef  =  "",   reset  =  0 )

Instantiate dock of given client upon host.  Multiple clients per one host are supported.

Parameters pClientId HWND of the Client GUI.  Dock is created or updated (if already exists) for that hwnd.  If “+” is the first char of pClientId, Dock will first show the window if it is hidden (for smoother initialization) pDockDef Dock definition, see bellow.  To remove dock client pass “-”.  If you pass empty string, client will be docked to the host according to its current position relative to the host. reset internal parameter, do not use. Globals Dock_HostID Sets docking host Dock_OnHostDeath Sets label that will be called when host dies.  Afterwards, module will disable itself using Dock_Toggle(false). Dock definition

Dock definition is string containing unordered white space separated parameters which describe Client’s position relative to the Host.  The big number of parameters allow for fine tuning of Client’s position and basically every setup is possible.  Parameters are grouped into 4 classes - x, y, w & h parameters.  Classes and their parameters are optional.

  Syntax: x(hw,cw,dx) y(hh,ch,dy) w(hw,dw) h(hh,dh) t
  • The X coordinate of the top, left corner of the client window is computed as HostX + hw*HostWidth + cw*ClientWidth + dx, with the parameters hw, cw & dx (shorten from host width and client width multipliers, delta x).
  • The Y coordinate of the top, left corner of the client window is computed as HostY + hh*HostHeight + ch*ClientHeight + dy, with the parameters hh, ch and dy.
  • The width W of the client window is computed as hw*HostWidth + dw, with the parameters hw & wd.
  • The height H of the client window is computed as hh*HostHeight + dh, with the parameters hh & hd.
  • The topmost state of the client is T.  Specify this option to to set the Client always on top the Host.  This allows client to be positioned inside the Host.

If you omit any of the class parameters it will default to 0.  So, the following expressions all have the same effect :

  x(0,0,0) = x(0,0) = x(0,0,) = x(0) = x(0,)= x(0,,) = x() = x(0,,0) = x(,0,0) = x(,,0) = ...
y(0,1,0) = y(0,1) = y(,1) = y(,1,) = y(,1,0) = ...

Keep in mind that x() is not the same as omitting x entirely.  First case is equal to x(0,0,0) so it will set Client’s X coordinate to be equal as Host’s.  In second case, x coordinate of the client will not be touched by the Dock module but Client will keep whatever x it had before.

Returns

”OK” or “Err” with text describing last successful or failed action.

Remarks

You must set DetectHiddenWindows if Host is practicing hiding.  Otherwise, Dock will treat Host hiding as death.  All clients will be hidden once host is terminated or it becomes hidden itself.

Use SetBatchLines, -1 with dock module for fluid client movement.  You will experience delay in clients moving otherwise.  However, if CPU usage is very high, you might experience a delay in client movement anyway.

If you are using Gui, Show command immediately before registering client, make sure you specify NoActivate flag.

”Topmost” feature can be used to create additional caption buttons.  Caption buttons are topmost clients containing only 1 button and docked to the Host so that they appear in its caption.  To setup caption button, only X class is needed.  For instance “x(1,0,-100)” can be used to set caption button 100 pixels from the right edge of the Host’s caption.

Example
Dock(Client1ID, "x(0,-1,-10) y(0,0,0) w(0,63) h(1,0)") ;top left, host height
Dock(Client2ID, "x() y(,-1,-5) w(1) h(,30)") ;top above, host width, short definition
Dock(hTitleBtn, "x(1,0,-80), y(0,0,5) w(0,20) h(0,15) t") ;add title button, topmost client docked inside Host, on title, with 20x15 size
Dock_Shutdown
Dock_Shutdown()

Uninitialize dock module.  This will clear all clients and internal data and unregister hooks.  Dock_OnHostDeath, Dock_HostId are kept on user values.

Dock_Toggle
Dock_Toggle( enable  =  "" )

Toggles the dock module ON or OFF.

Parameters enable Set to true to set the dock ON, set to FALSE to turn it OFF.  Skip to toggle. Remarks

Use Dock_Toggle(false) to suspend the dock module (to unregister hook), leaving its internal data in place.  This is different from Dock_Shutdown as latest removes module completely from memory and unregisters its clients.

You can also use this function to temporary disable module when you don’t want dock update routine to interrupt your time critical sections.

Presets

This section contains some common docking setups.  You can just copy/paste dock definition strings in your script.

x(,-1) y() top left, own size x(,-1,10) y() top left, own size, 10px padding x(,-1) y() h(1) top left, use host’s height, keep own width x(,-1,20) y() w(,50) h(1) top left, use host’s height, set width to 50 and padding to 20px x(,-1) y(.5,-.5) middle left, keep own size x(,-1) y(1,-1) w(,20) h(,20) bottom left, fixed width & height to 20px x(,-1) y(1,-1) h(.5) bottom left, keep height half of the Host’s height, keep own width x(1,-1) y(1) w(.25) h(.25) bottom right, width and height 1/5 of the Host x() y(1) w(1) h(,100) below the host, use host’s width, height = 100 x() y(,-1,-5) w(1) above the host, use host’s width, keep own height, 5px padding x(.5,-.5) y(,-1) w(,200) h(,30) center above the host, width=200, height=30 x(.5,-.5) y(1) w(0.3) h(,30) center bellow the host, use 1/3 Host’s width, height=30 x(1) y() top right, own size x(1) y() w(,40) h(1) top right, use host’s height, width = 40 x(1) y(.5,-.5) middle right, keep own size
About


Skrell
  • Members
  • 384 posts
  • Last active: Jul 07 2016 05:03 PM
  • Joined: 23 Aug 2011

 

Have you tried kdoske's AHK_L version from post #357? I haven't tested it lately but it worked for me the last time I needed it on recent versions of AHK. I have an html file of the documentation but this forum is nightmarish when attempting to share files so I've pasted the content of the file below. Hopefully it's readable.


 

Is the #357 post based on the version 2.0b3 ?  It doesn't seem to specify. 

*EDIT* Nevermind i figured it out!