Javascript: Open Word Document
I'm now getting into extending functionality of TW5 using Javascript as an action for buttons to meet my needs. My TW5 products are used offline (not on the Internet) where I distribute a .exe file.
My first challenge is to Open a Word Document on the hard drive, so my users can pull up a history document about the tour I'm presenting. They can even modify the document too. So... I need to open up a local file in Word that exists in the same or a subdirectory to the mytour.exe I've created. I use the following Javascript:
function OpenWordDoc(){
var w = new ActiveXObject("Word.Application");
var obj;
if (w!=null)
{
w.Visible=true;
obj=w.Documents.Open("test.doc");
}
}
OpenWordDoc()
This attempt to open the document, but defaults to look in the C:\windows\system32\ directory, not the directory that I launched the mytour.exe file.
Any idea how I can get the default path to be the path I launched mytour.exe from? Does EP need to reprogram something?
I am running Win7 Home Premium 64-bit.
Thanks,
Jerry