Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance force ; Used to prevent multi time script launch.
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir%
- Process, Close, Houston.exe ; To prevent ANY conflict later.
- ;Creating Ressources Directory :
- fileCreateDir, %A_ScriptDir%\ressources\
- ;Installing required files :
- FileInstall, C:\Users\Vodoowolfs\Desktop\Ressources\UnCons.png, %A_ScriptDir%\ressources\UnCons.png
- ;Variable Set:
- WinName = Houston
- Version = 1.0.0
- winh = 345
- winw = 315
- consoleh = 230
- consolew = %winw%
- conslotH = 133
- emptysize = 0
- BrowseBTN = Browse
- SendBTN = Send an S.O.S
- IPTXT = Console IP :
- ErrorP2CIA = You must select a valid folder with CIA in !`nAlso do not move the CIA during process.
- CIASELECTED = Click Browse to select a CIA file.
- IniRead, Path2CIA, %A_ScriptDir%\ressources\option.ini, Folder, Path2CIA
- IniRead, InputIP, %A_ScriptDir%\ressources\option.ini, ConsoleIP, InputIP
- if ("%InputIP%" == ERROR){
- InputIP = 192.168.1.1
- }
- Gui, 1:Add, GroupBox, x10 y9 w290 h120 , %WinName% :
- Gui, 1:Add, Text, x22 y33 w165 h30 +Right, %CIASELECTED% :
- Gui, 1:Add, Text, x22 y63 w165 h30 +Right, %IPTXT%
- Gui, 1:Add, Edit, x192 y55 w100 h30 +Number vInputIP, %InputIP%
- Gui, 1:Add, Button, x191 y25 w102 h30 gBrowser, %BrowseBTN%
- Gui, 1:Add, Button, x108 y91 w100 h30 gSendHouston, %SendBTN%
- Gui, 1:Add, Picture, x0 y%conslotH% w%consolew% h%consoleh% vPicPHC, %A_ScriptDir%\ressources\UnCons.png
- Gui, 1:Show, h%winh% w%winw%, %WinName% UI - %Version%
- Return
- Browser:
- FileSelectFolder, Path2CIA, , 3
- if ("%Path2CIA%" == ERROR) {
- msgbox, %ErrorP2CIA%
- goto Browser
- } else if ("%Path2CIA%" == ) {
- msgbox, %ErrorP2CIA%
- goto Browser
- }
- msgbox, %Path2CIA%
- return
- SendHouston:
- gui,submit, nohide
- gui,1:submit, nohide
- ;msgbox, %Path2CIA%
- if ("%Path2CIA%" == Unknow) {
- msgbox, %ErrorP2CIA%
- goto Browser
- } else if ("%Path2CIA%" == Error) {
- msgbox, %ErrorP2CIA%
- goto Browser
- } else if ("%Path2CIA%" == ERROR) {
- msgbox, %ErrorP2CIA%
- goto Browser
- } else if ("%Path2CIA%" == ) {
- msgbox, %ErrorP2CIA%
- goto Browser
- }
- Process, Close, Houston.exe ; In case someone click Start Again.
- Process, Close, %pid% ; In case someone click Start Again.
- GuiControl, Move, PicPHC, x0 y%conslotH% w%emptysize% h%emptysize%
- IniWrite, %Path2CIA%, %A_ScriptDir%\ressources\option.ini, Folder, Path2CIA
- IniWrite, %InputIP%, %A_ScriptDir%\ressources\option.ini, ConsoleIP, InputIP
- FileDelete, %A_ScriptDir%\ressources\Start.bat
- FileAppend,
- (
- @echo off
- ), %A_ScriptDir%\ressources\Start.bat
- Loop Files, %Path2CIA%\*.cia,
- {
- FileAppend,
- (
- echo %WinName% will try to install.
- echo.
- echo %A_LoopFileName%
- echo.
- "%A_ScriptDir%\ressources\Houston.exe" %InputIP% "%A_LoopFileFullPath%"
- echo.
- ), %A_ScriptDir%\ressources\Start.bat
- }
- FileAppend,
- (
- echo %WinName% has finished.
- pause >nul
- exit
- ), %A_ScriptDir%\ressources\Start.bat
- Run, %comspec% /k Start.bat, %A_ScriptDir%\ressources\,, pid
- Gui, +lastfound
- Gui, +hwndghwnd
- Gui_1_ID := WinExist()
- Set_Parent_by_id(Gui_1_ID, 1) ; Window_ID, Gui_Number
- Gui, +LastFound +%WS_CLIPCHILDREN%
- GuiWindow := WinExist()
- DetectHiddenWindows, On
- WinWait, ahk_pid %pid%
- ConsoleWindow := WinExist()
- VarSetCapacity(ConsoleRect, 16)
- DllCall("GetClientRect", "uint", ConsoleWindow, "uint", &ConsoleRect)
- ConsoleWidth := NumGet(ConsoleRect, 8)
- ConsoleHeight:= NumGet(ConsoleRect, 12)
- WS_POPUP := 0x80000000
- WS_CAPTION := 0xC00000
- WS_THICKFRAME := 0x40000
- WS_EX_CLIENTEDGE := 0x200
- WS_CHILD := 0x40000000
- WS_CLIPCHILDREN := 0x2000000
- SWP_NOACTIVATE := 0x10
- SWP_SHOWWINDOW := 0x40
- SWP_NOSENDCHANGING := 0x400
- WinSet, Style, % -(WS_POPUP|WS_CAPTION|WS_THICKFRAME)
- WinSet, Style, +%WS_CHILD%
- WinSet, ExStyle, -%WS_EX_CLIENTEDGE%
- DllCall("SetParent", "uint", ConsoleWindow, "uint", GuiWindow)
- DllCall("SetWindowPos", "uint", ConsoleWindow, "uint", 0, "int", 0, "int", conslotH, "int", consolew, "int", consoleh, "uint", SWP_NOACTIVATE|SWP_SHOWWINDOW|SWP_NOSENDCHANGING)
- return
- 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
- {
- Gui, %Gui_Number%: +LastFound
- Return DllCall("SetParent", "uint", WinExist(), "uint", Window_ID) ; success = handle to previous parent, failure =null
- }
- GuiEsape:
- 1:GuiEsape:
- GuiClose:
- 1:GuiClose:
- Exiting:
- 1:Exiting:
- OnExit
- Process, Close, Houston.exe ; Need better method? but who would run two instance of this?
- Process, Close, %pid% ; May be a bit forceful? No effect if it already closed.
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment