how do i do this... - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: Scripting (/forumdisplay.php?fid=39) +----- Thread: how do i do this... (/showthread.php?tid=69312) how do i do this... by roflmao456 on 12-09-2006 at 10:50 PM
if i want to like say write something to an external file ( viewer.html ) RE: how do i do this... by Baggins on 12-09-2006 at 11:09 PM
You would need to read in the file, parse it, and replace the text. I am not very good at parsing stuff though. RE: how do i do this... by roflmao456 on 12-11-2006 at 12:03 AM
this is my viewer.html file i need to replace the bold ones below.. code: the 12345678901 is what i am going to replace RE: how do i do this... by Baggins on 12-11-2006 at 12:12 AM
ok, one solution popped into my head, first create three variables code: second: code: third: code: now when you find out the id for whichever video you want to veiw, store it in a variable. finally write the variables in this order to your file var1, id, var2, id, var3 that is write NOT append then you have a .html that you can open that is the easiest way i can think of RE: how do i do this... by Spunky on 12-11-2006 at 12:16 AM
code: Remember to write back to the file for changes to take affect Not tested, but it should work EDIT: Beaten RE: how do i do this... by CookieRevised on 12-11-2006 at 02:49 AM
quote:that will not work... The split function is not needed and will actually make that this wont work. Delimeters ("http://www.youtube.com/v/" in your case) will obviously be deleted from the final array the split function has created. ------- The proper way to do this: 1) read the entire file into a variable now you have the entire contents of the file in 1 string. All it takes now is just replacing parts of the string like you replace text in strings... 2) replace the number with your own number in that variable (use the string.replace() function for this with a regular expression so you replace all occurances and not simply the first one). 3) overwrite the file with the new text in that variable But as stated several times by now, look things up yourself roflmao456. You clearly don't learn a thing by asking copy/paste solutions as you keep comming asking for basic programming stuff. Study the JScript 5.6 documentation (available from the official Plus! scripting database, category "others"). Hence I'm not going to give the code, you need to look this up and find out by yourself using the documentation. Start by reading about files and how to open, read and write them. It is clearly explained with examples in the documentation. |