All pastes #944263 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-03-15 23:47 UTC
rendered paste body
; ==========================================
; CONFIG OPTIONS
; ==========================================

cPROXIES = proxies.ini ; Path to the ini file where proxies are stored. (Must have write access)



Gui, Add, ListView, x6 y10 w460 h460 , ListView

; grab a list of all proxies in CSV format
IniRead, vProxies, proxies.ini, listprox, csv
	
; Loop the values
Loop, parse, vProxies, CSV
{
	MsgBox %A_LoopField%
	LV_Add(A_LoopField)
}
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

Return


; -----------------------------------------------
; 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 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:Show, x283 y225 h109 w381, %vWinTitle%
}

; -----------------------------------------------
; BUTTON EVENTS 
; -----------------------------------------------

; --------------------
; New Proxy
; --------------------

ButtonNew...:
editProxy()
Return

ButtonEdit...:
; editProxy("testing")
Return

ButtonDelete:

Return


; -----------------------------------------------
; Clean up GUI on close
; -----------------------------------------------
GuiClose:
ExitApp