Log in

View Full Version : HKN - Toggle MULTIPLE active foreground windows?



Dracconus
03-08-2014, 06:05 AM
I know that in Hotkeynet there's the <Togglewin> function that allows you to bring two screens back and forth to the active/background but is there a way to do that with multiple screens other than defining a function within the script that would cause them to "move" to the foreground then resize it to the size the foreground was, then move the foreground to where it was with a resize? (because that's a lot of work to do if there's an easier way.)

Khatovar
03-08-2014, 06:58 AM
Are you looking for a master-swapping script? IE You press a button, a specified slave window moves to the Master's position and size making that Slave into Master and Master into a Slave? I do this with a Command designated ResizeAndPosition. Try taking this out -


<hotkey ScrollLockOn shift r>
<targetwin rift1>
<setwinsize 1920 1000>
<setwinpos 0 0>
<targetwin rift2>
<setwinsize 960 500>
<setwinpos -1920 0>
<targetwin rift3>
<setwinsize 960 500>
<setwinpos -960 0>
<targetwin rift4>
<setwinsize 960 500>
<setwinpos -1920 500>
<targetwin rift5>
<setwinsize 960 500>
<setwinpos -960 500>

and replacing it with


<Command ResizeAndPosition>
<targetwin %1%>
<setwinsize 1920 1000>
<setwinpos 0 0>
<targetwin %2%>
<setwinsize 960 500>
<setwinpos -1920 0>
<targetwin %3%>
<setwinsize 960 500>
<setwinpos -960 0>
<targetwin %4%>
<setwinsize 960 500>
<setwinpos -1920 500>
<targetwin %5%>
<setwinsize 960 500>
<setwinpos -960 500>

Now, I'm looking at your script and you've got several hotkeys defined that rename your windows. Working backwards from the SendLabel it looks like this is the functioning code


<hotkey ScrollLockOn ctrl r>
<renamewin rift rift1>
<renamewin rift rift2>
<renamewin rift rift3>
<renamewin rift rift4>
<renamewin rift rift5>

Add the line <ResizeAndPosition rift1 rift2 rift3 rift4 rift5> so it looks like this


<hotkey ScrollLockOn ctrl r>
<renamewin rift rift1>
<renamewin rift rift2>
<renamewin rift rift3>
<renamewin rift rift4>
<renamewin rift rift5>
<ResizeAndPosition rift1 rift2 rift3 rift4 rift5>

Now when you press ScrollLockOn Ctrl R the windows should rename, resize and position themselves in the same layout you would have had if you'd pressed ScrollLockOn Ctrl R and then ScrollLockOn Shift R.

The ResizeAndPosition Command makes use of arguments to shorthand the code. In the definition of the command you see the %1% - %5%, that's where the code is looking for information from where the command is being used. In this case, the "rift1 rift2 rift3 rift4 rift5" that follows the ResizeAndPosition at the end of your RenameWin hotkey above. You can simply call the command again and change the order of the variables and the windows will rearrange themselves based on that new order.


Changing the RenameWin hotkey to use the command like this

<ResizeAndPosition rift5 rift4 rift3 rift2 rift1>

should completely reverse the order of the windows, making "rift1" a small window and "rift5" the main window.

Individual hotkeys is the easiest and most common way to swap windows. A lot of people have a run of Function Keys assigned to do the swapping where F1 is your normal main, F2 is your second toon, F3 is the third and so on. That would look like this -


<Hotkey ScrollLockOn F1>
<ResizeAndPosition rift1 rift2 rift3 rift4 rift5>

<Hotkey ScrollLockOn F2>
<ResizeAndPosition rift2 rift1 rift3 rift4 rift5>

<Hotkey ScrollLockOn F3>
<ResizeAndPosition rift3 rift2 rift1 rift4 rift5>

<Hotkey ScrollLockOn F4>
<ResizeAndPosition rift4 rift2 rift3 rift1 rift5>

<Hotkey ScrollLockOn F5>
<ResizeAndPosition rift5 rift2 rift3 rift4 rift1>

If you don't want to use and/or remember hotkey, you can try a mouseover version like I use for WoW


<UseKeyAsModifier ScrollLockOn LWin>

<Hotkey ScrollLockOn LWin LButton>
<If MouseIsOverWindow rift1>
<ResizeAndPosition rift1 rift2 rift3 rift4 rift5>
<Else If MouseIsOverWindow rift2>
<ResizeAndPosition rift2 rift1 rift3 rift4 rift5>
<Else If MouseIsOverWindow rift3>
<ResizeAndPosition rift3 rift2 rift1 rift4 rift5>
<Else If MouseIsOverWindow rift4>
<ResizeAndPosition rift4 rift2 rift3 rift1 rift5>
<Else If MouseIsOverWindow rift5>
<ResizeAndPosition rift5 rift2 rift3 rift4 rift1>

This sets up my Left Windows Key {between the left ctrl and left alt keys} as a modifier so that if I press it while clicking on a window, I can make that window my new main. If you use a normal modifier you don't need to define it, as we talked about before. I just wanted to make my windows keys less of a waste {or annoyance} so I defined the left one to allow swapping and the right one to "fullscreen" a selected slave window without swapping for times when I need both the master and a slave to be big {crafting and trading between toons or duplicating macros, things like that}.