Advertisement
cycle4passion

Functions

Jun 14th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Title: Command Functions
  3.         A wrapper set of functions for commands which have an output variable.
  4.     License:
  5.         - Version 1.41 <http://www.autohotkey.net/~polyethene/#functions>
  6.         - Dedicated to the public domain (CC0 1.0) <http://creativecommons.org/publicdomain/zero/1.0/>
  7. */
  8.  
  9. Functions() {
  10.     Return, true
  11. }
  12.  
  13. IfBetween(ByRef var, LowerBound, UpperBound) {
  14.     If var between %LowerBound% and %UpperBound%
  15.         Return, true
  16. }
  17. IfNotBetween(ByRef var, LowerBound, UpperBound) {
  18.     If var not between %LowerBound% and %UpperBound%
  19.         Return, true
  20. }
  21. IfIn(ByRef var, MatchList) {
  22.     If var in %MatchList%
  23.         Return, true
  24. }
  25. IfNotIn(ByRef var, MatchList) {
  26.     If var not in %MatchList%
  27.         Return, true
  28. }
  29. IfContains(ByRef var, MatchList) {
  30.     If var contains %MatchList%
  31.         Return, true
  32. }
  33. IfNotContains(ByRef var, MatchList) {
  34.     If var not contains %MatchList%
  35.         Return, true
  36. }
  37. IfIs(ByRef var, type) {
  38.     If var is %type%
  39.         Return, true
  40. }
  41. IfIsNot(ByRef var, type) {
  42.     If var is not %type%
  43.         Return, true
  44. }
  45.  
  46. ControlGet(Cmd, Value = "", Control = "", WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  47.     ControlGet, v, %Cmd%, %Value%, %Control%, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  48.     Return, v
  49. }
  50. ControlGetFocus(WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  51.     ControlGetFocus, v, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  52.     Return, v
  53. }
  54. ControlGetText(Control = "", WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  55.     ControlGetText, v, %Control%, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  56.     Return, v
  57. }
  58. DriveGet(Cmd, Value = "") {
  59.     DriveGet, v, %Cmd%, %Value%
  60.     Return, v
  61. }
  62. DriveSpaceFree(Path) {
  63.     DriveSpaceFree, v, %Path%
  64.     Return, v
  65. }
  66. EnvGet(EnvVarName) {
  67.     EnvGet, v, %EnvVarName%
  68.     Return, v
  69. }
  70. FileGetAttrib(Filename = "") {
  71.     FileGetAttrib, v, %Filename%
  72.     Return, v
  73. }
  74. FileGetShortcut(LinkFile, ByRef OutTarget = "", ByRef OutDir = "", ByRef OutArgs = "", ByRef OutDescription = "", ByRef OutIcon = "", ByRef OutIconNum = "", ByRef OutRunState = "") {
  75.     FileGetShortcut, %LinkFile%, OutTarget, OutDir, OutArgs, OutDescription, OutIcon, OutIconNum, OutRunState
  76. }
  77. FileGetSize(Filename = "", Units = "") {
  78.     FileGetSize, v, %Filename%, %Units%
  79.     Return, v
  80. }
  81. FileGetTime(Filename = "", WhichTime = "") {
  82.     FileGetTime, v, %Filename%, %WhichTime%
  83.     Return, v
  84. }
  85. FileGetVersion(Filename = "") {
  86.     FileGetVersion, v, %Filename%
  87.     Return, v
  88. }
  89. FileRead(Filename) {
  90.     FileRead, v, %Filename%
  91.     Return, v
  92. }
  93. FileReadLine(Filename, LineNum) {
  94.     FileReadLine, v, %Filename%, %LineNum%
  95.     Return, v
  96. }
  97. FileSelectFile(Options = "", RootDir = "", Prompt = "", Filter = "") {
  98.     FileSelectFile, v, %Options%, %RootDir%, %Prompt%, %Filter%
  99.     Return, v
  100. }
  101. FileSelectFolder(StartingFolder = "", Options = "", Prompt = "") {
  102.     FileSelectFolder, v, %StartingFolder%, %Options%, %Prompt%
  103.     Return, v
  104. }
  105. FormatTime(YYYYMMDDHH24MISS = "", Format = "") {
  106.     FormatTime, v, %YYYYMMDDHH24MISS%, %Format%
  107.     Return, v
  108. }
  109. GetKeyState(WhichKey , Mode = "") {
  110.     GetKeyState, v, %WhichKey%, %Mode%
  111.     Return, v
  112. }
  113. GuiControlGet(Subcommand = "", ControlID = "", Param4 = "") {
  114.     GuiControlGet, v, %Subcommand%, %ControlID%, %Param4%
  115.     Return, v
  116. }
  117. ImageSearch(ByRef OutputVarX, ByRef OutputVarY, X1, Y1, X2, Y2, ImageFile) {
  118.     ImageSearch, OutputVarX, OutputVarY, %X1%, %Y1%, %X2%, %Y2%, %ImageFile%
  119. }
  120. IniRead(Filename, Section, Key, Default = "") {
  121.     IniRead, v, %Filename%, %Section%, %Key%, %Default%
  122.     Return, v
  123. }
  124. Input(Options = "", EndKeys = "", MatchList = "") {
  125.     Input, v, %Options%, %EndKeys%, %MatchList%
  126.     Return, v
  127. }
  128. InputBox(Title = "", Prompt = "", HIDE = "", Width = "", Height = "", X = "", Y = "", Font = "", Timeout = "", Default = "") {
  129.     InputBox, v, %Title%, %Prompt%, %HIDE%, %Width%, %Height%, %X%, %Y%, , %Timeout%, %Default%
  130.     Return, v
  131. }
  132. MouseGetPos(ByRef OutputVarX = "", ByRef OutputVarY = "", ByRef OutputVarWin = "", ByRef OutputVarControl = "", Mode = "") {
  133.     MouseGetPos, OutputVarX, OutputVarY, OutputVarWin, OutputVarControl, %Mode%
  134. }
  135. PixelGetColor(X, Y, RGB = "") {
  136.     PixelGetColor, v, %X%, %Y%, %RGB%
  137.     Return, v
  138. }
  139. PixelSearch(ByRef OutputVarX, ByRef OutputVarY, X1, Y1, X2, Y2, ColorID, Variation = "", Mode = "") {
  140.     PixelSearch, OutputVarX, OutputVarY, %X1%, %Y1%, %X2%, %Y2%, %ColorID%, %Variation%, %Mode%
  141. }
  142. Random(Min = "", Max = "") {
  143.     Random, v, %Min%, %Max%
  144.     Return, v
  145. }
  146. RegRead(RootKey, SubKey, ValueName = "") {
  147.     RegRead, v, %RootKey%, %SubKey%, %ValueName%
  148.     Return, v
  149. }
  150. Run(Target, WorkingDir = "", Mode = "") {
  151.     Run, %Target%, %WorkingDir%, %Mode%, v
  152.     Return, v  
  153. }
  154. SoundGet(ComponentType = "", ControlType = "", DeviceNumber = "") {
  155.     SoundGet, v, %ComponentType%, %ControlType%, %DeviceNumber%
  156.     Return, v
  157. }
  158. SoundGetWaveVolume(DeviceNumber = "") {
  159.     SoundGetWaveVolume, v, %DeviceNumber%
  160.     Return, v
  161. }
  162. StatusBarGetText(Part = "", WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  163.     StatusBarGetText, v, %Part%, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  164.     Return, v
  165. }
  166. SplitPath(ByRef InputVar, ByRef OutFileName = "", ByRef OutDir = "", ByRef OutExtension = "", ByRef OutNameNoExt = "", ByRef OutDrive = "") {
  167.     SplitPath, InputVar, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
  168. }
  169. StringGetPos(ByRef InputVar, SearchText, Mode = "", Offset = "") {
  170.     StringGetPos, v, InputVar, %SearchText%, %Mode%, %Offset%
  171.     Return, v
  172. }
  173. StringLeft(ByRef InputVar, Count) {
  174.     StringLeft, v, InputVar, %Count%
  175.     Return, v
  176. }
  177. StringLen(ByRef InputVar) {
  178.     StringLen, v, InputVar
  179.     Return, v
  180. }
  181. StringLower(ByRef InputVar, T = "") {
  182.     StringLower, v, InputVar, %T%
  183.     Return, v
  184. }
  185. StringMid(ByRef InputVar, StartChar, Count , L = "") {
  186.     StringMid, v, InputVar, %StartChar%, %Count%, %L%
  187.     Return, v
  188. }
  189. StringReplace(ByRef InputVar, SearchText, ReplaceText = "", All = "") {
  190.     StringReplace, v, InputVar, %SearchText%, %ReplaceText%, %All%
  191.     Return, v
  192. }
  193. StringRight(ByRef InputVar, Count) {
  194.     StringRight, v, InputVar, %Count%
  195.     Return, v
  196. }
  197. StringTrimLeft(ByRef InputVar, Count) {
  198.     StringTrimLeft, v, InputVar, %Count%
  199.     Return, v
  200. }
  201. StringTrimRight(ByRef InputVar, Count) {
  202.     StringTrimRight, v, InputVar, %Count%
  203.     Return, v
  204. }
  205. StringUpper(ByRef InputVar, T = "") {
  206.     StringUpper, v, InputVar, %T%
  207.     Return, v
  208. }
  209. SysGet(Subcommand, Param3 = "") {
  210.     SysGet, v, %Subcommand%, %Param3%
  211.     Return, v
  212. }
  213. Transform(Cmd, Value1, Value2 = "") {
  214.     Transform, v, %Cmd%, %Value1%, %Value2%
  215.     Return, v
  216. }
  217. WinGet(Cmd = "", WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  218.     WinGet, v, %Cmd%, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  219.     Return, v
  220. }
  221. WinGetActiveTitle() {
  222.     WinGetActiveTitle, v
  223.     Return, v
  224. }
  225. WinGetClass(WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  226.     WinGetClass, v, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  227.     Return, v
  228. }
  229. WinGetText(WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  230.     WinGetText, v, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  231.     Return, v
  232. }
  233. WinGetTitle(WinTitle = "", WinText = "", ExcludeTitle = "", ExcludeText = "") {
  234.     WinGetTitle, v, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
  235.     Return, v
  236. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement