http://automagic4android.com/flow.php?i ... dabdf04425
I like to change my home screen periodically. The random picture is from the get http method...from the flickr url...I need to use the split and replace methods.....I am trying but so for no luck. Do you have any demo to how to do split....replace, save the pic....like that
Appreciate the help.
Finally I did it
But is it possible to create a variable to store image? If it is I can make dynamic home screen change....
change home screen.
Moderator: Martin
Re: change home screen.
You could download the file to a directory that contains only files you want to use as a wallpaper and then use the flow called Random Wallpaper from the catalog to show a random picture from this folder.
The catalog is available from the main screen of Automagic: Menu->Catalog, select Scripting and open the flow Random Wallpaper.
The catalog is available from the main screen of Automagic: Menu->Catalog, select Scripting and open the flow Random Wallpaper.
Re: change home screen.
I have a query on similar lines, I would like to create a widget that displays the current xkcd.com comic.
I've found a query that returns the following data in a file saved to my SD card;
{"month": "3", "num": 1339, "link": "", "year": "2014", "news": "", "safe_title": "When You Assume", "transcript": "", "alt": "You know what happens when you assert--you make an ass out of the emergency response team.", "img": "http:\/\/imgs.xkcd.com\/comics\/when_you_assume.png", "title": "When You Assume", "day": "7"}
How do extract the "img" url "http:\/\/imgs.xkcd.com\/comics\/when_you_assume.png" to download it please?
Regards Mark.
I've found a query that returns the following data in a file saved to my SD card;
{"month": "3", "num": 1339, "link": "", "year": "2014", "news": "", "safe_title": "When You Assume", "transcript": "", "alt": "You know what happens when you assert--you make an ass out of the emergency response team.", "img": "http:\/\/imgs.xkcd.com\/comics\/when_you_assume.png", "title": "When You Assume", "day": "7"}
How do extract the "img" url "http:\/\/imgs.xkcd.com\/comics\/when_you_assume.png" to download it please?
Regards Mark.
Re: change home screen.
You could use the scripting functions indexOf and substring to extract the URL:
Alternatively you could use an unofficial function to convert the JSON to XML and use XPath to extract the value:
Regards,
Martin
Code: Select all
// search the start of the url (the string is enclosed single quotes so that double quotes can be used without escaping with backslash)
i1 = indexOf(response, '"img": "');
//skip the first 8 charcters containing "img": "
i1 = i1 + 8;
// search the end of the url, start searching where the URL starts
i2 = indexOf(response, '",', i1);
//extract the url
url = substring(response, i1, i2);
Code: Select all
//add an artificial root element to create proper XML
xml = convertJSONtoXML('"root":' + response + '}');
//extract the url
url = evaluateXPathAsString(xml, "//img");
Martin