Advertisement
Doug4347

App Laucher

Aug 23rd, 2015
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Menu, Tray, NoStandard
  2. Menu, Standard, Standard
  3. Menu, Tray, Add, Add an App, AddNewApp
  4. Menu, Tray, Add, Standard Stuff, :Standard
  5. SetTimer, GTAExistLoop, On
  6. Return
  7.  
  8. GTAExistLoop:
  9. Process, Wait, gta_sa.exe
  10. Suspend, On
  11. Process, WaitClose, gta_sa.exe
  12. Suspend, Off
  13. Return
  14.  
  15. AddNewApp:
  16. Gui, Destroy
  17. Gui, Add, Button, w200 gAddGame, Game
  18. Gui, Add, Button, w200 gAddSAMPServer, SAMP Server
  19. Gui, Add, Button, w200 gAddMCServer, MC Server
  20. Gui, Add, Button, w200 gAddScript, AHK Script
  21. Gui, Add, Button, w200 gAddApp, App
  22. Gui, Show
  23. Return
  24.  
  25. AddGame:
  26. InputBox, GName,, Please enter the name of this game.
  27. If ErrorLevel
  28.  Return
  29. FileSelectFile, SelectedFile, 3, %A_Desktop%, Please select a new game to add to the launcher.
  30. If ErrorLevel
  31.  Return
  32. SplitPath, SelectedFile, GEXE, GPath
  33. IniRead, Num, Apps.ini, Numbers, GNum, 0
  34. Num+=1
  35. IniWrite, %Num%, Apps.ini, Numbers, GNum
  36. InIWrite, %GName%, Apps.ini, GNames, %Num%
  37. InIWrite, %GPath%, Apps.ini, GPaths, %Num%
  38. InIWrite, %GEXE%, Apps.ini, GEXE, %Num%
  39. MsgBox, 64, Success!, Done!`n`nName:`n%GName%`n`nPath:`n%GPath%`n`nExecutable:`n%GEXE%
  40. Return
  41.  
  42. AddSAMPServer:
  43. InputBox, SAMPName,, Please enter the name of this server.
  44. If ErrorLevel
  45.  Return
  46. FileSelectFile, SelectedFile, 3, %A_Desktop%, Please select a new server to add to the launcher.
  47. If ErrorLevel
  48.  Return
  49. SplitPath, SelectedFile, SAMPEXE, SAMPPath
  50. IniRead, Num, Apps.ini, Numbers, SAMPNum, 0
  51. Num+=1
  52. IniWrite, %Num%, Apps.ini, Numbers, SAMPNum
  53. InIWrite, %SAMPName%, Apps.ini, SAMPNames, %Num%
  54. InIWrite, %SAMPPath%, Apps.ini, SAMPPaths, %Num%
  55. InIWrite, %SAMPEXE%, Apps.ini, SAMPEXE, %Num%
  56. MsgBox, 64, Success!, Done!`n`nName:`n%SAMPName%`n`nPath:`n%SAMPPath%`n`nExecutable:`n%SAMPEXE%
  57. Return
  58.  
  59. AddMCServer:
  60. InputBox, MCName,, Please enter the name of this server.
  61. If ErrorLevel
  62.  Return
  63. FileSelectFile, SelectedFile, 3, %A_Desktop%, Please select a new server to add to the launcher.
  64. If ErrorLevel
  65.  Return
  66. SplitPath, SelectedFile, MCEXE, MCPath
  67. IniRead, Num, Apps.ini, Numbers, MCNum, 0
  68. Num+=1
  69. IniWrite, %Num%, Apps.ini, Numbers, MCNum
  70. InIWrite, %MCName%, Apps.ini, MCNames, %Num%
  71. InIWrite, %MCPath%, Apps.ini, MCPaths, %Num%
  72. InIWrite, %MCEXE%, Apps.ini, MCEXE, %Num%
  73. MsgBox, 64, Success!, Done!`n`nName:`n%MCName%`n`nPath:`n%MCPath%`n`nExecutable:`n%MCEXE%
  74.  
  75. Return
  76.  
  77. AddScript:
  78. InputBox, ScriptName,, Please enter the name of this script.
  79. If ErrorLevel
  80.  Return
  81. FileSelectFile, SelectedFile, 3, %A_Desktop%, Please select a new script to add to the launcher.
  82. If ErrorLevel
  83.  Return
  84. SplitPath, SelectedFile, ScriptEXE, ScriptPath
  85. IniRead, Num, Apps.ini, Numbers, ScriptNum, 0
  86. Num+=1
  87. IniWrite, %Num%, Apps.ini, Numbers, ScriptNum
  88. InIWrite, %ScriptName%, Apps.ini, ScriptNames, %Num%
  89. InIWrite, %ScriptPath%, Apps.ini, ScriptPaths, %Num%
  90. InIWrite, %ScriptEXE%, Apps.ini, ScriptEXE, %Num%
  91. MsgBox, 64, Success!, Done!`n`nName:`n%ScriptName%`n`nPath:`n%ScriptPath%`n`nExecutable:`n%ScriptEXE%
  92.  
  93. Return
  94.  
  95. AddApp:
  96. InputBox, AppName,, Please enter the name of this app.
  97. If ErrorLevel
  98.  Return
  99. FileSelectFile, SelectedFile, 3, %A_Desktop%, Please select a new app to add to the launcher.
  100. If ErrorLevel
  101.  Return
  102. SplitPath, SelectedFile, AppEXE, AppPath
  103. IniRead, Num, Apps.ini, Numbers, AppNum, 0
  104. Num+=1
  105. IniWrite, %Num%, Apps.ini, Numbers, AppNum
  106. InIWrite, %AppName%, Apps.ini, AppNames, %Num%
  107. InIWrite, %AppPath%, Apps.ini, AppPaths, %Num%
  108. InIWrite, %AppEXE%, Apps.ini, AppEXE, %Num%
  109. MsgBox, 64, Success!, Done!`n`nName:`n%AppName%`n`nPath:`n%AppPath%`n`nExecutable:`n%AppEXE%
  110. Return
  111.  
  112. !2:: Suspend
  113. !1::
  114. Gui, Destroy
  115. Gui, Add, Tab2, w825 r20, Games|SAMP Servers|MC Servers|AHK Scripts|Apps
  116. Gui, Tab, Games
  117. Gui, Add, ListView, w800 r20 Grid gGSelect, Game|Path|EXE
  118. IniRead, GNum, Apps.ini, Numbers, GNum, 0
  119. Loop, %GNum%
  120. {
  121. IniRead, GName, Apps.ini, GNames, %A_Index%
  122. IniRead, GPath, Apps.ini, GPaths, %A_Index%
  123. IniRead, GEXE, Apps.ini, GEXE, %A_Index%
  124. LV_Add(, GName, GPath, GEXE)
  125. }
  126. LV_ModifyCol()
  127. Gui, Tab, SAMP Servers
  128. Gui, Add, ListView, w800 r20 Grid gSAMPSelect, Server|Path|EXE
  129. IniRead, SAMPNum, Apps.ini, Numbers, SAMPNum, 0
  130. Loop, %SAMPNum%
  131. {
  132. IniRead, SAMPName, Apps.ini, SAMPNames, %A_Index%
  133. IniRead, SAMPPath, Apps.ini, SAMPPaths, %A_Index%
  134. IniRead, SAMPEXE, Apps.ini, SAMPEXE, %A_Index%
  135. LV_Add(, SAMPName, SAMPPath, SAMPEXE)
  136. }
  137. LV_ModifyCol()
  138. Gui, Tab, MC Servers
  139. Gui, Add, ListView, w800 r20 Grid gMCSelect, Server|Path|EXE
  140. IniRead, MCNum, Apps.ini, Numbers, MCNum, 0
  141. Loop, %MCNum%
  142. {
  143. IniRead, MCName, Apps.ini, MCNames, %A_Index%
  144. IniRead, MCPath, Apps.ini, MCPaths, %A_Index%
  145. IniRead, MCEXE, Apps.ini, MCEXE, %A_Index%
  146. LV_Add(, MCName, MCPath, MCEXE)
  147. }
  148. LV_ModifyCol()
  149. Gui, Tab, AHK Scripts
  150. Gui, Add, ListView, w800 r20 Grid gScriptSelect, Script|Path|EXE
  151. IniRead, ScriptNum, Apps.ini, Numbers, ScriptNum, 0
  152. Loop, %ScriptNum%
  153. {
  154. IniRead, ScriptName, Apps.ini, ScriptNames, %A_Index%
  155. IniRead, ScriptPath, Apps.ini, ScriptPaths, %A_Index%
  156. IniRead, ScriptEXE, Apps.ini, ScriptEXE, %A_Index%
  157. LV_Add(, ScriptName, ScriptPath, ScriptEXE)
  158. }
  159. LV_ModifyCol()
  160. Gui, Tab, Apps
  161. Gui, Add, ListView, w800 r20 Grid gAppSelect, App|Path|EXE
  162. IniRead, AppNum, Apps.ini, Numbers, AppNum, 0
  163. Loop, %AppNum%
  164. {
  165. IniRead, AppName, Apps.ini, AppNames, %A_Index%
  166. IniRead, AppPath, Apps.ini, AppPaths, %A_Index%
  167. IniRead, AppEXE, Apps.ini, AppEXE, %A_Index%
  168. LV_Add(, AppName, AppPath, AppEXE)
  169. }
  170. LV_ModifyCol()
  171. Gui, Show
  172. Return
  173.  
  174. GSelect:
  175. If A_EventInfo is not Number
  176. {
  177. Return
  178. }
  179. IniRead, Path, Apps.ini, GPaths, %A_EventInfo%
  180. IniRead, EXE, Apps.ini, GEXE, %A_EventInfo%
  181. MyDir:=A_WorkingDir
  182. SetWorkingDir, %Path%
  183. Run, %EXE%
  184. SetWorkingDir, %MyDir%
  185. Return
  186.  
  187. SAMPSelect:
  188. If A_EventInfo is not Number
  189. {
  190. Return
  191. }
  192. IniRead, Path, Apps.ini, SAMPPaths, %A_EventInfo%
  193. IniRead, EXE, Apps.ini, SAMPEXE, %A_EventInfo%
  194. MyDir:=A_WorkingDir
  195. SetWorkingDir, %Path%
  196. Run, %EXE%
  197. SetWorkingDir, %MyDir%
  198. Return
  199.  
  200. MCSelect:
  201. If A_EventInfo is not Number
  202. {
  203. Return
  204. }
  205. InIRead, Path, Apps.ini, MCPaths, %A_EventInfo%
  206. InIRead, EXE, Apps.ini, MCEXE, %A_EventInfo%
  207. MyDir:=A_WorkingDir
  208. SetWorkingDir, %Path%
  209. Run, %EXE%
  210. SetWorkingDir, %MyDir%
  211. Return
  212.  
  213. ScriptSelect:
  214. If A_EventInfo is not Number
  215. {
  216. Return
  217. }
  218. InIRead, Path, Apps.ini, ScriptPaths, %A_EventInfo%
  219. InIRead, EXE, Apps.ini, ScriptEXE, %A_EventInfo%
  220. MyDir:=A_WorkingDir
  221. SetWorkingDir, %Path%
  222. Run, %EXE%
  223. SetWorkingDir, %MyDir%
  224. Return
  225.  
  226.  
  227. AppSelect:
  228. If A_EventInfo is not Number
  229. {
  230. Return
  231. }
  232. InIRead, Path, Apps.ini, AppPaths, %A_EventInfo%
  233. InIRead, EXE, Apps.ini, AppEXE, %A_EventInfo%
  234. MyDir:=A_WorkingDir
  235. SetWorkingDir, %Path%
  236. Run, %EXE%
  237. SetWorkingDir, %MyDir%
  238. Return
  239.  
  240. GuiClose:
  241. Gui, Destroy
  242. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement