PDA

View Full Version : Send Web Page to NetRenote



dsmes
October 2nd, 2008, 03:26 PM
In Lua code associated with a CCF, I do the following to send a web page to a NR browser frame.
Function GetSomethingFromWeb()
local Page = socket.http.request(url_of_page)
-- scrap the page
...
Page = htm_start..Temp..Page.."</body></html>"
NetRemote.ExecuteAction(-2,1,33,'HourlyForecast_Page,'..Page)
end;
where "HourlyForecast_Page" is the web browser frame in NR.

How do I do this from a Girder Lua script? Specifically, how do I push the web page from Girder to NR and then get the browser frame in NR to update itself?

harleydude
October 2nd, 2008, 04:28 PM
You might try this


function OnHourlyForecastChange()
local page = NetRemote.GetVariable('SomethingFromWeb.HourlyFore cast')
NetRemote.ExecuteAction(-2,1,33,'HourlyForecast_Page,'..page)
end

NetRemote.RegisterVariableWatch('SomethingFromWeb. HourlyForecast',OnHourlyForecastChange)


On the Girder side have an Script Action do all the scraping and use NetRemote.SetVariable('SomethingFromWeb.HourlyFore cast', html) to set the NR variable.

dsmes
October 3rd, 2008, 05:09 PM
Thanks Rick, I can see how your example would work if I'm trying to populate a NR variable in the CCF, but what if I'm trying to populate/update a NR Web Browser window?

You see, for this particular webpage, it's easier to grab and reformat the whole web page rather then to parse the entire page into a bunch of NR variables. Hence my need to push a web page from Girder and have the NR web page frame update itself.

harleydude
October 3rd, 2008, 08:52 PM
Sorry, I have not used the NR web browser much, but I assumed your Page variable contained html data.

dsmes
October 4th, 2008, 07:41 AM
Quite all right, Rick. I appreciate your response.

I should clarify that it is an embedded web browser BUTTON in NR I'm trying to update, not a frame.