Click to See Complete Forum and Search --> : help me with a script please!


strider
03-20-2003, 01:25 PM
well my problem is that I want a boton that when I click on it, it copy the page( where the boton is located), open word and paste it there, in other words to select all, copy, open word and paste it there, please help me :( i need the script for that!! well thanks for your time and effort!!!

Luis
:p

Jona
03-20-2003, 01:32 PM
It can't be opened in Word. Javascript can't do that. But select-all and copy to clipboard is possible with Javascript.

strider
03-20-2003, 02:16 PM
Well if the botton cant paste what I copied, at least I want to select all copy and open word with one boton can some one give me the script for that??

Jona
03-20-2003, 02:19 PM
No, no, you don't get what I said. Javascript can select all, it can copy, and it can paste. But it cannot open Microsoft Word.

strider
03-20-2003, 02:25 PM
IC well then, what can I do ?? how is the javascript code for at least select all and copy, so if there is no command to open word then where can i paste it? well thanks for your time and effort I'm sorry Im new in this.

Jona
03-20-2003, 02:29 PM
Well you could select all, copy, and then use window.location="somewordfile.wrd" to open Microsoft Word in the browser window. Then you'd have to tell the users to press CTRL + V to paste.

strider
03-20-2003, 02:34 PM
so in one boton can i put select all and copy, and in an other boton open word, or can i put all that in just one boton, it's very complicated the script? can you made that script for me please :( :p ( of course if you want) thankS!!!

Jona
03-20-2003, 02:44 PM
Here goes...

<html><head><script>
function copy() {
holdtext=document.frm1.holdtext;
holdtext.innerText = document.body.innerText;
//holdtext.innerText = disp.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("RemoveFormat");
Copied.execCommand("Copy"); }

function openWord(){location="somewrdfile.wrd"}
</script></head><body>
<form name="frm1"><textarea name="holdtext" style="visibility:hidden"></textarea></form>
<input type=button onclick="copy();openWord()" value="Do all functions"><br>
<br>blahblah hahahah something text here hahaha whatever
</body></html>

Make sure you change somewrdfile.wrd to whatever your word file is.

strider
03-20-2003, 02:48 PM
thanks a lot!!! well actually i wanted a new document for word not a really document just to open a new, but thanks a lot!!!! :D( can it open a new word document right?):confused:

Jona
03-20-2003, 02:50 PM
JavaScript cannot create a new file. That is why I suggest that your already-created .wrd file is empty, or it tells the user to paste.

strider
03-20-2003, 03:01 PM
im so sorry to be bothering you, if i want to open an exe file it can be possible?? instead of the file of word just open an .exe file

Jona
03-20-2003, 03:03 PM
You can do that. But it will try to download it. But if you know the exact folder that the .exe file is in on their computer then you can use the FileSystemObject to open it... I think... It's a long procedure and not worth the time, though.

strider
03-20-2003, 03:06 PM
is that long??? well is not like to open a flie? I know where the file is but is not script like open() and where the file i??

Jona
03-20-2003, 03:11 PM
You can't use JavaScript to do it. Period. Ok?

strider
03-20-2003, 03:13 PM
ROger! ok thank you for all your time and effort!! you have helped a lot Im very gratefull!! thanks!!!!!:D :D sorry for all the trouble!!

strider
03-20-2003, 03:24 PM
Im so sorry to disturb you!! but i wanted to open it with microsoft word, the files .doc is the same??? im sorry for causing all this trouble

mozkill
03-20-2003, 04:31 PM
you can do it easy:

just open a window with the following URL:

"C:\Program Files\Microsoft Office\Office\Shortcut Bar\Office\Microsoft Word.lnk"

strider
03-20-2003, 05:08 PM
thanks but for this code what i have to change to do that?


<html><head><script>
function copy() {
holdtext=document.frm1.holdtext;
holdtext.innerText = document.body.innerText;
//holdtext.innerText = disp.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("RemoveFormat");
Copied.execCommand("Copy"); }

function openword(){location="somefile.wrd"}
</script></head><body>
<form name="frm1"><textarea name="holdtext" style="visibility:hidden"></textarea></form>
<input type=button onclick="copy();openword()" value="Copiar pagina"><br>
<br>click here!
</body></html>

mozkill
03-21-2003, 05:05 PM
just change location to be location="C:\Program Files\Microsoft Office\Office\Shortcut Bar\Office\Microsoft Word.lnk"

this location is the same for any person who has installed Office 2000