Baoulettes

Houston ui 1.0.0

Jan 19th, 2016
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance force   ; Used to prevent multi time script launch.
  2. #NoEnv                  ; Recommended for performance and compatibility with future AutoHotkey releases.
  3. SendMode Input          ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%
  5.  
  6. Process, Close, Houston.exe ; To prevent ANY conflict later.
  7.  
  8. ;Creating Ressources Directory :
  9. fileCreateDir, %A_ScriptDir%\ressources\
  10.  
  11. ;Installing required files :
  12. FileInstall, C:\Users\Vodoowolfs\Desktop\Ressources\UnCons.png, %A_ScriptDir%\ressources\UnCons.png
  13.  
  14. ;Variable Set:
  15. WinName     =   Houston
  16. Version     =   1.0.0
  17. winh        =   345
  18. winw        =   315
  19. consoleh    =   230
  20. consolew    =   %winw%
  21. conslotH    =   133
  22. emptysize   =   0
  23. BrowseBTN   =   Browse
  24. SendBTN     =   Send an S.O.S
  25. IPTXT       =   Console IP :
  26. ErrorP2CIA  =   You must select a valid folder with CIA in !`nAlso do not move the CIA during process.
  27. CIASELECTED =   Click Browse to select a CIA file.
  28. IniRead, Path2CIA, %A_ScriptDir%\ressources\option.ini, Folder, Path2CIA
  29. IniRead, InputIP, %A_ScriptDir%\ressources\option.ini, ConsoleIP, InputIP
  30.  
  31. if ("%InputIP%" == ERROR){
  32.     InputIP = 192.168.1.1
  33. }
  34.  
  35.  
  36. Gui, 1:Add, GroupBox, x10 y9 w290 h120 , %WinName% :
  37. Gui, 1:Add, Text, x22 y33 w165 h30 +Right, %CIASELECTED% :
  38. Gui, 1:Add, Text, x22 y63 w165 h30 +Right, %IPTXT%
  39. Gui, 1:Add, Edit, x192 y55 w100 h30 +Number vInputIP, %InputIP%
  40. Gui, 1:Add, Button, x191 y25 w102 h30 gBrowser, %BrowseBTN%
  41. Gui, 1:Add, Button, x108 y91 w100 h30 gSendHouston, %SendBTN%
  42. Gui, 1:Add, Picture, x0 y%conslotH% w%consolew% h%consoleh% vPicPHC, %A_ScriptDir%\ressources\UnCons.png
  43. Gui, 1:Show, h%winh% w%winw%, %WinName% UI - %Version%
  44. Return
  45.  
  46. Browser:
  47. FileSelectFolder, Path2CIA, , 3
  48. if ("%Path2CIA%" == ERROR) {
  49.     msgbox, %ErrorP2CIA%
  50.     goto Browser
  51. } else if ("%Path2CIA%" == ) {
  52.     msgbox, %ErrorP2CIA%
  53.     goto Browser
  54. }
  55. msgbox, %Path2CIA%
  56. return
  57.  
  58. SendHouston:
  59. gui,submit, nohide
  60. gui,1:submit, nohide
  61. ;msgbox, %Path2CIA%
  62. if ("%Path2CIA%" == Unknow) {
  63.     msgbox, %ErrorP2CIA%
  64.     goto Browser
  65. } else if ("%Path2CIA%" == Error) {
  66.     msgbox, %ErrorP2CIA%
  67.     goto Browser
  68. } else if ("%Path2CIA%" == ERROR) {
  69.     msgbox, %ErrorP2CIA%
  70.     goto Browser
  71. } else if ("%Path2CIA%" == ) {
  72.     msgbox, %ErrorP2CIA%
  73.     goto Browser
  74. }
  75.  
  76. Process, Close, Houston.exe ; In case someone click Start Again.
  77. Process, Close, %pid% ; In case someone click Start Again.
  78. GuiControl, Move, PicPHC, x0 y%conslotH% w%emptysize% h%emptysize%
  79. IniWrite, %Path2CIA%, %A_ScriptDir%\ressources\option.ini, Folder, Path2CIA
  80. IniWrite, %InputIP%, %A_ScriptDir%\ressources\option.ini, ConsoleIP, InputIP
  81. FileDelete, %A_ScriptDir%\ressources\Start.bat
  82. FileAppend,
  83. (
  84. @echo off
  85. ), %A_ScriptDir%\ressources\Start.bat  
  86.        
  87. Loop Files, %Path2CIA%\*.cia,
  88. {
  89.     FileAppend,
  90.     (  
  91.    
  92. echo %WinName% will try to install.
  93. echo.
  94. echo %A_LoopFileName%
  95. echo.
  96. "%A_ScriptDir%\ressources\Houston.exe" %InputIP% "%A_LoopFileFullPath%"
  97. echo.
  98.     ), %A_ScriptDir%\ressources\Start.bat
  99. }
  100. FileAppend,
  101. (
  102.  
  103. echo %WinName% has finished.
  104. pause >nul
  105. exit
  106. ), %A_ScriptDir%\ressources\Start.bat
  107. Run, %comspec% /k Start.bat, %A_ScriptDir%\ressources\,, pid
  108. Gui, +lastfound
  109. Gui, +hwndghwnd
  110. Gui_1_ID := WinExist()
  111. Set_Parent_by_id(Gui_1_ID, 1) ; Window_ID, Gui_Number
  112. Gui, +LastFound +%WS_CLIPCHILDREN%
  113. GuiWindow := WinExist()
  114. DetectHiddenWindows, On
  115. WinWait, ahk_pid %pid%
  116. ConsoleWindow := WinExist()
  117. VarSetCapacity(ConsoleRect, 16)
  118. DllCall("GetClientRect", "uint", ConsoleWindow, "uint", &ConsoleRect)
  119. ConsoleWidth := NumGet(ConsoleRect, 8)
  120. ConsoleHeight:= NumGet(ConsoleRect, 12)
  121. WS_POPUP := 0x80000000
  122. WS_CAPTION := 0xC00000
  123. WS_THICKFRAME := 0x40000
  124. WS_EX_CLIENTEDGE := 0x200
  125. WS_CHILD := 0x40000000
  126. WS_CLIPCHILDREN := 0x2000000
  127. SWP_NOACTIVATE := 0x10
  128. SWP_SHOWWINDOW := 0x40
  129. SWP_NOSENDCHANGING := 0x400
  130. WinSet, Style, % -(WS_POPUP|WS_CAPTION|WS_THICKFRAME)
  131. WinSet, Style, +%WS_CHILD%
  132. WinSet, ExStyle, -%WS_EX_CLIENTEDGE%
  133. DllCall("SetParent", "uint", ConsoleWindow, "uint", GuiWindow)
  134. DllCall("SetWindowPos", "uint", ConsoleWindow, "uint", 0, "int", 0, "int", conslotH, "int", consolew, "int", consoleh, "uint", SWP_NOACTIVATE|SWP_SHOWWINDOW|SWP_NOSENDCHANGING)
  135. return
  136.  
  137. Set_Parent_by_id(Window_ID, Gui_Number) ; title text is the start of the title of the window, gui number is e.g. 99
  138. {
  139.   Gui, %Gui_Number%: +LastFound
  140.   Return DllCall("SetParent", "uint", WinExist(), "uint", Window_ID) ; success = handle to previous parent, failure =null
  141. }
  142.  
  143. GuiEsape:
  144. 1:GuiEsape:
  145. GuiClose:
  146. 1:GuiClose:
  147. Exiting:
  148. 1:Exiting:
  149. OnExit
  150. Process, Close, Houston.exe ; Need better method? but who would run two instance of this?
  151. Process, Close, %pid% ; May be a bit forceful? No effect if it already closed.
  152. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment