quote:
Originally posted by SpunkyLoveMuff
code:
var myVar = <variable with source code in it>.split("http://www.youtube.com/v/");
myVar = myVar[1].substr(0,11)//Change 11 to another number if needed
<variable with source code in it>.replace(/myVar/g);
Remember to write back to the file for changes to take affect
Not tested, but it should work
EDIT: Beaten
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.