Return to Snippet

Revision: 29001
at July 19, 2010 08:06 by roflrazzi


Updated Code
; Show network connections between your machine and others.

isRunning(processName) {
	Process, Exist, processName
	tmp := ErrorLevel
	if tmp > 0:
		return tmp
	else
		return 1
}

getConnections() {
	status :=
	Run %comspec% /c ""C:\Windows\System32\netstat.exe" "-o"  > "netstatus.txt""
	FileRead, status, netstatus.txt
	FileDelete, netstatus.txt
	Return, status
}

translateOutputToGlobals(connectionString) {
	Global
	StringTrimLeft, formatted, connectionString, 100
	ArrayCount = 0
	Loop, Parse, formatted, `n, `r
	{
		if StrLen(A_LoopField) > 20
		{
		ArrayCount += 1
		Array%ArrayCount% := A_LoopField
		}
	}
}


Gui, Add, Text,, % "Skype is running (X = pid of skype, 1 = no): " isRunning("skype.exe")
Gui, Add, ListView, r20 w700, INFO
translateOutputToGlobals(getConnections())
Loop %ArrayCount%
{
	el := Array%A_Index%
	LV_Add("", el)
}
Gui, Show

Revision: 29000
at July 19, 2010 05:49 by roflrazzi


Initial Code
; Show network connections between your machine and others.

isRunning(processName) {
	Process, Exist, processName
	tmp := ErrorLevel
	if tmp > 0:
		return 0
	else
		return 1
}

getConnections() {
	status :=
	Run %comspec% /c ""C:\Windows\System32\netstat.exe" "-o"  > "netstatus.txt""
	FileRead, status, netstatus.txt
	FileDelete, netstatus.txt
	Return, status
}

translateOutputToGlobals(connectionString) {
	Global
	StringTrimLeft, formatted, connectionString, 100
	ArrayCount = 0
	Loop, Parse, formatted, `n, `r
	{
		if StrLen(A_LoopField) > 20
		{
		ArrayCount += 1
		Array%ArrayCount% := A_LoopField
		}
	}
}


Gui, Add, Text,, % "Skype is running (0 = yes, 1 = no): " isRunning("skype.exe")
Gui, Add, ListView, r20 w700, INFO
translateOutputToGlobals(getConnections())
Loop %ArrayCount%
{
	el := Array%A_Index%
	LV_Add("", el)
}
Gui, Show

Initial URL

                                

Initial Description

                                

Initial Title
Is skype connected to some IP\'s?

Initial Tags

                                

Initial Language
Pseudocode