I wrote this to sort windows on a screen based on their X, or Y location.
I don't know if it's a bubble sort, but it was supposed to be fairly quick.
Code:
Sort:
N2:= Iview - 1 ;Iview contains the number of items to sort
Loop, %N2%
{
min=%A_Index%
Z := A_Index
Z++
ThisLoop:
If (%Sort%%min% < %Sort%%Z%) ;Sort contains the name of the Variable to sort by (X or Y)
min := Z
Z++
if Z<=%Iview%
Goto, ThisLoop
Swap(Title%A_Index%,Title%min%) ; sort Window parameters
Swap(Width%A_Index%,Width%min%)
Swap(Height%A_Index%,Height%min%)
Swap(X%A_Index%,X%min%)
Swap(Y%A_Index%,Y%min%)
}
Return
Swap(ByRef Old, ByRef New)
{
tempvar := Old
Old := New
New := tempvar
}