admin 管理员组

文章数量: 1184232


Dividend = -1 	
;############################################
#F8::
class1 = BaiduPlayer_MainDlg
class2 = PPLiveGUI
class3 = Baofeng_StormPlayer
class4 = #32770  ;PPS
;title2 = 
Dividend += 1
SwitchWinT(Dividend,4,0)
return
;############################################
SwitchWinT(Dividend,classNo,titleNo)
{
   global class1,class2,class3,class4,class5,title1,title2,title3,title4
   ;; The last activated window
   ;static active_last
   global active_last
   WinGet, active_ltemp, ID, A
   ; Scan program manager
   WinGet, id, list,,, Program Manager
   idFind = 0
   Loop, %id%
   {
      this_id := id%A_Index%
      WinGetClass, this_class, ahk_id %this_id%
      Loop %classNo%
      {
         classCompare := class%A_Index%
         if this_class = %classCompare%
         {
            idFind := idFind +1
            idFind%idFind% := this_id
         }
      }
      WinGetTitle, this_title, ahk_id %this_id%
      Loop %titleNo%
      {
         titleCompare := title%A_Index%
         IfInString, this_title, %titleCompare%
         {
            idFind := idFind +1
            idFind%idFind% := this_id
         }
      }
       
   }
   ; Sort idFind array
   Loop %idFind% ;copy the array into a single variable
      List.=(A_Index<>1) ? "|" idFind%A_Index% : idFind%A_Index%
   Sort, List, N D| ;sort them
   StringSplit, idFind, List, | ;put them back into the array
   ;msgbox,idFind:%idFind%`nList:%List%`nidFind1:%idFind1%`nidFind2:%idFind2%`nidFind3:%idFind3%
   ; Activate the window upon sorted list
   Transform, rnd, Mod, Dividend, idFind
   rnd +=1
   active_ID := idFind%rnd%
   IfWinNotActive ahk_id %active_ID%
   {
      ;msgbox,%active_ID%`nrnd:%rnd%
      ;WinGet, active_last, ID, A
      WinActivate ahk_id %active_ID%
   }
   Else
   {
      Dividend += 1
      Transform, rnd, Mod, Dividend, idFind
      rnd +=1
      active_ID := idFind%rnd%
      ;msgbox,%active_ID%`nrnd:%rnd%
      ;WinGet, active_last, ID, A
      WinActivate ahk_id %active_ID%
   }
   active_flag = 0
   Loop %idFind%
   {
      If idFind%A_Index% = %active_ltemp%
         active_flag = 1
   }
   ;WinGet, active_current, ID, A
   ;If active_current != %active_ltemp%
   If active_flag = 0
      active_last := active_ltemp
   ;List =
   class1 =
   class2 =
   class3 =
   class4 =
   class5 =
   title1 =
   title2 =
   title3 =
   title4 =
}


本文标签: 多任务 一键搞定 掌握