All pastes #2131800 Raw Edit

Stuff

public text v1 · immutable
#2131800 ·published 2012-03-24 14:05 UTC
rendered paste body
#LTrim
#NoEnv
#NoTrayIcon
#SingleInstance force
SendMode Input
SetControlDelay, 0
SetKeyDelay, 0
SetMouseDelay, 0
SetWinDelay, 0

GroupAdd, RS, ahk_exe JagexLauncher.exe
GroupAdd, RS, RuneScape - MMORPG - The No.1 Free Online Multiplayer Game
GroupAdd, RS, RuneScape - MMORPG - das beliebteste kostenlose Online-Abenteuerspiel
GroupAdd, RS, RuneScape - MMORPG - Le méga-jeu d'aventure en ligne gratuit
GroupAdd, RS, RuneScape - MMORPG - O Jogo Gratuito Número 1 para Multijogadores

Timer_1_Delay := 30000
Timer_2_Delay := 300000
Timer_3_Delay := 315000

;; SetTimer, PUpdate, 1000

return

PUpdate:
  WinGet, RS, List, ahk_group RS
  Loop, %RS%
  {
    RSx := RS%A_Index%
    WinGet, RSx, PID, ahk_id %RSx%
    IfNotInString, PUpdated, %RSx%
    {
      Process, Priority, %RSx%, High
      PUpdated := PUpdated ? PUpdated "," RSx : RSx
    }
  }
return

^SC046::Run, "X:\My Games\RuneScape\"
#SC046::Run, "X:\My Games\RuneScape\RuneScape.lnk"

#If (!Full) && (ISURL)

Pause::
  Run, %ISURL%
return

#If (Full)

Pause::
  SetTimer, RemoveToolTip, Off
  ToolTip, Uploading file..., 0, 0
  ISURL := ISUpload(Full)
  Clipboard := ISURL
  ToolTip(ISURL, 2500, 0, 0)
  Full := ""
return

#If (MouseIsOver("ahk_group RS"))

MButton & Space::
  FormatTime, Date,, yyyy-MM-dd HH-mm-ss
  if (Date = oDate)
  {
    Date = %oDate% [%nDate%]
    nDate += 1
  }
  else
  {
    oDate = %Date%
    nDate := 1
  }
  Dir := "X:\My Games\RuneScape\screenshots\tmp\"
  IfNotExist, %Dir%
    FileCreateDir, %Dir%
  File := Date ".png"
  Full := Dir File
  ToolTip
  AoT := 0
  ID := WinExist("A")
  WinGet, ExStyle, ExStyle, ahk_id %ID%
  if (ExStyle & 0x8)
    AoT := 1
  WinSet, AlwaysOnTop, On, ahk_id %ID%
  RunWait, "C:\Program Files (x86)\IrfanView\i_view32.exe" "/capture=2 /convert=%Full%"
  if (!AoT)
    WinSet, AlwaysOnTop, Off, ahk_id %ID%
  ToolTip(File, 2500, 0, 0)
return

MButton::RSSend("F1") ;; Inventory

MButton & LButton::RSSend("F2") ;; Worn Equipment

MButton & RButton::RSSend("F3") ;; Prayer List

MButton & WheelUp::RSSend("F4") ;; Magic Spellbook

MButton & WheelDown::RSSend("F5") ;; Combat Styles

RSSend(Fx) {
  if (!WinActive("ahk_group RS"))
    WinActivate
  Send {%Fx% down}
  Sleep, 100
  Send {%Fx% up}
  return
}

~*LButton::
  if (GetKeyState("1", "P"))
    GoSub, Timer_1_Reset
  if (GetKeyState("2", "P"))
    GoSub, Timer_2_Reset
  if (GetKeyState("3", "P"))
    GoSub, Timer_3_Reset
  if (GetKeyState("4", "P"))
    GoSub, Timer_4_Reset
  if (GetKeyState("5", "P"))
    GoSub, Timer_5_Reset
  Timer_Hotkey := 0
return

#If ((WinActive("ahk_group RS")) && (WinExist("Timer")))

*1::
*2::
*3::
*4::
*5::
  Timer_Hotkey := RegExReplace(A_ThisHotkey, "^\*(\d)$", "$1")
  KeyWait, %Timer_Hotkey%
  if (Timer_Hotkey)
    Send, %Timer_Hotkey%
return

#If (WinActive("ahk_group RS"))

#`::
  if (WinExist("KeyBoard"))
  {
    GUI, Destroy
    SetTimer, KeyBoard_Hide, Off
  }
  if (!WinExist("Timer"))
  {
    WinGetPos, x, y, Width, Height, ahk_group RS
    GUI, +AlwaysOnTop +Border -Caption +ToolWindow +E0x08000000
    Gui, Color, Black
    GUI, Font, S18 Bold, Tahoma
    timer_w := 75
    timer_h := 30
    w := timer_w + 5
    h := timer_h
    Loop, 5
    {
      clr := Mod(A_Index, 2) ? 808080 : 008000
      xpos := ((A_Index - 1) * timer_w) + 5, w := (A_Index * timer_w) + 5
      GUI, Add, Text, vTimer_%A_Index% gTimer_%A_Index%_Reset c%clr% w%timer_w% h%timer_h% x%xpos% y0, % Duration(Floor(Timer_%A_Index%_Delay / 1000))
    }
    GUI, Show, x%x% y%y% w%w% h%h% NoActivate, Timer
    GUI, -AlwaysOnTop
    Timer_Hide := 0
    SetTimer, Timer_Hide, 100
  }
  else
  {
    GUI, Destroy
    Loop, 5
      SetTimer, Timer_%A_Index%_Update, Off
    SetTimer, Timer_Hide, Off
  }
