Adopted franckspike's more general Manager_loop

This commit is contained in:
joten 2015-01-28 23:45:58 +01:00
parent 64bccf01e5
commit 1546091696
2 changed files with 12 additions and 10 deletions

View file

@ -15,6 +15,7 @@ summarizes these sources (of ideas or code):
+ Window information handling patches
- memory leaks
- flickering windows
* [morinted](https://github.com/morinted): [Read in sound volume](https://github.com/fuhsjr00/bug.n/issues/11)
#### Ideas or concepts
@ -24,6 +25,7 @@ summarizes these sources (of ideas or code):
#### Code snippets
* [franckspike](https://github.com/franckspike): [More general loop function](https://github.com/franckspike/bug.n/commit/e4e615512b363e8c342bf02cf9067cfeb4cc5d57#diff-e42236c27dedd9350fa8c9b9654fd485)
* fures: System + Network monitor - with net history graph (AutoHotkey forum)
* maestrith: Script Writer (github.com/maestrith/Script_Writer)
* PhiLho: [AC/Battery status](http://www.autohotkey.com/forum/topic7633.html)

View file

@ -281,17 +281,17 @@ Manager_lockWorkStation()
}
;; Unambiguous: Re-use WIN+L as a hotkey in bug.n (http://www.autohotkey.com/community/viewtopic.php?p=500903&sid=eb3c7a119259b4015ff045ef80b94a81#p500903)
Manager_loop(index, increment, lowerBound, upperBound)
{
index += increment
If (index > upperBound)
index := lowerBound
If (index < lowerBound)
index := upperBound
If (upperBound = 0)
index := 0
Manager_loop(index, increment, lowerBound, upperBound) {
If (upperBound <= 0) Or (upperBound < lowerBound) Or (upperBound = 0)
Return, 0
Return, index
numberOfIndexes := upperBound - lowerBound + 1
lowerBoundBasedIndex := index - lowerBound
lowerBoundBasedIndex := Mod(lowerBoundBasedIndex + increment, numberOfIndexes)
If (lowerBoundBasedIndex < 0)
lowerBoundBasedIndex += numberOfIndexes
Return, lowerBound + lowerBoundBasedIndex
}
Manager__setWinProperties(wndId, isManaged, m, tags, isDecorated, isFloating, hideTitle, action = "")