Página 1 de 5

UI | APZ | Temperature

Publicado: 06 Ene 2014 06:39
por Cixg
He realizado un script sencillo donde tomo la IP Publica de donde se ejecute la aplicación y recojo datos de diferentes servidores para mostrar solamente la temperatura local actual. Los datos son tomados de eltiempo.es | Diseño UI: Cixg (SC ABEL)

Imagen
function FINDANDREPLACE()
	INDEX = String.Find(TEMPERATURA, "Hoy,", 33910, false)
	END = String.Find(TEMPERATURA, "º", INDEX, false) - 2
	TEMPERATURA = String.Left(TEMPERATURA, END)
	TEMPERATURA = String.Right(TEMPERATURA, 3)
	TEMPERATURA = String.Replace(TEMPERATURA, " ", "")
	TEMPERATURA = String.Replace(TEMPERATURA, "	", "")
	TEMPERATURA = String.Replace(TEMPERATURA, ">", "")
	TEMPERATURA = String.Replace(TEMPERATURA, '"', "")
end

function TEMPERATURALOCAL(CONFIG)
	if CONFIG then
		require("CONFIG")
	else
		
		IP_PUBLIC = HTTP.Submit("http://myip.dnsomatic.com", {}, SUBMITWEB_GET, 20, 80)
		--IP_PUBLIC = '0.0.0.0'
		COUNTRY_AND_CITY = HTTP.Submit("http://whatismyipaddress.com/ip/"..IP_PUBLIC, {}, SUBMITWEB_GET, 20, 80)
		PAIS = COUNTRY_AND_CITY:match("Country%:</th><td>(.-)%s<")
		CIUDAD = COUNTRY_AND_CITY:match("City%:</th><td>(.-)<")
		if PAIS == nil then
			PAIS = "NO HAY DATOS"
		end
		if CIUDAD == nil then
			CIUDAD = "NO HAY DATOS"
		end
		TABLE = {"PAIS = ".."'"..PAIS.."'", "CIUDAD = ".."'"..CIUDAD.."'", "IP_PUBLIC = ".."'"..IP_PUBLIC.."'",
		"----"}
		TextFile.WriteFromTable(_SourceFolder.."\\CONFIG.lua", TABLE, false);
	end

	PAISu = String.Replace(PAIS, " ", "-", false)
	CIUDADu = String.Replace(CIUDAD, " ", "-", false)	
	
	TEMPERATURA = HTTP.Submit("http://www.eltiempo.es/"..CIUDADu..".html", {}, SUBMITWEB_GET, 20, 80)
	if  TEMPERATURA ~= "" then
		FINDANDREPLACE()
		Paragraph.SetText("TEMPERATURA", TEMPERATURA)
		else
			TEMPERATURA = HTTP.Submit("http://www.eltiempo.es/"..PAISu.."/"..CIUDADu..".html", {}, SUBMITWEB_GET, 20, 80)
			if  TEMPERATURA ~= "" then
				FINDANDREPLACE()
				Paragraph.SetText("TEMPERATURA", TEMPERATURA)
			else
			File.Run("notepad.exe", _SourceFolder.."\\CONFIG.lua", _TempFolder, SW_SHOWNORMAL, true);
			Application.ExitScript()
		end
	end
	TEMPERATURA = String.ToNumber(TEMPERATURA)

		TABLE = {"PAIS = ".."'"..PAIS.."'", "CIUDAD = ".."'"..CIUDAD.."'", "IP_PUBLIC = ".."'"..IP_PUBLIC.."'",
		"----"}
		TextFile.WriteFromTable(_SourceFolder.."\\CONFIG.lua", TABLE, false);
		
		if TEMPERATURA >= 50 then COLORPAGE('083AB1') Application.ExitScript() end if TEMPERATURA >= 40 then
		COLORPAGE('0477C3') Application.ExitScript() end if TEMPERATURA >= 30 then COLORPAGE('01ABD5')
		Application.ExitScript() end if TEMPERATURA >= 20 then COLORPAGE('25CFAC') Application.ExitScript()
		end if TEMPERATURA >= 10 then COLORPAGE('8AD375') Application.ExitScript() end if TEMPERATURA >= 0
		then COLORPAGE('E6D531') Application.ExitScript() end if TEMPERATURA >= -10 then COLORPAGE('E58C38')
		Application.ExitScript() end if TEMPERATURA >= -20 then COLORPAGE('CA503E') Application.ExitScript()
		end if TEMPERATURA >= -30 then COLORPAGE('8C3044') end
end
Virus Total | APZ [MEGA]

HIDE: ON
Hidebb Message Hidden Description

Re: UI | APZ | TEMPERATURE

Publicado: 06 Ene 2014 10:36
por Cirseven
Muchas gracias.

Publicado: 06 Ene 2014 10:36
por rafaxplayer
Hombre esta bien , voy a mirar si mañana me puedo ir a la playa un retico XD.

En serio... buen trabajo, lo subo a ams files.

Publicado: 06 Ene 2014 12:46
por Thedary
Buen trabajo +10

Publicado: 06 Ene 2014 22:09
por mecivic
Thank you

Publicado: 17 Ene 2014 14:06
por amsplug
not bad!

Publicado: 18 Ene 2014 09:27
por tam
Thank you

Publicado: 22 Ene 2014 10:58
por tairorojo
muy interesante

Publicado: 08 Abr 2014 17:44
por FRAPIDS
Gracias.

Publicado: 02 May 2014 17:52
por allanjoel
se ve muy bueno

Publicado: 19 May 2014 01:14
por abood1987
Greetings

Re: UI | APZ | Temperature

Publicado: 28 May 2014 14:07
por franziscovick
Muy interesante!

Publicado: 28 May 2014 19:58
por Dow Sher
Me gusta, voy a verlo

Publicado: 21 Jun 2014 13:39
por dangngocnguyenit
thanks

Publicado: 18 Jul 2014 10:53
por mmbi18
thank you

..................

Publicado: 18 Jul 2014 23:47
por filox
Gracias

Publicado: 12 Ago 2014 04:26
por pepelepev
Gracias!

Publicado: 23 Ago 2014 20:16
por comprotodo201480
felicidade buen trabajo mano

Publicado: 19 Sep 2014 14:59
por Haitham.2012
gracias

Re: UI | APZ | Temperature

Publicado: 06 Oct 2014 00:50
por jomedel
gracias men