Member_2_1242703
asked on
Opening a textfile in Wordpad using ActiveX
How do I open a particular text file in wordpad using ActiveX?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Got it!
One more question...
How do you format a file on a network drive?
Say my file is at \\myserver\myfolder\myfile .txt
One more question...
How do you format a file on a network drive?
Say my file is at \\myserver\myfolder\myfile
<HTML>
<HEAD>
<TITLE>
test
</TITLE>
<script type="text/javascript">
var shell = new ActiveXObject("Wscript.Shell");
shell.run("WORDPAD C:\\Reports\\test.txt");
</script>
</HEAD>
<BODY>
</BODY>
</HTML>
I'm glad you noticed the fact you left out wordpad, the command. :)
I am not sure a UNC path will work, or at least for all operating systems. If it doesn't you will need to map the drive. Having said that though the slashes in the normal UNC path above would need to be escaped so you would use ...
shell.Run("wordpad \\\\myserver\\myfolder\\my file.txt");
Let me know if you have any more questions about opening a text file in Wordpad.
bol
I am not sure a UNC path will work, or at least for all operating systems. If it doesn't you will need to map the drive. Having said that though the slashes in the normal UNC path above would need to be escaped so you would use ...
shell.Run("wordpad \\\\myserver\\myfolder\\my
Let me know if you have any more questions about opening a text file in Wordpad.
bol
ASKER
Most of the users will have a drive mapped to this location, I just wanted to use the UNC in the event that someones drive mapping gets dropped, etc. Thanks again for all your help!
Your welcome! I'm glad I could help. Thanks for the grade, the points and the fun question.
bol
bol
ASKER
Thanks. That script works great but it opens my file in the default text editor which in my case (and most of my users) is Notepad. I need to force this file to open in Wordpad.
Thanks
Open in new window