locked
Network.DownloadFile RRS feed

  • Question

  • Hi,

    I would like to get an image from Bing for example and save it in My Pictures but I'm not quite sure how this is done. Can anyone write me a simple example?

    Thanks,

    Kirk.

    • Edited by Kirkkaf Friday, January 21, 2011 12:47 PM changed search engine
    Friday, January 21, 2011 12:45 PM

Answers

  • You can use the network command to:

    1] download an html page - this is just the html and you need to parse it somehow to get any useful information from it.

    2] download a network file, image, music etc.

    In both cases you need to know the web address, you cannot do searches etc, perhaps one of the extensions can do this (Fremy or Oskariok's Data).

    You can also use the Flickr command to get a random image URL based on a keyword, much as you could googling for an image.

    Once the image is downloaded with Network or Flickr, you can save it to a file:

    image = Flickr.GetRandomPicture("car")
    TextWindow.WriteLine("URL "+image) 'The URL of the image
    imageFile = Network.DownloadFile(image)
    TextWindow.WriteLine("FILE "+imageFile) 'The downloaded file is stored in a temp directory with extension tmp
    File.CopyFile(imageFile, Program.Directory+"\image.jpg") 'assuming the image is a jpg - you could check for this

    • Proposed as answer by AirWaves Saturday, January 22, 2011 3:25 AM
    • Marked as answer by Kirkkaf Saturday, January 22, 2011 2:23 PM
    Friday, January 21, 2011 7:41 PM

All replies

  • You can use the network command to:

    1] download an html page - this is just the html and you need to parse it somehow to get any useful information from it.

    2] download a network file, image, music etc.

    In both cases you need to know the web address, you cannot do searches etc, perhaps one of the extensions can do this (Fremy or Oskariok's Data).

    You can also use the Flickr command to get a random image URL based on a keyword, much as you could googling for an image.

    Once the image is downloaded with Network or Flickr, you can save it to a file:

    image = Flickr.GetRandomPicture("car")
    TextWindow.WriteLine("URL "+image) 'The URL of the image
    imageFile = Network.DownloadFile(image)
    TextWindow.WriteLine("FILE "+imageFile) 'The downloaded file is stored in a temp directory with extension tmp
    File.CopyFile(imageFile, Program.Directory+"\image.jpg") 'assuming the image is a jpg - you could check for this

    • Proposed as answer by AirWaves Saturday, January 22, 2011 3:25 AM
    • Marked as answer by Kirkkaf Saturday, January 22, 2011 2:23 PM
    Friday, January 21, 2011 7:41 PM
  • Thanks just what I wanted.

    Kirk.

    Saturday, January 22, 2011 2:23 PM
  • You can use the network command to:

    1] download an html page - this is just the html and you need to parse it somehow to get any useful information from it.

    2] download a network file, image, music etc.

    In both cases you need to know the web address, you cannot do searches etc, perhaps one of the extensions can do this (Fremy or Oskariok's Data).

    You can also use the Flickr command to get a random image URL based on a keyword, much as you could googling for an image.

    Once the image is downloaded with Network or Flickr, you can save it to a file:

    image = Flickr.GetRandomPicture("car")
    TextWindow.WriteLine("URL "+image) 'The URL of the image
    imageFile = Network.DownloadFile(image)
    TextWindow.WriteLine("FILE "+imageFile) 'The downloaded file is stored in a temp directory with extension tmp
    File.CopyFile(imageFile, Program.Directory+"\image.jpg") 'assuming the image is a jpg - you could check for this

    Thanks mate I have been looking for this for ages!!!!
    Monday, December 12, 2011 6:58 PM