| View previous topic :: View next topic |
| Author |
Message |
Phosee Newbie
Joined: 18 Aug 2008 Posts: 4 Location: Kiev, Ukraine
|
Posted: Fri Aug 13, 2010 12:22 am Post subject: How to display the screen image from the Internet? |
|
|
Need your help. It is easy to display picture, witch is on PC:
theScreen.image = "C:\\image\\img.jpg";
but how to display the image from the Internet?
This: theScreen.image = "http:\\site.com\\image\\img.jpg"; does not work.
|
|
| Back to top |
|
 |
joeker Junior Member

Joined: 31 Mar 2007 Posts: 58
|
Posted: Fri Aug 13, 2010 10:41 am Post subject: |
|
|
AFAIK you have to save it locally first.
Should be similiar to:[quote]
var http = new ActiveXObject("Msxml2.XMLHTTP");
http.open("GET", "http://my.url.html", false);
http.send(null);
var source = http.responseText;[/quote]
http://msdn.microsoft.com/en-us/library/7sw4ddf8%28VS.85%29.aspx
|
|
| Back to top |
|
 |
Phosee Newbie
Joined: 18 Aug 2008 Posts: 4 Location: Kiev, Ukraine
|
Posted: Fri Aug 13, 2010 2:14 pm Post subject: |
|
|
I tried this code in this way:
[code:1]
var http = new ActiveXObject("Msxml2.XMLHTTP");
http.open("GET", "http://video.nash.net.ua/?film=17626", true);
http.send(null);
var source = http.responseText;
var fso = new ActiveXObject( "Scripting.FileSystemObject" );
settingsFileStream = fso.CreateTextFile( "D:\\settings.txt", true );
settingsFileStream.Write( source );
settingsFileStream.Close();
[/code:1]
it saves plain htm-code of page (attached)
but when I tried:
[code:1]http.open("GET", "http://video.nash.net.ua/posters/17626.jpg", true);
........
settingsFileStream = fso.CreateTextFile( "D:\\img.jpg", true );
[/code:1] nothing happens :(
| Description: |
|
 Download |
| Filename: |
settings.txt |
| Filesize: |
19.44 KB |
| Downloaded: |
4145 Time(s) |
|
|
| Back to top |
|
 |
joeker Junior Member

Joined: 31 Mar 2007 Posts: 58
|
Posted: Sat Aug 14, 2010 11:22 am Post subject: |
|
|
Here's a very crude but working script..
[quote]
var file = _getImage("http://www.salling.com/forums/images/avatars/gallery/phone%20models/t610_5.jpg");
launchWidget();
function _getImage(query) {
var file = resourcesPath + "\\img.jpg";
var xml = new ActiveXObject("Msxml2.XMLHTTP");
xml.open("GET", query, false);
xml.send(null);
var oStream = new ActiveXObject("ADODB.Stream");
oStream.Type = 1;
oStream.Open();
oStream.Write(xml.responseBody);
oStream.SaveToFile(file);
oStream.Close();
return file;
}
function launchWidget()
{
var widget = CreateKeypadScreen( "mykeypad_" );
widget.title = "ViewImage";
widget.name = "ViewImage";
widget.image = resourcesPath + "\\img.jpg";
theTerminal.Push( widget );
}
function mykeypad_Update( theScreen )
{
try {
//...
} catch( e ) {}
}
[/quote]
|
|
| Back to top |
|
 |
|