Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 22nd, 2012  |  syntax: None  |  size: 8.15 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. HotkeySet(Hotkey, FunctionName=""){
  2.     Global HotkeySet := Object()
  3.  
  4.     if !FunctionName
  5.     {
  6.         Try Hotkey, %Hotkey%, Off
  7.         return 1 ; Not specified in docs, and hell if I'm installing AU3
  8.     }
  9.  
  10.     Try Hotkey, %Hotkey%, HotkeySet, On
  11.     catch
  12.         return 0 ; failure
  13.     if !IsFunc(functionName)
  14.         return 0
  15.     HotkeySet[Hotkey] := FunctionName
  16.     return 1
  17.  
  18.     HotkeySet:
  19.         f := HotkeySet[A_ThisHotkey]
  20.         %f%()
  21.     return
  22. }
  23.  
  24. Sleep(milliseconds){
  25.         Sleep milliseconds
  26. }
  27. Send(text=""){
  28.         Send % text
  29. }
  30. WinWaitActive(title="", text="", ExcludeTitle="", ExcludeText=""){
  31.         WinWaitActive, %title%, %text%, %ExcludeTitle%, %ExcludeText%
  32. }
  33.  
  34.  
  35.  
  36.  
  37. range(Start,End,Step = 1)
  38. {
  39.     Return, new Iterator(Start,End,Step = 1)
  40. }
  41.  
  42. class Iterator
  43. {
  44.     __New(Start,End,Step = 1)
  45.     {
  46.         this.Start := Start
  47.         this.End := End
  48.         this.Step := Step
  49.     }
  50.  
  51.     _NewEnum()
  52.     {
  53.         Return, new Iterator.Enumerator(this.Start,this.End,this.Step)
  54.     }
  55.  
  56.     class Enumerator
  57.     {
  58.         __New(Start,End,Step)
  59.         {
  60.             this.Start := Start
  61.             this.End := End
  62.             this.Step := Step
  63.             this.Index := Start
  64.         }
  65.  
  66.         Next(ByRef Key)
  67.         {
  68.             Key := this.Index
  69.             this.Index += this.Step
  70.             Return, Key <= this.End
  71.         }
  72.     }
  73. }
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. /*
  83.         Title: Command Functions
  84.                 A wrapper set of functions for commands which have an output variable.
  85.  
  86.         License:
  87.                 - Version 1.41 <http://www.autohotkey.net/~polyethene/#functions>
  88.                 - Dedicated to the public domain (CC0 1.0) <http://creativecommons.org/publicdomain/zero/1.0/>
  89. */
  90.  
  91. IfBetween(ByRef var, LowerBound, UpperBound) {
  92.         If var between %LowerBound% and %UpperBound%
  93.                 Return, true
  94. }
  95. IfNotBetween(ByRef var, LowerBound, UpperBound) {
  96.         If var not between %LowerBound% and %UpperBound%
  97.                 Return, true
  98. }
  99. IfIn(ByRef var, MatchList) {
  100.         If var in %MatchList%
  101.                 Return, true
  102. }
  103. IfNotIn(ByRef var, MatchList) {
  104.         If var not in %MatchList%
  105.                 Return, true
  106. }
  107. IfContains(ByRef var, MatchList) {
  108.         If var contains %MatchList%
  109.                 Return, true
  110. }
  111. IfNotContains(ByRef var, MatchList) {
  112.         If var not contains %MatchList%
  113.                 Return, true
  114. }
  115. IfIs(ByRef var, type) {
  116.         If var is %type%
  117.                 Return, true
  118. }
  119. IfIsNot(ByRef var, type) {
  120.         If var is not %type%
  121.                 Return, true
  122. }
  123.  
  124. ControlGet(Cmd, Value = "", Control = "", WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  125.         ControlGet, v, %Cmd%, %Value%, %Control%, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  126.         Return, v
  127. }
  128. ControlGetFocus(WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  129.         ControlGetFocus, v, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  130.         Return, v
  131. }
  132. ControlGetText(Control = "", WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  133.         ControlGetText, v, %Control%, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  134.         Return, v
  135. }
  136. DriveGet(Cmd, Value = "") {
  137.         DriveGet, v, %Cmd%, %Value%
  138.         Return, v
  139. }
  140. DriveSpaceFree(Path) {
  141.         DriveSpaceFree, v, %Path%
  142.         Return, v
  143. }
  144. EnvGet(EnvVarName) {
  145.         EnvGet, v, %EnvVarName%
  146.         Return, v
  147. }
  148. FileGetAttrib(Filename = "") {
  149.         FileGetAttrib, v, %Filename%
  150.         Return, v
  151. }
  152. FileGetShortcut(LinkFile, ByRef OutTarget = "", ByRef OutDir = "", ByRef OutArgs = "", ByRef OutDescription = "", ByRef OutIcon = "", ByRef OutIconNum = "", ByRef OutRunState = "") {
  153.         FileGetShortcut, %LinkFile%, OutTarget, OutDir, OutArgs, OutDescription, OutIcon, OutIconNum, OutRunState
  154. }
  155. FileGetSize(Filename = "", Units = "") {
  156.         FileGetSize, v, %Filename%, %Units%
  157.         Return, v
  158. }
  159. FileGetTime(Filename = "", WhichTime = "") {
  160.         FileGetTime, v, %Filename%, %WhichTime%
  161.         Return, v
  162. }
  163. FileGetVersion(Filename = "") {
  164.         FileGetVersion, v, %Filename%
  165.         Return, v
  166. }
  167. FileRead(Filename) {
  168.         FileRead, v, %Filename%
  169.         Return, v
  170. }
  171. FileReadLine(Filename, LineNum) {
  172.         FileReadLine, v, %Filename%, %LineNum%
  173.         Return, v
  174. }
  175. FileSelectFile(Options = "", RootDir = "", Prompt = "", Filter = "") {
  176.         FileSelectFile, v, %Options%, %RootDir%, %Prompt%, %Filter%
  177.         Return, v
  178. }
  179. FileSelectFolder(StartingFolder = "", Options = "", Prompt = "") {
  180.         FileSelectFolder, v, %StartingFolder%, %Options%, %Prompt%
  181.         Return, v
  182. }
  183. FormatTime(YYYYMMDDHH24MISS = "", Format = "") {
  184.         FormatTime, v, %YYYYMMDDHH24MISS%, %Format%
  185.         Return, v
  186. }
  187. GetKeyState(WhichKey , Mode = "") {
  188.         GetKeyState, v, %WhichKey%, %Mode%
  189.         Return, v
  190. }
  191. GuiControlGet(Subcommand = "", ControlID = "", Param4 = "") {
  192.         GuiControlGet, v, %Subcommand%, %ControlID%, %Param4%
  193.         Return, v
  194. }
  195. ImageSearch(ByRef OutputVarX, ByRef OutputVarY, X1, Y1, X2, Y2, ImageFile) {
  196.         ImageSearch, OutputVarX, OutputVarY, %X1%, %Y1%, %X2%, %Y2%, %ImageFile%
  197. }
  198. IniRead(Filename, Section, Key, Default = "") {
  199.         IniRead, v, %Filename%, %Section%, %Key%, %Default%
  200.         Return, v
  201. }
  202. Input(Options = "", EndKeys = "", MatchList = "") {
  203.         Input, v, %Options%, %EndKeys%, %MatchList%
  204.         Return, v
  205. }
  206. InputBox(Title = "", Prompt = "", HIDE = "", Width = "", Height = "", X = "", Y = "", Font = "", Timeout = "", Default = "") {
  207.         InputBox, v, %Title%, %Prompt%, %HIDE%, %Width%, %Height%, %X%, %Y%, , %Timeout%, %Default%
  208.         Return, v
  209. }
  210. MouseGetPos(ByRef OutputVarX = "", ByRef OutputVarY = "", ByRef OutputVarWin = "", ByRef OutputVarControl = "", Mode = "") {
  211.         MouseGetPos, OutputVarX, OutputVarY, OutputVarWin, OutputVarControl, %Mode%
  212. }
  213. PixelGetColor(X, Y, RGB = "") {
  214.         PixelGetColor, v, %X%, %Y%, %RGB%
  215.         Return, v
  216. }
  217. PixelSearch(ByRef OutputVarX, ByRef OutputVarY, X1, Y1, X2, Y2, ColorID, Variation = "", Mode = "") {
  218.         PixelSearch, OutputVarX, OutputVarY, %X1%, %Y1%, %X2%, %Y2%, %ColorID%, %Variation%, %Mode%
  219. }
  220. Random(Min = "", Max = "") {
  221.         Random, v, %Min%, %Max%
  222.         Return, v
  223. }
  224. RegRead(RootKey, SubKey, ValueName = "") {
  225.         RegRead, v, %RootKey%, %SubKey%, %ValueName%
  226.         Return, v
  227. }
  228. Run(Target, WorkingDir = "", Mode = "") {
  229.         Run, %Target%, %WorkingDir%, %Mode%, v
  230.         Return, v      
  231. }
  232. SoundGet(ComponentType = "", ControlType = "", DeviceNumber = "") {
  233.         SoundGet, v, %ComponentType%, %ControlType%, %DeviceNumber%
  234.         Return, v
  235. }
  236. SoundGetWaveVolume(DeviceNumber = "") {
  237.         SoundGetWaveVolume, v, %DeviceNumber%
  238.         Return, v
  239. }
  240. StatusBarGetText(Part = "", WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  241.         StatusBarGetText, v, %Part%, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  242.         Return, v
  243. }
  244. SplitPath(ByRef InputVar, ByRef OutFileName = "", ByRef OutDir = "", ByRef OutExtension = "", ByRef OutNameNoExt = "", ByRef OutDrive = "") {
  245.         SplitPath, InputVar, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
  246. }
  247. StringGetPos(ByRef InputVar, SearchText, Mode = "", Offset = "") {
  248.         StringGetPos, v, InputVar, %SearchText%, %Mode%, %Offset%
  249.         Return, v
  250. }
  251. StringLeft(ByRef InputVar, Count) {
  252.         StringLeft, v, InputVar, %Count%
  253.         Return, v
  254. }
  255. StringLen(ByRef InputVar) {
  256.         StringLen, v, InputVar
  257.         Return, v
  258. }
  259. StringLower(ByRef InputVar, T = "") {
  260.         StringLower, v, InputVar, %T%
  261.         Return, v
  262. }
  263. StringMid(ByRef InputVar, StartChar, Count , L = "") {
  264.         StringMid, v, InputVar, %StartChar%, %Count%, %L%
  265.         Return, v
  266. }
  267. StringReplace(ByRef InputVar, SearchText, ReplaceText = "", All = "") {
  268.         StringReplace, v, InputVar, %SearchText%, %ReplaceText%, %All%
  269.         Return, v
  270. }
  271. StringRight(ByRef InputVar, Count) {
  272.         StringRight, v, InputVar, %Count%
  273.         Return, v
  274. }
  275. StringTrimLeft(ByRef InputVar, Count) {
  276.         StringTrimLeft, v, InputVar, %Count%
  277.         Return, v
  278. }
  279. StringTrimRight(ByRef InputVar, Count) {
  280.         StringTrimRight, v, InputVar, %Count%
  281.         Return, v
  282. }
  283. StringUpper(ByRef InputVar, T = "") {
  284.         StringUpper, v, InputVar, %T%
  285.         Return, v
  286. }
  287. SysGet(Subcommand, Param3 = "") {
  288.         SysGet, v, %Subcommand%, %Param3%
  289.         Return, v
  290. }
  291. Transform(Cmd, Value1, Value2 = "") {
  292.         Transform, v, %Cmd%, %Value1%, %Value2%
  293.         Return, v
  294. }
  295. WinGet(Cmd = "", WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  296.         WinGet, v, %Cmd%, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  297.         Return, v
  298. }
  299. WinGetActiveTitle() {
  300.         WinGetActiveTitle, v
  301.         Return, v
  302. }
  303. WinGetClass(WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  304.         WinGetClass, v, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  305.         Return, v
  306. }
  307. WinGetText(WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  308.         WinGetText, v, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  309.         Return, v
  310. }
  311. WinGetTitle(WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  312.         WinGetTitle, v, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  313.         Return, v
  314. }