 	cmd := "#"+toHexColor(red,green,blue) ; # is the set main color command
 	; MsgBox %cmd%
 	TrayTip, , Blue: %blue%
-	socket.Send(cmd)
-
-	return
-	
+	sendCmd(cmd)
+
+	return
+
+sendCmd(cmd)
+{
+	global connected
+	global socket
+	; MsgBox %connected%
+	if( connected )
+	{
+		socket.Send(cmd)
+		; MsgBox %cmd%
+	}
+	else
+		TrayTip, , Not connected to server!
+}
+
 toHexColor(r, g, b)
 {
 	SetFormat, IntegerFast, hex ; To print values as hexadecimal

		speed := maxColor
	cmd = ?%speed% ;  ? is the set brightness mode command
	TrayTip, , Speed: %speed%
	socket.Send(cmd)
	; MsgBox %cmd%
	return


		speed := 0
	cmd = ?%speed% ;  ? is the set brightness mode command
	TrayTip, , Speed: %speed%
	sendCmd(cmd)
	; MsgBox %cmd%
	return
	
