; ========================================== ; CONFIG OPTIONS ; ========================================== cPROXIES = proxies.ini ; Path to the ini file where proxies are stored. (Must have write access) ; ----------------------------------------------- ; FUNCTIONS ; ----------------------------------------------- editProxy(name = 0) { global cPROXIES ; This function edits a proxy (or adds a new proxy if 'name' == 0) ; Populate form fields with the properties from proxy 'name'. if (name == 0) { ; No name given, we're creating a new proxy vHost = Host vPort = 22 vUser = Username vLPort = 1667 vWinTitle = Create New Proxy } else { ; There was a name given, let's get the proper values from the ini file. ; TODO: Need to check if each ini value read is set to ERROR MsgBox %name% IniRead, vHost, %cPROXIES%, %name%, host IniRead, vPort, %cPROXIES%, %name%, port IniRead, vUser, %cPROXIES%, %name%, user IniRead, vLPort, %cPROXIES%, %name%, lport vWinTitle = Edit Proxy %name% } ; Display Edit/New window. Gui, 2:Add, Edit, x6 y10 w220 h20 -VScroll, %vHost% Gui, 2:Add, Edit, x236 y10 w130 h20 , %vPort% Gui, 2:Add, Edit, x6 y40 w220 h20 , %vUser% Gui, 2:Add, Button, x236 y70 w130 h20 , Select PPK Gui, 2:Add, Edit, x236 y40 w130 h20 , %vLPort% Gui, 2:Add, Button, x10 y75 w130 h20, Save Gui, 2:Show, x283 y225 h109 w381, %vWinTitle% } listProxies() { MsgBox Looping ; DBG: Just want to see if it's being called with 2ButtonSave: label global cPROXIES ; grab a list of all proxies in CSV format IniRead, vProxies, %cPROXIES%, listprox, csv ; Loop the values Loop, parse, vProxies, CSV { LV_Add("",A_LoopField) } } ; ----------------------------------------------- ; Launch Main Window ; ----------------------------------------------- Gui, Add, ListView, x6 y10 w460 h460 , ListView Gui, Add, Button, x36 y490 w100 h30 , &New... Gui, Add, Button, x336 y490 w100 h30 , &Delete Gui, Add, Button, x186 y490 w100 h30 , &Edit... Gui, Show, x131 y121 h533 w477, Edit Proxy's ; listProxies() Return ; ----------------------------------------------- ; BUTTON EVENTS ; ----------------------------------------------- ; MAIN WINDOW ButtonNew...: editProxy() Return ButtonEdit...: ; editProxy("testing") Return ButtonDelete: listProxies() Return ; EDIT/NEW WINDOW 2ButtonSave: listProxies() Return ; ----------------------------------------------- ; Clean up GUI on close ; ----------------------------------------------- GuiClose: ExitApp