Jump to content

AutoHotKey (AHK) Script - Boss Media - Tile Tables


GaF

Recommended Posts

Earlier on this evening I wrote a script to tile (and rotate around the tile) cooler tables on AutoHotKey. Have been testing it tonight, and to my utter shock, it works!! Actually not only does it work - it's working flawlessly and exactly as I'd hoped :loon When multitabling, I'm constantly moving tables around (I like to stagger starts and have them going from crapshoots in top left, down to deep stack in bottom right) - now the PC is doing it for me :) I did do it specifically for my needs (I'll try and come back to it and make it more flexible)- so it's been done for the moment with pretty fixed constraints. Screen Resolution: It's set up for a 1920x1200 screen only Table Types: It only looks at coolers Rotation: The order tables are "discovered" is recorded - this means that they are in "M" order Refresh: The layout refreshes every time the number of open cooler tables changes - so when a new table opens, or an old table closes, then the layout refreshes Tables: This can deal with a maximum of 8 tables. The tiling layout/format changes for 2 tables, 3-4 tables, 5-6 tables and 7-8 tables I'm not going to put the code directly into the public domain (not at the moment at least), however any established PL'rs who could make use of it are welcome to receive a copy :ok If you want some paramaters changed specifically for you (screen resolution/layout format/non cooler tables etc...) it should be pretty simple for me to do now I know how - so happy to tailor it for you too :ok Here's some screenshots showing the automatic layouts by number of tables.... 4 and 6 tables are pretty intuitive - the 8 table format may look strange but it's what I've found works best (for me) - they're basically paired up - it means you can always see some of all tables for easy access - if they were equidistant - tables could disappear into the background completely. 4 tables: f_20081105T4om_bf0376c.jpg 6 Tables: f_20081105T6om_8fcf1fc.jpg 8 tables: f_20081105T8om_fa79c8f.jpg

Link to comment
Share on other sites

  • 5 months later...

Re: AutoHotKey (AHK) Script - Boss Media - Tile Tables Hi favor1te - :welcome to PL I havent used the script for ages - not sure if I've even still got it (or if it still works) - will try and find it, and if I have, will post the code and you can give it a try.

Link to comment
Share on other sites

Re: AutoHotKey (AHK) Script - Boss Media - Tile Tables Ah - found it easier than I thought ;) Let us know how you get on.

;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other 
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
;Sleep until number of active tables changes
Loop
{
    WinGet,CurrentTableCount, count, Cooler
    if(CurrentTableCount!=PrevTblCnt)
    {
        GoSub, TileTables
        PrevTblCnt=%CurrentTableCount%
    }
    sleep,3000
}

;====================================================================================================================
TileTables:
;create data file if it doesnt exist
IfNotExist, OpenTables.txt
     FileAppend,,OpenTables.txt
;Read File Data
FileRead,DataFile,OpenTables.txt
;List and Count All Open Cooler Tables
WinGet, id, List, Cooler
WinGet, opencount, count, Cooler
;Add Window IDs to Data File for all open Cooler Tables
Loop, %id%
{
    this_id := id%A_Index%
    IfNotInString, DataFile, %this_id%
    {
       FileAppend
       (
       %this_id%`n
       ),OpenTables.txt
    }
}
;Delete Window IDs from Data File for all closed Cooler Tables
Loop, read, OpenTables.txt
{
    IfWinExist, ahk_id%A_LoopReadLine%
       {
         FileAppend
         (
           %A_LoopReadLine%`n
         ),OpenTables2.txt
       }
}
FileDelete, OpenTables.txt
FileCopy, OpenTables2.txt, OpenTables.txt
FileDelete, Opentables2.txt
;MoveTables
TableCount=1