return

Timer_Hide:
  if (WinExist("ahk_group RS"))
  {
    if ((Timer_Hide) && (WinActive("ahk_group RS")))
    {
      ;; GUI, Show, NA
      GUI, +AlwaysOnTop
      GUI, -AlwaysOnTop
      Timer_Hide := 0
    }
    if ((!Timer_Hide) && (!WinActive("ahk_group RS")))
    {
      ;; GUI, Show, Hide
      Timer_Hide := 1
    }
  }
  else
  {
    GUI, Destroy
    Loop, 5
      SetTimer, Timer_%A_Index%_Update, Off
    SetTimer, Timer_Hide, Off
  }
return

Timer_1_Reset:
Timer_2_Reset:
Timer_3_Reset:
Timer_4_Reset:
Timer_5_Reset:
  Timer_X := RegExReplace(A_ThisLabel, "^(Timer_\d+)_Reset$", "$1")
  if (!WinExist("Timer"))
    GoSub, #``
  if (GetKeyState("Alt", "P"))
  {
    GUIControl,, %Timer_X%, % Duration(Floor(%Timer_X%_Delay / 1000))
    SetTimer, %Timer_X%_Update, Off
    SoundPlay, X:\My Library\Scripts\AHK\beep.wav, 1
  }
  else
  {
    if (GetKeyState("Ctrl", "P"))
    {
      TMP := ""
      InputBox, TMP, Timer, Seconds?:,, 100, 125
      if ((StrLen(TMP)) && (TMP is number))
        %Timer_X%_Delay := TMP * 1000
    }
    %Timer_X%_Time := A_TickCount + %Timer_X%_Delay
    SetTimer, %Timer_X%_Update, 100
  }
return

Timer_1_Update:
Timer_2_Update:
Timer_3_Update:
Timer_4_Update:
Timer_5_Update:
  Timer_X := RegExReplace(A_ThisLabel, "^(Timer_\d+)_Update$", "$1")
  if (%Timer_X%_Time > A_TickCount)
    GUIControl,, %Timer_X%, % Duration(Floor((%Timer_X%_Time - A_TickCount) / 1000))
  else
  {
    GUIControl,, %Timer_X%, % Duration(Floor(%Timer_X%_Delay / 1000))
    SetTimer, %Timer_X%_Update, Off
    SoundPlay, X:\My Library\Scripts\AHK\beep.wav, 1
  }
return

Duration(in) {
  nn := Floor(in / 60)
  ss := Mod(in, 60)
  While (StrLen(nn) < 2)
    nn := 0 nn
  While (StrLen(ss) < 2)
    ss := 0 ss
  return nn ":" ss
}

!`::
  if (WinExist("Timer"))
  {
    GUI, Destroy
    Loop, 5
      SetTimer, Timer_%A_Index%_Update, Off
    SetTimer, Timer_Hide, Off
  }
  if (!WinExist("KeyBoard"))
  {
    WinGetPos, x, y, Width, Height, ahk_group RS
    x += Width
    GUI, +AlwaysOnTop +Border -Caption +ToolWindow +E0x08000000
    GUI, Font, S8 Bold, Tahoma
    KB := "1,2,3,4,5,6,7,8,9,0.q,w,e,r,t,y,u,i,o,p.a,s,d,f,g,h,j,k,l.z,x,c,v,b,n,m"
    Loop, Parse, KB, .
    {
      KBn := A_Index
      KBx := A_LoopField
      Loop, Parse, KBx, `,
      {
        xpos := (A_Index - 1) * 35
        ypos := (KBn - 1) * 30
        GUI, Add, Button, x%xpos% y%ypos% w35 h30 gButton, %A_LoopField%
      }
    }
    GUI, Add, Button, x315 y60 w35 h30 gButton vBackspace, -
    GUI, Add, Button, x315 y90 w35 h30 gButton vEnter, =
    GUI, Add, Button, x245 y90 w70 h30 gButton Default, Space
    GUI, Show, x%x% y%y% w350 h120 NoActivate, KeyBoard
    GUI, -AlwaysOnTop
    KeyBoard_Hide := 0
    SetTimer, KeyBoard_Hide, 100
  }
  else
  {
    GUI, Destroy
    SetTimer, KeyBoard_Hide, Off
  }
return

Button:
  Send {%A_GuiControl%}
return

KeyBoard_Hide:
  if (WinExist("ahk_group RS"))
  {
    if ((KeyBoard_Hide) && (WinActive("ahk_group RS")))
    {
      ;; GUI, Show, NA
      GUI, +AlwaysOnTop
      GUI, -AlwaysOnTop
      KeyBoard_Hide := 0
    }
    if ((!KeyBoard_Hide) && (!WinActive("ahk_group RS")))
    {
      ;; GUI, Show, Hide
      KeyBoard_Hide := 1
    }
  }
  else
  {
    GUI, Destroy
    SetTimer, KeyBoard_Hide, Off
  }
return

#If