panorama software,virtual tour software
Alternate Text
Joined: 2009-12-28
Send Msg:
Posts: 25
2010-04-02
#1

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


Alternate Text
Joined: 2012-01-06
Send Msg:
Posts: 1
2012-01-09
#2
Hey Jerry,
Have tried doing a similar thing but no luck. Was trying to load a gallery from my local machine but nothing happens when i click the button that has the javascript. Did you finally succeed in implementing the same?
I'm using TW 7.
Alternate Text
Joined: 2008-11-10
Send Msg:
Posts: 315
2012-01-09
#3

Jerry

Have you tried converting the Word doc to a PDF with CutePDF or something, then launching it.

Or try obj=w.Documents.Open("d:\\2.5\\test.doc");


Lee Scott - Nikon D3/D300/D5000 - |shaved Nikkor 10.5 mm| Manfrotto 055XPROB tripod /322RC2 Grip - Mrotator TCS |CS5 | PW7 & TW6.5 Pro
----
To err is human ... to not try is just plain lazy