Loop
{
    FileReadLine, line, OpenTables.txt, %A_Index%
    if ErrorLevel
        break
    if(TableCount=1)
    {
        WinMove,ahk_id %line%,,0,0
    }
    if(TableCount=2)
    {
        If(opencount<5)
        {
           WinMove,ahk_id %line%,,806,0
        } else if(opencount<7)
        {
           WinMove,ahk_id %line%,,557,0
        } else if(opencount<9)
        {
           WinMove,ahk_id %line%,,154,0
        }
    }
    if(TableCount=3)
    {
        If(opencount<5)
        {
           WinMove,ahk_id %line%,,0,568
        } else if(opencount<7)
        {
           WinMove,ahk_id %line%,,1114,0
        } else if(opencount<9)
        {
           WinMove,ahk_id %line%,,960,0
        }
    }
    if(TableCount=4)
    {
        If(opencount<5)
        {
           WinMove,ahk_id %line%,,806,568
        } else if(opencount<7)
        {
           WinMove,ahk_id %line%,,0,568
        } else if(opencount<9)
        {
           WinMove,ahk_id %line%,,1114,0
        }
    }
    if(TableCount=5)
    {
        If(opencount<7)
        {
           WinMove,ahk_id %line%,,557,568
        } else if(opencount<9)
        {
           WinMove,ahk_id %line%,,0,568
        }
    }
    if(TableCount=6)
    {
        If(opencount<7)
        {
           WinMove,ahk_id %line%,,1100,568
        } else if(opencount<9)
        {
           WinMove,ahk_id %line%,,154,568
        }
    }

    if(TableCount=7)
    {
        WinMove,ahk_id %line%,,960,568
    }
    if(TableCount=8)
    {
        WinMove,ahk_id %line%,,1100,568
    }

    TableCount++
}
Return

Link to comment
Share on other sites

  • 9 months later...

Re: AutoHotKey (AHK) Script - Boss Media - Tile Tables

sorry to bump an old post, but i just started on boss media and it would be nice if i can use your script to arrange the tables. :clap
:welcome to PL It's above - help yourself :ok Hopefully it still works. A slightly different version below which also resizes the tables (but is only setup for 4 tables)
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other 
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
SetTitleMatchMode 2

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
;Sleep until number of active tables changes
Loop
{
    WinGet,CurrentTableCount, count, Cooler
    if(CurrentTableCount!=PrevTblCnt)
    {
        GoSub, TileTables
        PrevTblCnt=%CurrentTableCount%
    }
    sleep,3000
}
;====================================================================================================================
TileTables:
;create data file if it doesnt exist
IfNotExist, OpenTables.txt
     FileAppend,,OpenTables.txt
;Read File Data
FileRead,DataFile,OpenTables.txt
;List and Count All Open Cooler Tables
WinGet, id, List, Cooler
WinGet, opencount, count, Cooler
;Add Window IDs to Data File for all open Cooler Tables
Loop, %id%
{
    this_id := id%A_Index%
    IfNotInString, DataFile, %this_id%
    {
       FileAppend
       (
       %this_id%`n
       ),OpenTables.txt
    }
}
;Delete Window IDs from Data File for all closed Cooler Tables
Loop, read, OpenTables.txt
{
    IfWinExist, ahk_id%A_LoopReadLine%
       {
         FileAppend
         (
           %A_LoopReadLine%`n
         ),OpenTables2.txt
       }
}
FileDelete, OpenTables.txt
FileCopy, OpenTables2.txt, OpenTables.txt
FileDelete, Opentables2.txt
;MoveTables
TableCount=1
Loop
{
    FileReadLine, line, OpenTables.txt, %A_Index%
    if ErrorLevel
        break
    if(TableCount=1)
    {
        WinMove,ahk_id %line%,,0,0,758,600
    }
    if(TableCount=2)
    {
        WinMove,ahk_id %line%,,758,0,758,600
    }
    if(TableCount=3)
    {
        WinMove,ahk_id %line%,,0,600,758,600
    }
    if(TableCount=4)
    {
        WinMove,ahk_id %line%,,758,600,758,600
    }

    TableCount++
}
Return

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...