Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance force
- #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%
- ; 29/08/2015 1.0.0 by Baoulettes aka Joffrey Panisset
- ; 10/09/2015 1.0.1 by Baoulettes aka Joffrey Panisset
- ; 25/11/2015 1.0.2 by Baoulettes aka Joffrey Panisset
- ; 25/12/2015 1.0.3 by Baoulettes aka Joffrey Panisset
- ; 18/01/2016 1.0.4 by Baoulettes aka Joffrey Panisset
- ; Joffrey.panisset@hotmail.com
- ; COM.ahk Standard Library
- ; by Sean
- ; http://www.autohotkey.com/forum/topic22923.html
- ; NBAHomePass & mac adress list by Nba_Yoh
- ; Logo & UI by Baoulettes
- ; Unauthorized copy or use of this source is forbidden.
- ; List of authorized persons :
- ; Nba_Yoh because I use his soft (need his approve that why compiled version isn't provided.)
- ; Myself : Baoulettes / Joffrey Panisset.
- ; This code is used for learned process Only.
- ; In any case it is intended to make ANY profit on it !
- #include %A_ScriptDir%/Lib/COM.ahk
- Process, Close, NbaHomePass.exe ; To prevent ANY conflict later.
- ;Creating Ressources Directory :
- fileCreateDir, %A_ScriptDir%\ressources\
- ;Installing required files :
- FileInstall, D:\Softwares\AutoHotKey\Software\HomePassMii\Ressources\Logo.png, %A_ScriptDir%\ressources\Logo.png
- FileInstall, D:\Softwares\AutoHotKey\Software\HomePassMii\Ressources\UnCons.png, %A_ScriptDir%\ressources\UnCons.png
- ;Variable Set:
- SoftwareName = HomePassMii
- SoftwareVersion = 1.0.4
- winh = 340
- winw = 900
- consoleh = %winh%:+10
- consolew = 600
- emptysize = 0
- Gui, 1:Add, Picture, x-1 y0 w296 h60 BackGroundTrans, %A_ScriptDir%\ressources\Logo.png
- Gui, 1:Add, Picture, x300 y0 w%consolew% h%consoleh% vPicPHC, %A_ScriptDir%\ressources\UnCons.png
- Gui, 1:Add, Text, x13 y69 w270 h20 +Center, How to use :
- Gui, 1:Add, Text, x13 y89 w270 h20 +Center, 1: Launch the application with administrator rights
- Gui, 1:Add, Text, x13 y109 w270 h20 +Center, 2: Change if you want MAC Address to be shuffled or not
- Gui, 1:Add, Text, x13 y129 w270 h20 +Center, 3: Set time for the connection and delay (In Secondes !)
- Gui, 1:Add, Text, x13 y149 w270 h20 +Center, 4: Press Start to launch the process !
- Gui, 1:Add, GroupBox, x0 y59 w300 h120 , How to use
- Gui, 1:Add, Text, x23 y199 w130 h20 +Right, Shuffled MAC list :
- Gui, 1:Add, DropDownList, x173 y199 w100 h20 r2 vShuffled, True||False
- Gui, 1:Add, Text, x23 y229 w130 h20 +Right, * Reconnection Delay :
- Gui, 1:Add, DropDownList, x173 y229 w100 h20 r11 vReconnectionDelay, 5||10|15|20|30|35|40|45|50|55|60
- Gui, 1:Add, Text, x23 y259 w130 h20 +Right, * Connection Duration :
- Gui, 1:Add, DropDownList, x173 y259 w100 h20 r21 vConnectionDuration, 100|200||300|400|500|600|700|800|900|1000|1500|2000|3000|4000|5000|6000|7000|8000|9000
- Gui, 1:Add, Text, x23 y289 w250 h20 +Center, * Time in secondes !
- Gui, 1:Add, GroupBox, x0 y179 w300 h127 , Parameters
- Gui, 1:Add, Button, x3 y308 w290 h30 gStart, Start
- Gui, 1:Show, h%winh% w%winw%, %SoftwareName% - %SoftwareVersion%
- Return
- Start:
- Process, Close, NbaHomePass.exe ; In case someone click Start Again.
- Process, Close, %pid% ; In case someone click Start Again.
- GuiControl, Move, PicPHC, x300 y0 w%emptysize% h%emptysize%
- Gui, Submit, nohide
- StringLower Shuffled, Shuffled
- FileDelete, %A_ScriptDir%\ressources\Start.bat
- FileAppend,
- (
- %A_ScriptDir%\ressources\NbaHomePass.exe %A_ScriptDir%\ressources\macs.txt %Shuffled% %ConnectionDuration% %ReconnectionDelay%
- ), %A_ScriptDir%\ressources\Start.bat
- Run, %A_ScriptDir%\ressources\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", 300, "int", 0, "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
- }
- NET_Connect(bEnable = False, sConnection = "Local Area Connection")
- {
- ;COM_Init()
- COM_CoInitialize()
- psh := COM_CreateObject("Shell.Application")
- ;pns := COM_Invoke(psh, "Namespace", 3, CSIDL_Connections:=0x0031)
- pns := COM_Invoke(psh, "Namespace",, CSIDL_Connections:=0x0031)
- pitems := COM_Invoke(pns, "Items")
- Loop, % COM_Invoke(pitems, "Count")
- {
- ; pid := COM_Invoke(pitems, "Item", 3, A_Index-1)
- pid := COM_Invoke(pitems, "Item",, A_Index-1)
- If (COM_Invoke(pid, "Name") = sConnection)
- {
- bRes := True
- Break
- }
- COM_Release(pid)
- }
- If !bRes
- ExitApp
- pverbs := COM_Invoke(pid, "Verbs")
- ; pvb := COM_Invoke(pverbs, "Item", 3, nVB:=0)
- pvb := COM_Invoke(pverbs, "Item",, nVB:=0)
- If pvb
- {
- sVerbName := COM_Invoke(pvb, "Name")
- If (bEnable && InStr(sVerbName, "&a")) || (!bEnable && InStr(sVerbName, "&b")) ; &a and &b can be Language dependent.
- COM_Invoke(pvb, "DoIt")
- WinWait, %sConnection% ahk_class #32770,, 1
- WinWaitClose
- COM_Release(pvb)
- }
- COM_Release(pverbs)
- COM_Release(pid)
- COM_Release(pitems)
- COM_Release(pns)
- COM_Release(psh)
- COM_CoUninitialize()
- }
- GuiEsape:
- 1:GuiEsape:
- GuiClose:
- 1:GuiClose:
- Exiting:
- 1:Exiting:
- OnExit
- Process, Close, NbaHomePass.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
Advertisement