zamaro

OSRS prayer V2 b4 adding food

Feb 24th, 2014
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.42 KB | None | 0 0
  1. #NoEnv
  2. #singleinstance force
  3. Process, Priority, , High
  4.  
  5. SetWorkingDir, %A_ScriptDir%
  6. file = %A_ScriptDir%\settings.ini
  7.  
  8. IniRead, prot1, settings.ini, settings, prot1
  9. IniRead, prot2, settings.ini, settings, prot2
  10. IniRead, prot3, settings.ini, settings, prot3
  11. IniRead, prot4, settings.ini, settings, prot4
  12. IniRead, prot5, settings.ini, settings, prot5
  13. IniRead, prot6, settings.ini, settings, prot6
  14. IniRead, prot7, settings.ini, settings, prot7
  15.  
  16. IniRead, arm1, settings.ini, settings, arm1
  17. IniRead, arm2, settings.ini, settings, arm2
  18. IniRead, arm3, settings.ini, settings, arm3
  19. IniRead, arm4, settings.ini, settings, arm4
  20. IniRead, arm5, settings.ini, settings, arm5
  21. IniRead, arm6, settings.ini, settings, arm6
  22. IniRead, arm7, settings.ini, settings, arm7
  23.  
  24. IniRead, Steelskins, settings.ini, settings, Steelskins
  25. IniRead, mysticMight, settings.ini, settings, mysticMight
  26. IniRead, ItemProtects, settings.ini, settings, ItemProtects
  27.  
  28. IniRead, Radio1, settings.ini, Armors, Radio1
  29. IniRead, Radio2, settings.ini, Armors, Radio2
  30. IniRead, Radio3, settings.ini, Armors, Radio3
  31. IniRead, Radio4, settings.ini, Armors, Radio4
  32.  
  33. IniRead, Inv, settings.ini, Icons, Inv
  34. IniRead, Origin, settings.ini, Icons, origin
  35.  
  36. IniRead, Frunning, settings.ini, settings, Frunning
  37. IniRead, Fsleep, settings.ini, settings, Fsleep
  38. IniRead, Fbinds, settings.ini, settings, Fbinds
  39.  
  40. IniRead, Un1, settings.ini, settings, Un1
  41. IniRead, Un2, settings.ini, settings, Un2
  42. IniRead, Un3, settings.ini, settings, Un3
  43. IniRead, Un4, settings.ini, settings, Un4
  44. IniRead, Un5, settings.ini, settings, Un5
  45. IniRead, Un6, settings.ini, settings, Un6
  46. IniRead, Un7, settings.ini, settings, Un7
  47.  
  48.  
  49.  
  50. Sleep1= 50 ; Random Range Of sleep time
  51. Sleep2= 100 ; Used after pressing the F-Key to switch to run/prayer tab.
  52.  
  53. ;Mouse Positions X/Y Coordinates For Orion, AB For RSclient, change them if needed.
  54.  
  55. X1=684 ; melee prayer
  56. Y1=396 ; mouse position
  57.  
  58. X2=643 ; range prayer
  59. y2=396 ; mouse position
  60.  
  61. x3=608 ; mage prayer
  62. y3=396 ; mouse position
  63.  
  64. x4=681 ; steel skin
  65. y4=359 ; mouse position
  66.  
  67. x5=570 ; item protect
  68. y5=354 ; mouse position
  69.  
  70. x6=571 ; mystic might
  71. y6=430 ; mouse position
  72.  
  73. x7=639 ; final Mouse Position
  74. y7=237 ; after finishing prayer clicks
  75.  
  76. x8=583 ; Run icon
  77. y8=191 ; mouse position
  78.  
  79. x9=750 ; clicks Mouse Top right of screen
  80. y9=197 ; to cancel "cast bind" before activating prayer.
  81.  
  82. X10=560 ; Quicker minimap orb icon cords
  83. y10=165 ; Clicks quick prayer
  84.  
  85. x11=582 ; Invslot No.1 - Armor
  86. y11=280 ; mouse posion
  87.  
  88. x12=625 ; InvSlot No.2 - Armor
  89. y12=280 ; mouse position
  90.  
  91. x13=665 ; InvSlot No.3 - Armor
  92. y13=280 ; mouse position
  93.  
  94. x14=707 ; InvSlot No.4 - Armor
  95. y14=280 ; mouse position
  96.  
  97. X15=653 ; Platebody Equip - armor
  98. Y15=359 ; mouse position
  99.  
  100. X16=653 ; Platelgs Equip - Armor
  101. Y16=395 ; mouse position
  102.  
  103. X17=700 ; kite - armor
  104. Y17=350 ; mouse position
  105.  
  106. X18=650 ; helm - armor
  107. Y18=279 ; mouse position
  108.  
  109. YI5=1 : mouse position
  110.  
  111.  
  112. ;RSClient Coods
  113.  
  114. XR1=694
  115. YR1=369
  116.  
  117. XR2=654
  118. YR2=369
  119.  
  120. XR3=618
  121. YR3=369
  122.  
  123. XR4=694
  124. YR4=332
  125.  
  126. XR5=580
  127. YR5=335
  128.  
  129. XR6=582
  130. YR6=410
  131.  
  132. XR7=656
  133. YR7=208
  134.  
  135. XR8=595
  136. YR8=160
  137.  
  138. XR9=763
  139. YR9=174
  140.  
  141. xr10=571
  142. yr10=122
  143.  
  144.  
  145. xr11=591
  146. yr11=250
  147.  
  148.  
  149. xr12=633
  150. yr12=250
  151.  
  152. xr13=675
  153. yr13=250
  154.  
  155. xr14=715
  156. yr14=250
  157.  
  158. XR15=650
  159. YR15=330
  160.  
  161. XR16=650
  162. YR16=366
  163.  
  164. XR17=700
  165. YR17=330
  166.  
  167. XR18=650
  168. YR18=255
  169.  
  170. offset=2
  171.  
  172. YRi5=285
  173. YRI9=325
  174. YRi13=360
  175. YRi17=390
  176. YRI21=427
  177. YR25=468
  178.  
  179.  
  180. goto ^g
  181. return
  182.  
  183. ^g::
  184. GUI Destroy
  185. GoSub GUI
  186. return
  187.  
  188. Gui:
  189. Gui, Add, Button, x6 y7 w100 h20 , About
  190. Gui, Add, Button, x6 y27 w100 h20 , Resize RSclient
  191. Gui, Font, S10 CDefault, Verdana
  192. Gui, Add, Button, x5 y100 w100 h25 , Key setup
  193. Gui, Add, Text, x516 y107 w90 h20 , Protections:
  194. Gui, Add, Text, x116 y107 w20 h20 , F1
  195. Gui, Add, Text, x196 y107 w20 h20 , F2
  196. Gui, Add, Text, x256 y107 w20 h20 , F3
  197. Gui, Font, S8 CDefault, Verdana
  198. Gui, Font, S6 CDefault, Verdana
  199. Gui, Font, S7 CDefault, Verdana
  200. Gui, Add, DropDownList, x96 y137 w70 h90 vF1downs choose1 , Quick|Melee|Range|Mage|None
  201. Gui, Add, CheckBox, x116 y167 w10 h10 vProt1 checked%prot1% , Protections f1
  202. Gui, Add, CheckBox, x116 y197 w10 h10 vArm1 checked%arm1%, Armor equip f1
  203. Gui, Add, Text, x6 y137 w80 h20 , Prayer type:
  204. Gui, Add, DropDownList, x176 y137 w60 h130 vF2downs choose2 , Quick|Melee|Range|Mage|None
  205. Gui, Add, CheckBox, x196 y167 w10 h10 vprot2 checked%prot2%, Protections f2
  206. Gui, Add, CheckBox, x196 y197 w10 h10 varm2 checked%arm2%, Armor equipf2
  207. Gui, Add, DropDownList, x236 y137 w60 h110 vF3downs choose3 , Quick|Melee|Range|Mage|None
  208. Gui, Add, CheckBox, x256 y167 w10 h10 vprot3 checked%prot3% , Protections f3
  209. Gui, Add, Text, x6 y197 w100 h20 , Equip armor equip?
  210. Gui, Add, CheckBox, x256 y197 w10 h10 varm3 checked%arm3%, Armor equipf3
  211. Gui, Add, Text, x316 y107 w20 h20 , F4
  212. Gui, Add, Text, x366 y107 w20 h20 , F5
  213. Gui, Add, Text, x416 y107 w20 h20 , F6
  214. Gui, Add, Text, x466 y107 w20 h20 , F7
  215. Gui, Add, DropDownList, x296 y137 w60 h140 vf4downs choose2, Quick|Melee|Range|Mage|None
  216. Gui, Add, DropDownList, x356 y137 w50 h120 vF5downs choose3, Quick|Melee|Range|Mage|None
  217. Gui, Add, DropDownList, x406 y137 w50 h130 vF6downs choose4, Quick|Melee|Range|Mage|None
  218. Gui, Add, DropDownList, x456 y137 w50 h120 vF7downs choose5, Quick|Melee|Range|Mage|None
  219. Gui, Add, CheckBox, x316 y167 w10 h10 vprot4 checked%prot4%, Protections f4
  220. Gui, Add, CheckBox, x366 y167 w10 h10 vprot5 checked%prot5% , Protections f5
  221. Gui, Add, CheckBox, x416 y167 w10 h10 vprot6 checked%prot6% , Protections f6
  222. Gui, Add, CheckBox, x466 y167 w10 h10 vprot7 checked%prot7%, Protections f7
  223. Gui, Add, CheckBox, x316 y197 w10 h10 varm4 checked%arm4%, Armor equipf4
  224. Gui, Add, CheckBox, x366 y197 w10 h10 varm5 checked%arm5%, Armor equipf5
  225. Gui, Add, CheckBox, x416 y197 w10 h10 varm6 checked%arm6%, Armor equipf6
  226. Gui, Add, CheckBox, x466 y197 w10 h10 varm7 checked%arm7%, Armor equipf7
  227. Gui, Add, Text, x496 y87 w110 h0 , Text
  228. Gui, Add, Text, x616 y87 w-170 h-10 , Text
  229. Gui, Add, Text, x146 y247 w140 h-20 , Mouse position when done
  230. Gui, Add, Text, x6 y257 w60 h20 , Settings:
  231. Gui, Add, CheckBox, x6 y287 w90 h20 vFrunning checked%Frunning%, ~ toggles run
  232. Gui, Add, CheckBox, x6 y317 w90 h20 vFsleep checked%Fsleep%, Sleep time
  233. Gui, Add, CheckBox, x6 y347 w90 h20 vFbinds checked%Fbinds%, Bind unclick
  234. Gui, Add, Radio, x416 y287 w60 h20 vRadio1 checked%Radio1% , One
  235. Gui, Add, Radio, x416 y317 w60 h20 VRadio2 checked%Radio2%, Two
  236. Gui, Add, Radio, x526 y287 w60 h20 VRadio3 checked%Radio3%, Three
  237. Gui, Add, Radio, x526 y317 w60 h20 vRadio4 checked%Radio4%, Four
  238. Gui, Font, S12 CDefault, Verdana
  239. Gui, Add, Button, x206 y357 w220 h60 , Click here when done!
  240. Gui, Font, S10 CDefault, Verdana
  241. Gui, Add, Button, x6 y397 w110 h20 , Resize RSclient
  242. Gui, Font, S16 CDefault, Verdana
  243. Gui, Add, Text, x166 y27 w280 h40 , OSRS Prayer: By Samerdl
  244. Gui, Font, S8 CDefault, Verdana
  245. Gui, Add, Text, x6 y167 w100 h20 , Use protections ?
  246. Gui, Add, CheckBox, x516 y197 w100 h20 vmysticMight checked%mysticmight%, Mystic might
  247. Gui, Font, S7 CDefault, Verdana
  248. Gui, Font, S8 CDefault, Verdana
  249. Gui, Add, CheckBox, x516 y167 w100 h20 vItemProtects checked%itemprotects%, Item protect
  250. Gui, Add, CheckBox, x516 y137 w100 h20 vSteelskins checked%Steelskins%, Steel skin
  251. Gui, Add, Text, x446 y247 w100 h20 , Armor Equpping:
  252. Gui, Add, Text, x156 y247 w160 h30 , Mouse position when done:
  253. Gui, Add, Radio, x126 y287 w80 h40 vinv checked%inv%, Inventory icon
  254. Gui, Add, Radio, x256 y287 w80 h40 vOrigin checked%origin% , Original position
  255. Gui, Add, Button, x526 y387 w100 h30 gSave1, Save
  256. Gui, Add, Text, x6 y227 w100 h20 , Armor un-equip?
  257. Gui, Add, CheckBox, x116 y227 w10 h10 vUn1 Checked%un1%, Un1
  258. Gui, Add, CheckBox, x196 y227 w10 h10 vUn2 Checked%un2%, Un2
  259. Gui, Add, CheckBox, x256 y227 w10 h10 vUn3 Checked%un3%, Un3
  260. Gui, Add, CheckBox, x316 y227 w10 h10 vUn4 Checked%un4%, Un4
  261. Gui, Add, CheckBox, x366 y227 w10 h10 vUn5 Checked%un5%, Un5
  262. Gui, Add, CheckBox, x416 y227 w10 h10 vUn6 Checked%un6%, Un6
  263. Gui, Add, CheckBox, x466 y227 w10 h10 vUn7 Checked%un7%, un7
  264. Gui, Add, DropDownList, x536 y347 w70 h140 vArmUn Choose2, One|Two|Three|Four
  265. Gui, Font, S8 CDefault, Verdana
  266. Gui, Add, Text, x466 y347 w60 h20 , un-equip:
  267. Gui, Add, Button, x6 y377 w110 h20 , Food Setup
  268. ; Generated using SmartGUI Creator 4.0
  269. Gui, Show, x279 y148 h422 w629, New GUI Window
  270. Gosub, ReadConfiguration
  271. Return
  272.  
  273.  
  274. Save1:
  275. Gui, Submit, NoHide
  276. IniWrite, %F1downs%, %file%, DDL1, Quick|Melee|Range|Mage|None
  277. IniWrite, %F2downs%, %file%, DDL2, Quick|Melee|Range|Mage|None
  278. IniWrite, %F3downs%, %file%, DDL3, Quick|Melee|Range|Mage|None
  279. IniWrite, %F4downs%, %file%, DDL4, Quick|Melee|Range|Mage|None
  280. IniWrite, %F5downs%, %file%, DDL5, Quick|Melee|Range|Mage|None
  281. IniWrite, %F6downs%, %file%, DDL6, Quick|Melee|Range|Mage|None
  282. IniWrite, %F7downs%, %file%, DDL7, Quick|Melee|Range|Mage|None
  283. IniWrite, %ArmUn%, %file%, DDL8, One|Two|Three|Four
  284.  
  285. IniWrite, %prot1%, settings.ini, settings, prot1
  286. IniWrite, %prot2%, settings.ini, settings, prot2
  287. IniWrite, %prot3%, settings.ini, settings, prot3
  288. IniWrite, %prot4%, settings.ini, settings, prot4
  289. IniWrite, %prot5%, settings.ini, settings, prot5
  290. IniWrite, %prot6%, settings.ini, settings, prot6
  291. IniWrite, %prot7%, settings.ini, settings, prot7
  292.  
  293. IniWrite, %arm1%, settings.ini, settings, arm1
  294. IniWrite, %arm2%, settings.ini, settings, arm2
  295. IniWrite, %arm3%, settings.ini, settings, arm3
  296. IniWrite, %arm4%, settings.ini, settings, arm4
  297. IniWrite, %arm5%, settings.ini, settings, arm5
  298. IniWrite, %arm6%, settings.ini, settings, arm6
  299. IniWrite, %arm7%, settings.ini, settings, arm7
  300.  
  301. IniWrite, %itemprotects%, settings.ini, settings, itemprotects
  302. IniWrite, %steelskins%, settings.ini, settings, steelskins
  303. IniWrite, %mysticMight%, settings.ini, settings, mysticMight
  304.  
  305.  
  306. IniWrite, %Radio1%, settings.ini, Armors, Radio1
  307. IniWrite, %Radio2%, settings.ini, Armors, Radio2
  308. IniWrite, %Radio3%, settings.ini, Armors, Radio3
  309. IniWrite, %Radio4%, settings.ini, Armors, Radio4
  310.  
  311. IniWrite, %inv%, settings.ini, Icons, inv
  312. IniWrite, %origin%, settings.ini, Icons,origin
  313.  
  314. IniWrite, %Frunning%, settings.ini, settings, frunning
  315. IniWrite, %Fsleep%, settings.ini, settings, Fsleep
  316. IniWrite, %Fbinds%, settings.ini, settings, Fbinds
  317.  
  318. IniWrite, %un1%, settings.ini, settings, un1
  319. IniWrite, %un2%, settings.ini, settings, un2
  320. IniWrite, %un3%, settings.ini, settings, un3
  321. IniWrite, %un4%, settings.ini, settings, un4
  322. IniWrite, %un5%, settings.ini, settings, un5
  323. IniWrite, %un6%, settings.ini, settings, un6
  324. IniWrite, %un7%, settings.ini, settings, un7
  325. return
  326.  
  327.  
  328.  
  329. ReadConfiguration: ;Read the saved configuration
  330. IfExist, %file% ;First check if it was saved.
  331. {
  332. IniRead, F1downs, %file%, DDL1, Quick|Melee|Range|Mage|None
  333. GuiControl, ChooseString, F1downs, %F1downs% ;Submit
  334. IniRead, F2downs, %file%, DDL2, Quick|Melee|Range|Mage|None
  335. GuiControl, ChooseString, F2downs, %F2downs% ;Submit
  336. IniRead, F3downs, %file%, DDL3, Quick|Melee|Range|Mage|None
  337. GuiControl, ChooseString, F3downs, %F3downs% ;Submit
  338. IniRead, F4downs, %file%, DDL4, Quick|Melee|Range|Mage|None
  339. GuiControl, ChooseString, F4downs, %F4downs% ;Submit
  340. IniRead, F5downs, %file%, DDL5, Quick|Melee|Range|Mage|None
  341. GuiControl, ChooseString, F5downs, %F5downs% ;Submit
  342. IniRead, F6downs, %file%, DDL6, Quick|Melee|Range|Mage|None
  343. GuiControl, ChooseString, F6downs, %F6downs% ;Submit
  344. IniRead, F7downs, %file%, DDL7, Quick|Melee|Range|Mage|None
  345. GuiControl, ChooseString, F7downs, %F7downs% ;Submit
  346.  
  347. IniRead, ArmUn, %file%, DDL8, One|Two|Three|Four
  348. GuiControl, ChooseString, Armun, %Armun% ;Submit
  349.  
  350. }
  351. return
  352.  
  353. GuiClose:
  354. ExitApp
  355.  
  356.  
  357.  
  358. ButtonClickherewhendone!:
  359. gosub Save1
  360. MsgBox, 0, OSRS Prayer, You can restore and re-edit this interface at anytime by Pressing Control +G.`n`Remember to suspend the script when you have no use for it.`n`n`If you are using Jagex's RSclient Be sure to click the resize button so the clicks can work correctl (or press Control + F12 while your RSclient SCreen is on top).
  361. Gui, Destroy
  362. return
  363.  
  364. ButtonResizeRsClient:
  365. MsgBox, 1,OSRS Prayer, If you Click Ok the script will locate the Jagex RS client and resize it so the Hotkeys can work correctly. Orion needs to remain at defaul size - compact mode.`n`n`(Note you can also press Control + F12 To resize the rs client as well without clicking this message).
  366. IfMsgBox Ok
  367. IfWinExist Old School RuneScape
  368. {
  369. WinActivate
  370. ResizeWin(793,571)
  371. }
  372. return
  373. return
  374.  
  375. ButtonAbout:
  376. gui, 2:Default
  377. Gui, 2:Margin, 10, 10
  378. Gui, 2:Add, Text, center w240 h15, OSRS Prayer: By Samerdl
  379. Gui, 2:Add, Button, xp+5 yp+20,F-keys_And_Overheads
  380. Gui, 2:Add, button, default,Resizing_The_Rs_Client
  381. Gui, 2:Add, Button, default w+120,Run_toggling_feature
  382. Gui, 2:Add, Button, default w+140,Bind_Unclicking_Feature
  383. Gui, 2:Add, Button, default w+120,Mouse_Positioning_When_Done_Feature
  384. Gui, 2:Add, Button, default w+120,Sleep_time_feature
  385. Gui, 2:Add, Button, default xp+150 yp-100,General_Info
  386. Gui, 2:Add, Button, W240 xs-5 Close,Close
  387.  
  388. Gui, 2:Show, w250, About ~ OSRS Prayer: By Samerdl
  389. return
  390.  
  391. ButtonFoodSetup:
  392. #ctrls = 5 ;How many Hotkey controls to add?
  393. Loop,% #ctrls {
  394. Gui, 4:Add, button, xm, Food Key #%A_Index%:
  395. IniRead, savedFK%A_Index%, settings.ini, Hotkeys, %A_Index%, %A_Space%
  396. If savedFK%A_Index% ;Check for saved hotkeys in INI file.
  397. Hotkey,% savedFK%A_Index%, Labels%A_Index% ;Activate saved hotkeys if found.
  398. StringReplace, noMods, savedFK%A_Index%, ~ ;Remove tilde (~) and Win (#) modifiers...
  399. StringReplace, noMods, noMods, #,,UseErrorLevel ;They are incompatible with hotkey controls (cannot be shown).
  400. Gui, 4:Add, Hotkey, x+5 vFK%A_Index% gGuiLabel2, %noMods% ;Add hotkey controls and show saved hotkeys.
  401. }
  402. Gui, 4:Add, Button, , Save and exit ;Check the box if Win modifier is used.
  403. Gui, 4:Show,,Dynamic Hotkeys
  404. return
  405.  
  406.  
  407. 4ButtonSaveandExit:
  408. Gui, 4:Submit
  409. savedFK%num% := FK%num%
  410. Gui, 4:Destroy
  411. return
  412.  
  413.  
  414.  
  415. GuiLabel2:
  416. If %A_GuiControl% in +,^,!,+^,+!,^!,+^! ;If the hotkey contains only modifiers, return to wait for a key.
  417. return
  418. If InStr(%A_GuiControl%,"vk07") ;vk07 = MenuMaskKey (see below)
  419. GuiControl,,%A_GuiControl%, % lastFK ;Reshow the hotkey, because MenuMaskKey clears it.
  420. Else
  421. validateFK(A_GuiControl)
  422. return
  423.  
  424. validateFK(GuiControl) {
  425. global lastFK
  426. Gui, Submit, NoHide
  427. lastFK := %GuiControl% ;Backup the hotkey, in case it needs to be reshown.
  428. num := SubStr(GuiControl,3) ;Get the index number of the hotkey control.
  429. If (FK%num% != "") { ;If the hotkey is not blank...
  430. StringReplace, FK%num%, FK%num%, SC15D, AppsKey ;Use friendlier names,
  431. StringReplace, FK%num%, FK%num%, SC154, PrintScreen ; instead of these scan codes.
  432. If CB%num% ; If the 'Win' box is checked, then add its modifier (#).
  433. FK%num% := "#" FK%num%
  434. If !RegExMatch(FK%num%,"[#!\^\+]") ; If the new hotkey has no modifiers, add the (~) modifier.
  435. FK%num% := "~" FK%num% ; This prevents any key from being blocked.
  436. checkDuplicateFK(num)
  437. }
  438. If (savedFK%num% || FK%num%) ;Unless both are empty,
  439. setFK(num, savedFK%num%, FK%num%) ; update INI/GUI
  440. }
  441.  
  442. checkDuplicateFK(num) {
  443. global #ctrls
  444. Loop,% #ctrls
  445. If (FK%num% = savedFK%A_Index%) {
  446. dup := A_Index
  447. Loop,6 {
  448. GuiControl,% "Disable" b:=!b, FK%dup% ;Flash the original hotkey to alert the user.
  449. Sleep,200
  450. }
  451. GuiControl,,FK%num%,% FK%num% :="" ;Delete the hotkey and clear the control.
  452. break
  453. }
  454. }
  455.  
  456. setFK(num,INI,GUI) {
  457. If INI ;If previous hotkey exists,
  458. Hotkey, %INI%, Label%num%, Off ; disable it.
  459. If GUI ;If new hotkey exists,
  460. Hotkey, %GUI%, Label%num%, On ; enable it.
  461. IniWrite,% GUI ? GUI:null, settings.ini, Hotkeys, %num%
  462. savedFK%num% := FK%num%
  463. }
  464.  
  465. #MenuMaskKey vk07 ;Requires AFK_L 38+
  466. #If ctrl := HotkeyCtrlHasFocus1()
  467. modifier := ""
  468. If GetKeyState("Shift","P")
  469. modifier .= "+"
  470. If GetKeyState("Ctrl","P")
  471. modifier .= "^"
  472. If GetKeyState("Alt","P")
  473. modifier .= "!"
  474. Gui, Submit, NoHide ;If BackSpace is the first key press, Gui has never been submitted.
  475. If (A_ThisHotkey == "*BackSpace" && %ctrl% && !modifier) ;If the control has text but no modifiers held,
  476. GuiControl,,%ctrl% ; allow BackSpace to clear that text.
  477. Else ;Otherwise,
  478. GuiControl,,%ctrl%, % modifier SubStr(A_ThisHotkey,2) ; show the hotkey.
  479. validateFK(ctrl)
  480. return
  481. #If
  482.  
  483. HotkeyCtrlHasFocus1() {
  484. GuiControlGet, ctrl, Focus ;ClassNN
  485. If InStr(ctrl,"hotkey") {
  486. GuiControlGet, ctrl, FocusV ;Associated variable
  487. Return, ctrl
  488. }
  489. }
  490.  
  491.  
  492.  
  493.  
  494. 2ButtonClose:
  495. gui, 2:submit
  496. return
  497.  
  498. 2ButtonGeneral_Info:
  499. MsgBox, 0,OSRS Prayer, OSRS-Prayer is an Oldschool RS utility designed to speed up the act of Activating and De-activating Prayer & Run in the game.`n`n`It's is designed for the Orion client & the Rs client - use it at your own risk (against the rules).`n`n`{{ DO NOT USE IT ON BROWSERS!}}.
  500. return
  501.  
  502. 2ButtonF-keys_And_Overheads:
  503. MsgBox, 0,OSRS Prayer, F1-F3 Keys funciton as full on prayer activator, they will turn on: overhead, item protect, steel skin & Mystic might.`n`n`F4-F6 turns on Overheads only, coordinates for mouse clicks can be changed from within the script.
  504. return
  505.  
  506. 2buttonResizing_The_Rs_Client:
  507. MsgBox, 0,OSRS Prayer, The Resize feature (From the gui or just press Control + f12) will resize the RSClient to a pre-selected size so all the clicks will register properly and accordingly to the desired positions.`n`n` This feature is only needed for the Rsclient, as the Orion Client doesn't require a resize (yet).
  508. return
  509.  
  510. 2buttonRun_toggling_feature:
  511. MsgBox, 0,OSRS Prayer, This feature will turn run on and off when you press the backquote key.`n`n`Although the Gui shows the tilde (~) key is required for activation, you dont need to press shift to activate it - as the key bind is set to the backtick key (backquote, the tilde without shift I.E "`",`. Its just too hard to see it.
  512. return
  513.  
  514. 2buttonMouse_Positioning_When_Done_Feature:
  515. MsgBox, 0,OSRS Prayer, There are two options for the mouse position once the script finishes performing prayer/run toggles, it can eiher be the same position you've had it before, or it will move To X7/Y7 coords - the top of inventory close to the Inventory icon, you can change that within the script to any position you please.
  516. return
  517.  
  518. 2buttonBind_Unclicking_Feature:
  519. MsgBox, 0,OSRS Prayer, This feature will make sure to click at the top right of the screen before performing run/prayer activation/deactivation.`n`n`This is done to prevent the clicks from unregistering when you have 'cast bind' held (if you're a mager), not recommened to use this feature.
  520. return
  521.  
  522. 2buttonSleep_time_feature:
  523. msgbox,0,OSRS PRAYER, Sleep Time ads a wait time after & Before F-Keying between tabs, the Wait time is set in Sleep1, Sleep2.`n`n` By default the Sleep time is set to a random range between 100 to 150 MS.`n`Such Feature is needed to prevent bad clicks/failed clicks.
  524.  
  525. ButtonKeysetup:
  526. #ctrls = 7 ;How many Hotkey controls to add?
  527. Loop,% #ctrls {
  528. Gui, 3:Add, Text, xm, Enter Activation key #%A_Index%:
  529. IniRead, savedHK%A_Index%, settings.ini, Hotkeys, %A_Index%, %A_Space%
  530. If savedHK%A_Index% ;Check for saved hotkeys in INI file.
  531. Hotkey,% savedHK%A_Index%, Label%A_Index% ;Activate saved hotkeys if found.
  532. StringReplace, noMods, savedHK%A_Index%, ~ ;Remove tilde (~) and Win (#) modifiers...
  533. StringReplace, noMods, noMods, #,,UseErrorLevel ;They are incompatible with hotkey controls (cannot be shown).
  534. Gui, 3:Add, Hotkey, x+5 vHK%A_Index% gGuiLabel, %noMods% ;Add hotkey controls and show saved hotkeys.
  535. } ;Check the box if Win modifier is used.
  536. Gui, 3:Add, Button, , Save and Close
  537. Gui, 3:Show,,Dynamic Hotkeys
  538. return
  539.  
  540. 3ButtonSaveandClose:
  541. Gui, 3:Submit
  542. savedHK%num% := HK%num%
  543. Gui, 3:Destroy
  544. return
  545.  
  546. GuiLabel:
  547. If %A_GuiControl% in +,^,!,+^,+!,^!,+^! ;If the hotkey contains only modifiers, return to wait for a key.
  548. return
  549. If InStr(%A_GuiControl%,"vk07") ;vk07 = MenuMaskKey (see below)
  550. GuiControl,,%A_GuiControl%, % lastHK ;Reshow the hotkey, because MenuMaskKey clears it.
  551. Else
  552. validateHK(A_GuiControl)
  553. return
  554.  
  555. validateHK(GuiControl) {
  556. global lastHK
  557. Gui, Submit, NoHide
  558. lastHK := %GuiControl% ;Backup the hotkey, in case it needs to be reshown.
  559. num := SubStr(GuiControl,3) ;Get the index number of the hotkey control.
  560. If (HK%num% != "") { ;If the hotkey is not blank...
  561. StringReplace, HK%num%, HK%num%, SC15D, AppsKey ;Use friendlier names,
  562. StringReplace, HK%num%, HK%num%, SC154, PrintScreen ; instead of these scan codes.
  563. If CB%num% ; If the 'Win' box is checked, then add its modifier (#).
  564. HK%num% := "#" HK%num%
  565. If !RegExMatch(HK%num%,"[#!\^\+]") ; If the new hotkey has no modifiers, add the (~) modifier.
  566. HK%num% := "~" HK%num% ; This prevents any key from being blocked.
  567. checkDuplicateHK(num)
  568. }
  569. If (savedHK%num% || HK%num%) ;Unless both are empty,
  570. setHK(num, savedHK%num%, HK%num%) ; update INI/GUI
  571. }
  572.  
  573. checkDuplicateHK(num) {
  574. global #ctrls
  575. Loop,% #ctrls
  576. If (HK%num% = savedHK%A_Index%) {
  577. dup := A_Index
  578. Loop,6 {
  579. GuiControl,% "Disable" b:=!b, HK%dup% ;Flash the original hotkey to alert the user.
  580. Sleep,200
  581. }
  582. GuiControl,,HK%num%,% HK%num% :="" ;Delete the hotkey and clear the control.
  583. break
  584. }
  585. }
  586.  
  587. setHK(num,INI,GUI) {
  588. If INI ;If previous hotkey exists,
  589. Hotkey, %INI%, Label%num%, Off ; disable it.
  590. If GUI ;If new hotkey exists,
  591. Hotkey, %GUI%, Label%num%, On ; enable it.
  592. IniWrite,% GUI ? GUI:null, settings.ini, Hotkeys, %num%
  593. savedHK%num% := HK%num%
  594. }
  595.  
  596. #MenuMaskKey vk07 ;Requires AHK_L 38+
  597. #If ctrl := HotkeyCtrlHasFocus()
  598. *AppsKey:: ;Add support for these special keys,
  599. *BackSpace:: ; which the hotkey control does not normally allow.
  600. *Delete::
  601. *Enter::
  602. *Escape::
  603. *Pause::
  604. *PrintScreen::
  605. *Space::
  606. *Tab::
  607. modifier := ""
  608. If GetKeyState("Shift","P")
  609. modifier .= "+"
  610. If GetKeyState("Ctrl","P")
  611. modifier .= "^"
  612. If GetKeyState("Alt","P")
  613. modifier .= "!"
  614. Gui, Submit, NoHide ;If BackSpace is the first key press, Gui has never been submitted.
  615. If (A_ThisHotkey == "*BackSpace" && %ctrl% && !modifier) ;If the control has text but no modifiers held,
  616. GuiControl,,%ctrl% ; allow BackSpace to clear that text.
  617. Else ;Otherwise,
  618. GuiControl,,%ctrl%, % modifier SubStr(A_ThisHotkey,2) ; show the hotkey.
  619. validateHK(ctrl)
  620. return
  621. #If
  622.  
  623. HotkeyCtrlHasFocus() {
  624. GuiControlGet, ctrl, Focus ;ClassNN
  625. If InStr(ctrl,"hotkey") {
  626. GuiControlGet, ctrl, FocusV ;Associated variable
  627. Return, ctrl
  628. }
  629. }
  630.  
  631.  
  632.  
  633. #If WinActive("Orion") or WinActive("Old School RuneScape") or WinActive("OSBot") or WinActive("Runescape") or WinActive("Tribot") or WinActive("SwiftKit")
  634.  
  635.  
  636.  
  637. labels1:
  638.  
  639. return
  640.  
  641. labels2:
  642.  
  643. return
  644.  
  645. labels3:
  646.  
  647. return
  648.  
  649. labels4:
  650.  
  651. return
  652.  
  653. labels5:
  654.  
  655. return
  656.  
  657.  
  658.  
  659. Label1:
  660. Blockinput on
  661. MouseGetPos, XX, YY
  662. gosub binding
  663. gosub %F1downs%
  664. if prot1 {
  665. gosub checkboxes
  666. } else {
  667. send {esc}
  668. }
  669. if arm1 {
  670. gosub armors
  671. }
  672.  
  673. if Un1 {
  674. gosub %Armun%
  675. }
  676.  
  677. gosub MouseArea
  678. Blockinput off
  679. return
  680.  
  681.  
  682. Label2:
  683. Blockinput on
  684. MouseGetPos, XX, YY
  685. gosub binding
  686. gosub %F2downs%
  687. if prot2 {
  688. gosub checkboxes
  689. } else {
  690. send {esc}
  691. }
  692. if arm2 {
  693. gosub armors
  694. }
  695.  
  696. if Un2 {
  697. gosub %Armun%
  698. }
  699.  
  700. gosub MouseArea
  701. Blockinput off
  702. return
  703.  
  704.  
  705.  
  706. Label3:
  707. Blockinput on
  708. MouseGetPos, XX, YY
  709. gosub binding
  710. gosub %F3downs%
  711. if prot3 {
  712. gosub checkboxes
  713. } else {
  714. send {esc}
  715. }
  716. if arm3 {
  717. gosub armors
  718. }
  719.  
  720.  
  721. if Un3 {
  722. gosub %Armun%
  723. }
  724.  
  725. gosub MouseArea
  726. Blockinput off
  727. return
  728.  
  729.  
  730.  
  731. Label4:
  732. Blockinput on
  733. MouseGetPos, XX, YY
  734. gosub binding
  735. gosub %F4downs%
  736. if prot4 {
  737. gosub checkboxes
  738. } else {
  739. send {esc}
  740. }
  741. if arm4 {
  742. gosub armors
  743. }
  744.  
  745.  
  746. if Un4 {
  747. gosub %Armun%
  748. }
  749.  
  750. gosub MouseArea
  751. Blockinput off
  752. return
  753.  
  754.  
  755.  
  756. Label5:
  757. Blockinput on
  758. MouseGetPos, XX, YY
  759. gosub binding
  760. gosub %F5downs%
  761. if prot5 {
  762. gosub checkboxes
  763. } else {
  764. send {esc}
  765. }
  766. if arm5 {
  767. gosub armors
  768. }
  769.  
  770.  
  771. if Un5 {
  772. gosub %Armun%
  773. }
  774.  
  775. gosub MouseArea
  776. Blockinput off
  777. return
  778.  
  779.  
  780. Label6:
  781. Blockinput on
  782. MouseGetPos, XX, YY
  783. gosub binding
  784. gosub %F6downs%
  785. if prot6 {
  786. gosub checkboxes
  787. } else {
  788. send {esc}
  789. }
  790. if arm6 {
  791. gosub armors
  792. }
  793.  
  794.  
  795. if Un6 {
  796. gosub %Armun%
  797. }
  798.  
  799. gosub MouseArea
  800. Blockinput off
  801. return
  802.  
  803.  
  804. Label7:
  805. Blockinput on
  806. MouseGetPos, XX, YY
  807. gosub binding
  808. gosub %F7downs%
  809. if prot7 {
  810. gosub checkboxes
  811. } else {
  812. send {esc}
  813. }
  814. if arm7 {
  815. gosub armors
  816. }
  817.  
  818.  
  819. if Un7 {
  820. gosub %Armun%
  821. }
  822.  
  823. gosub MouseArea
  824. Blockinput off
  825. return
  826.  
  827.  
  828.  
  829.  
  830.  
  831. Quick:
  832. IfWinNotActive Old School RuneScape
  833. {
  834. MouseClick , Left , X10+ Ran(offset), Y10+ Ran(offset)
  835. }
  836. IfWinActive Old School RuneScape
  837. {
  838. MouseClick , Left , Ran(offset)+ XR10, Ran(offset)+ Yr10
  839. }
  840. return
  841.  
  842.  
  843.  
  844. Melee:
  845. send {f5}
  846. Gosub Sleeping
  847. IfWinNotActive Old School RuneScape
  848. {
  849. MouseClick , Left , X1+ Ran(offset), Y1+ Ran(offset)
  850. }
  851. IfWinActive Old School RuneScape
  852. {
  853. MouseClick , Left , Ran(offset)+ XR1, Ran(offset)+ Yr1
  854. }
  855. return
  856.  
  857. Range:
  858. send {f5}
  859. Gosub Sleeping
  860. IfWinNotActive Old School RuneScape
  861. {
  862. MouseClick , Left , X2+ Ran(offset), Y2+ Ran(offset)
  863. }
  864. IfWinActive Old School RuneScape
  865. {
  866. MouseClick , Left , Ran(offset)+ XR2, Ran(offset)+ Yr2
  867. }
  868. return
  869.  
  870.  
  871.  
  872. Mage:
  873. send {f5}
  874. Gosub Sleeping
  875. IfWinNotActive Old School RuneScape
  876. {
  877. MouseClick , Left , X3+ Ran(offset), Y3+ Ran(offset)
  878. }
  879. IfWinActive Old School RuneScape
  880. {
  881. MouseClick , Left , Ran(offset)+ XR3, Ran(offset)+ Yr3
  882. }
  883. return
  884.  
  885.  
  886.  
  887. `::
  888. BlockInput on
  889. if FRunning {
  890. MouseGetPos, XX, YY
  891. IfWinNotActive Old School RuneScape
  892. {
  893. MouseClick , Left , X8+ Ran(offset), Y8+ Ran(offset)
  894. }
  895. IfWinActive Old School RuneScape
  896. {
  897. MouseClick , Left , Ran(offset)+ XR8, Ran(offset)+ Yr8
  898. }
  899. }
  900. gosub MouseArea
  901. BlockInput off
  902. return
  903.  
  904.  
  905.  
  906.  
  907. checkboxes:
  908. send {f5}
  909. if SteelSkins {
  910. IfWinNotActive Old School RuneScape
  911. {
  912. MouseClick , Left , X4+ Ran(offset), Y4+ Ran(offset)
  913. }
  914. IfWinActive Old School RuneScape
  915. {
  916. MouseClick , Left , Ran(offset)+ XR4, Ran(offset)+ Yr4
  917. }
  918.  
  919. }
  920. if ItemProtects {
  921. IfWinNotActive Old School RuneScape
  922. {
  923. MouseClick , Left , X5+ Ran(offset), Y5+ Ran(offset)
  924. }
  925. IfWinActive Old School RuneScape
  926. {
  927. MouseClick , Left , Ran(offset)+ XR5, Ran(offset)+ Yr5
  928. }
  929. }
  930. if MysticMight {
  931. IfWinNotActive Old School RuneScape
  932. {
  933. MouseClick , Left , X6+ Ran(offset), Y6+ Ran(offset)
  934. }
  935. IfWinActive Old School RuneScape
  936. {
  937. MouseClick , Left , Ran(offset)+ XR6, Ran(offset)+ Yr6
  938. }
  939. }
  940. send {esc}
  941. return
  942.  
  943.  
  944.  
  945. One:
  946. send {F4}
  947. gosub sleeping
  948. IfWinNotActive Old School RuneScape
  949. {
  950. MouseClick , Left , X15+ Ran(offset), Y15+ Ran(offset),,2
  951. }
  952. IfWinActive Old School RuneScape
  953. {
  954. MouseClick , Left , XR15 + Ran(offset), YR15 + Ran(offset),, 2
  955. }
  956. send {esc}
  957. return
  958.  
  959.  
  960. Two:
  961. send {F4}
  962. gosub sleeping
  963. IfWinNotActive Old School RuneScape
  964. {
  965. MouseClick , Left , X15+ Ran(offset), Y15+ Ran(offset),,2
  966. MouseClick , Left , X16+ Ran(offset), Y16+ Ran(offset),,2
  967. }
  968. IfWinActive Old School RuneScape
  969. {
  970. MouseClick , Left , XR15 + Ran(offset), YR15 + Ran(offset),, 2
  971. MouseClick , Left , XR16 + Ran(offset), YR16 + Ran(offset),, 2
  972. }
  973. send {esc}
  974. return
  975.  
  976. Three:
  977. send {F4}
  978. gosub sleeping
  979. IfWinNotActive Old School RuneScape
  980. {
  981. MouseClick , Left , X15+ Ran(offset), Y15+ Ran(offset),,2
  982. MouseClick , Left , X16+ Ran(offset), Y16+ Ran(offset),,2
  983. MouseClick , Left , X17+ Ran(offset), Y17+ Ran(offset),,2
  984. }
  985. IfWinActive Old School RuneScape
  986. {
  987. MouseClick , Left , XR15 + Ran(offset), YR15 + Ran(offset),, 2
  988. MouseClick , Left , XR16 + Ran(offset), YR16 + Ran(offset),, 2
  989. MouseClick , Left , XR17 + Ran(offset), YR17 + Ran(offset),, 2
  990. }
  991. send {esc}
  992. return
  993.  
  994. Four:
  995. send {F4}
  996. gosub sleeping
  997. IfWinNotActive Old School RuneScape
  998. {
  999. MouseClick , Left , X15+ Ran(offset), Y15+ Ran(offset),,2
  1000. MouseClick , Left , X16+ Ran(offset), Y16+ Ran(offset),,2
  1001. MouseClick , Left , X17+ Ran(offset), Y17+ Ran(offset),,2
  1002. MouseClick , Left , X18+ Ran(offset), Y18+ Ran(offset),,2
  1003. }
  1004. IfWinActive Old School RuneScape
  1005. {
  1006. MouseClick , Left , XR15 + Ran(offset), YR15 + Ran(offset),, 2
  1007. MouseClick , Left , XR16 + Ran(offset), YR16 + Ran(offset),, 2
  1008. MouseClick , Left , XR17 + Ran(offset), YR17 + Ran(offset),, 2
  1009. MouseClick , Left , XR18 + Ran(offset), YR18 + Ran(offset),, 2
  1010. }
  1011. send {esc}
  1012. return
  1013.  
  1014.  
  1015. Armors:
  1016. if Radio1 {
  1017. IfWinNotActive Old School RuneScape
  1018. {
  1019. MouseClick , Left , X11+ Ran(offset), Y11+ Ran(offset),,2
  1020. }
  1021. IfWinActive Old School RuneScape
  1022. {
  1023. MouseClick , Left , XR11 + Ran(offset), YR11 + Ran(offset),, 2
  1024. }
  1025. }
  1026.  
  1027. if Radio2 {
  1028. IfWinNotActive Old School RuneScape
  1029. {
  1030. MouseClick , Left , X11+ Ran(offset), Y11+ Ran(offset),,2
  1031. gosub sleeping
  1032. MouseClick , Left , X12+ Ran(offset), Y12+ Ran(offset),,2
  1033. }
  1034.  
  1035. IfWinActive Old School RuneScape
  1036. {
  1037. MouseClick , Left , XR11 + Ran(offset), YR11 + Ran(offset),, 2
  1038. gosub sleeping
  1039. MouseClick , Left , XR12+ Ran(offset), YR12+ Ran(offset),,2
  1040. }
  1041. }
  1042.  
  1043.  
  1044. if Radio3 {
  1045. IfWinNotActive Old School RuneScape
  1046. {
  1047. MouseClick , Left , X11+ Ran(offset), Y11+ Ran(offset),,2
  1048. gosub sleeping
  1049. MouseClick , Left , X12+ Ran(offset), Y12+ Ran(offset),,2
  1050. gosub sleeping
  1051. MouseClick , Left , X13+ Ran(offset), Y13+ Ran(offset),,2
  1052. }
  1053.  
  1054. IfWinActive Old School RuneScape
  1055. {
  1056. MouseClick , Left , XR11 + Ran(offset), YR11 + Ran(offset),, 2
  1057. gosub sleeping
  1058. MouseClick , Left , XR12+ Ran(offset), YR12+ Ran(offset),,2
  1059. gosub sleeping
  1060. MouseClick , Left , XR13+ Ran(offset), YR13+ Ran(offset),,2
  1061. }
  1062. }
  1063.  
  1064.  
  1065. if Radio4 {
  1066. IfWinNotActive Old School RuneScape
  1067. {
  1068. MouseClick , Left , X11+ Ran(offset), Y11+ Ran(offset),,2
  1069. gosub sleeping
  1070. MouseClick , Left , X12+ Ran(offset), Y12+ Ran(offset),,2
  1071. gosub sleeping
  1072. MouseClick , Left , X13+ Ran(offset), Y13+ Ran(offset),,2
  1073. gosub sleeping
  1074. MouseClick , Left , X14+ Ran(offset), Y14+ Ran(offset),,2
  1075. }
  1076.  
  1077. IfWinActive Old School RuneScape
  1078. {
  1079. MouseClick , Left , XR11 + Ran(offset), YR11 + Ran(offset),, 2
  1080. gosub sleeping
  1081. MouseClick , Left , XR12+ Ran(offset), YR12+ Ran(offset),,2
  1082. gosub sleeping
  1083. MouseClick , Left , XR13+ Ran(offset), YR13+ Ran(offset),,2
  1084. gosub sleeping
  1085. MouseClick , Left , XR14+ Ran(offset), YR14+ Ran(offset),,2
  1086. }
  1087. }
  1088.  
  1089. return
  1090.  
  1091.  
  1092. ^F12::
  1093. IfWinExist Old School RuneScape
  1094. {
  1095. WinActivate
  1096. ResizeWin(793,571)
  1097. gosub sleeping
  1098. ResizeWin(793,571)
  1099. }
  1100. return
  1101.  
  1102.  
  1103.  
  1104. Mousearea:
  1105. if Inv {
  1106. IfWinNotActive Old School RuneScape
  1107. {
  1108. MouseMove, X7+ Ran(offset), Y7+ Ran(offset), 0
  1109. }
  1110. IfWinActive Old School RuneScape
  1111. {
  1112. MouseMove, Ran(offset)+ XR7, Ran(offset)+ Yr7, 0
  1113. }
  1114. }
  1115.  
  1116. if Origin {
  1117. IfWinNotActive Old School RuneScape
  1118. {
  1119. MouseMove, XX+ Ran(offset), YY+ Ran(offset), 0
  1120. }
  1121. IfWinActive Old School RuneScape
  1122. {
  1123. MouseMove, xx+ Ran(offset), yy+ Ran(offset), 0
  1124. }
  1125. }
  1126.  
  1127. return
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133. Binding:
  1134. if Fbinds {
  1135. IfWinNotActive Old School RuneScape
  1136. {
  1137. MouseClick , Left , X9+ Ran(offset), Y9+ Ran(offset),,0
  1138. }
  1139. IfWinActive Old School RuneScape
  1140. {
  1141. MouseClick , Left , Ran(offset)+ XR9, Ran(offset)+ Yr9,,0
  1142. }
  1143. }
  1144. return
  1145.  
  1146. none:
  1147. sleep 50
  1148. return
  1149.  
  1150.  
  1151.  
  1152. Sleeping:
  1153. if Fsleep {
  1154. Random, Rand, Sleep1, Sleep2
  1155. sleep %rand%
  1156. }
  1157. return
  1158.  
  1159.  
  1160.  
  1161. Ran(Num)
  1162. {
  1163. Random, r, -1*Num, Num
  1164. Return r
  1165. }
  1166.  
  1167.  
  1168. ResizeWin(Width = 0,Height = 0)
  1169. {
  1170. WinGetPos,X,Y,W,H,A
  1171. If %Width% = 0
  1172. Width := W
  1173.  
  1174. If %Height% = 0
  1175. Height := H
  1176.  
  1177. WinMove,A,,%X%,%Y%,%Width%,%Height%
  1178. }
  1179.  
  1180. /*
  1181. INI_Init(inifile) ;prepares the global variables to be populated
  1182. INI_Load(inifile) ;Reads all the settings into the global variables from the file
  1183. INI_Save(inifile) ;Saves all the settings from the global variables into the file
  1184.  
  1185. INI_ReadAll(inifile) ;Synonym for INI_Load
  1186. INI_WriteAll(inifile) ;Synonym for INI_Save
  1187.  
  1188. */
  1189. INI_Init(inifile = "inifile.ini"){
  1190. global
  1191. local key
  1192. inisections:=0
  1193.  
  1194. loop,read,%inifile%
  1195. {
  1196. if regexmatch(A_Loopreadline,"\[(\w+)]")
  1197. {
  1198. inisections+= 1
  1199. section%inisections%:=regexreplace(A_loopreadline,"(\[)(\w+)(])","$2")
  1200. section%inisections%_keys:=0
  1201. }
  1202. else if regexmatch(A_LoopReadLine,"(\w+)=(\w+)")
  1203. {
  1204. section%inisections%_keys+= 1
  1205. key:=section%inisections%_keys
  1206. section%inisections%_key%key%:=regexreplace(A_LoopReadLine,"(\w+)=(.*)","$1")
  1207. }
  1208. }
  1209. }
  1210.  
  1211. INI_readAll(inifile="inifile.ini"){
  1212. INI_load(inifile)
  1213. }
  1214.  
  1215. INI_load(inifile="inifile.ini"){
  1216. global
  1217. local sec,var
  1218. loop,%inisections%
  1219. {
  1220. sec:=A_index
  1221. loop,% section%a_index%_keys
  1222. {
  1223. var:=section%sec% "_" section%sec%_key%A_index%
  1224. iniread,%var%,%inifile%,% section%sec%,% section%sec%_key%A_index%
  1225. }
  1226. }
  1227. }
  1228.  
  1229. INI_writeAll(inifile="inifile.ini"){
  1230. INI_Save(inifile)
  1231. }
  1232.  
  1233. INI_Save(inifile="inifile.ini"){
  1234. global
  1235. local sec,var
  1236. loop,%inisections%
  1237. {
  1238. sec:=A_index
  1239. loop,% section%a_index%_keys
  1240. {
  1241. var:=section%sec% "_" section%sec%_key%A_index%,var:=%var%
  1242. iniwrite,%var%,%inifile%,% section%sec%,% section%sec%_key%A_index%
  1243. }
  1244. }
  1245. }
Advertisement
Add Comment
Please, Sign In to add comment