- Home /
Getting text from a website file and storing it in a variable
function openUpdateWebsite () { // Replace this url with wherever the user can download the update. var updatedl_url ="http://inthebox.spruz.com/gfile/75r4!-!GDKEGD/downloadlink.txt"; updatedl_post = WWW(updatedl_url); yield updatedl_post; // Wait until the download is done if(updatedl_post.error) { print("There was an error loading the update URL: " + updatedl_post.error); } else { var updateWebbie : String; updateWebbie = char.Parse(updatedl_post.data); System.Diagnostics.Process.Start("explorer.exe",updateWebbie); }
}
Well im clearly doing something wrong here but string.Parse doesnt exist so how to get the text from a text file in a website and then add it to the updateWebbie variable?
Are you trying to parse marked-up text (ie, render the HT$$anonymous$$L as intended) or just use it as plain-text? I also don't know if you can open text using Windows Explorer. Do you mean to use Internet Explorer (iexplore.exe)? Even that takes an URL rather than the HT$$anonymous$$L to render from the command line: http://msdn.microsoft.com/en-us/library/ee330728%28VS.85%29.aspx Long story short, could you clarify what your intent is?
Basicly , i wanted it to open the website with the default interweb browser program a user has
Answer by Mike 3 · Jul 14, 2010 at 01:44 PM
You don't need to parse it - it's already a string:
updateWebbie = updatedl_post.data;
Edit (for future reference):
Usually to get a variable as a string, you'd just use variable.ToString(); though it's not needed here