?
Solved

Open a file in a different window, when URL is clicked!

Posted on 2003-03-14
9
Medium Priority
?
1,235 Views
Last Modified: 2012-06-21
Hello guys,
Following is the situation and any help is certainly appreciated. Thanks

I have an url to a file (might be a word doc, pdf, or xls file) on a webpage. Ok. By default, if you click on the link, the associated file would open in the same browser window, in other words, the excel or word doc or pdf file would open up in the same browser window. Here comes the tricky part.
If I want the associated file(link) to be opened in the actual application say if the url is a link to a word doc, I want the word doc to be opened in MS Word by itself (in a separate window, just like when you double click on a word file), and not within the same or different browser window. Can I do this? Using what, how....?

Here is the real problem. I had a link on a website to a MS Project file I had created. When I clicked on the link, it opened up the project file within my browser fine. But when my boss tried to open it, it just hosed up his machine. He does have MS Project installed on his pc, and his pc has the same config as mine. Interesting factor however is, if he has MS Project running in the background, and then clicks on this link, it opens up the Project file within the browser fine. It won't work if the MS-Project is not running. Any ideas????

Following will clearly explain the situation I am facing right now. I need this to work in many computers. I can't go and hit every computer, so I decided to write a Java Script code. Please let me know your suggestion for the following to work. I have 2 codes. If any one of it could work it is fine. Please help me with this and  I will certainly appreciate that.

Code 1:

Objective: When an url to a MS Project 98 file is clicked on a website, it should open the .mpp file in MS Project 98 by
outside of the browser(just like if you double click on the file) and not within the browser. Should be done with a Java/VB Script and not by changing any File Type properties
or adding the browser flag to the registry.

OS: WIN NT 4.00.1381
IE: 5.500.3314.2101
MS Project 98

Following code gives an error "Automation server can't create object"
The same code works on Win 2000 and XP. Is there a fix for Win NT?

<html>
<title>Test</title>
<body>
<script Language="JavaScript">

function openNotepad() {
   
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun = "C:\\Program Files\\Microsoft Office\\Office\\WINPROJ.EXE";
var commandParms = "C:/Filename.mpp";

oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1")
}
</script>

<a href="javascript:openNotepad()">Test.doc</a>

</body>

</html>


**********************************************************************
Code 2

Objective: When an url to a MS Project 98 file is clicked on a website, it should open the .mpp file in MS Project 98
outside of the browser(just like if you double click on the file) and not within the browser. Should be done with a Java/VB Script and not by changing any File Type properties
or adding the browser flag to the registry.

OS: WIN NT 4.00.1381
IE: 5.500.3314.2101
MS Project 98

Following code opens MS Project 98 application outside of the browser but not the associated .mpp file
Following code works for Word(.doc), Excel(.xls), Powerpoint (.ppt), Access (.mdb).

<html>
<title>Test</title>
<BODY>
<script language="JavaScript">
 function startProj(strFile)
 {
   var myApp = new ActiveXObject("MSProject.Application");  

   //"Word.Application" Opens MS Word
   

  if (myApp != null)
   {
     myApp.Visible = true;
     myApp.XXX.Open(strFile);
     // myApp.Documents.Open(strFile) opens a .doc file, what is the MS Project equivalent of Documents.open to open a .mpp file
   }
 }
</script>

<a href="javascript:startProj('Filename.mpp')">Test.doc</a>

</body>
0
Comment
Question by:karup1k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 2

Expert Comment

by:mikkolsoft
ID: 8137869
After you attach a link of a file to the link, e.g. <a href="abc.doc" target="_blank">Get the abc.doc</a>, your HTML code does not have the authority to tell the client machine how to handle it. It's up to the client browser to decide whether to open it with a software (if the client machine has one and with a specific settings on their registry) or simply open a pop up asking the client what to do with the file (save/open etc). I always think MS does a pretty bad job on plugging in its Office tools with its IE coz it always crashes my IE afterwards.

BTW re. your Javascript code I think will prob. be ok on your machine but once it's hosted up other users' browsers might not like it coz of the security reason.

If you host the site as Intranet maybe you just point the directly to a network file, e.g. <a href="\\Server\ShareFolder\abc.doc" target="_blank">Get the abc.doc</a> then I think it should open the file directly. Haven't tried it yet :) Good luck.

Mikkol
0
 

Author Comment

by:karup1k
ID: 8138063
Hello Mikkol:

Thanks for your reply. I am little confused here. I assume that u asked me to get the doc for code1. COuld you please be more specific and could you tell me how get the file.

// myApp.Documents.Open(strFile) opens a .doc file,

Do you know what object is to be specified to open .mpp file.

myapp.HERE .open(strfile);

If you think this will not fix the problem. Can you give me any sample code that will do it. Thank you for the time.
0
 
LVL 2

Expert Comment

by:mikkolsoft
ID: 8138310
Ah sorry about the confusion. With client-side code like your both code solution I think it'll run into some security problem, so I think they wouldn't work. (actually you COULD but that's kind of dangerous, check this: http://www.whirlywiryweb.com/q%2Fofficedocs.asp)

But if you were making a site for internal use only (i.e. Intranet site) AND the powerpoint file is accessible thru the network (ignore the rest if it's not :), you can make a link which goes directly to your sever like:
<a href="file://Server/ShareFolder/abc.doc" target="_blank">Get the abc.doc</a>

Hope it helps.

Mikkol
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:karup1k
ID: 8138494
This site is for internet use. The link you mentioned in your comment has word,excel and powerpoit. But nothing is mentioned about MS project files.

For word you start the application by

myApp.Documents.Open(strFile);

For Excel

myApp.Workbooks.Open(strFile);

For MS Project how does it work??
myApp. .open(strFile);

Hope you understand my situation here. Thanks for ur time.
0
 
LVL 2

Expert Comment

by:mikkolsoft
ID: 8138987
Yup I searched over the net and MS website and I couldn't find the compatible method just like the example shown above.

I found a not-free alternative solution. You could try it out:
http://www.stellent.com/intradoc-cgi/nph-idc_cgi.exe?IdcService=GET_DYNAMIC_CONVERSION&RevisionSelectionMethod=LatestReleased&dDocName=p2000401

Sorry don't think I solved ur problem after all the mess :P Good luck.

Mikkol
0
 
LVL 2

Expert Comment

by:mikkolsoft
ID: 8139120
BTW the link doesn't tell you much about support in MS project, but I found this (http://cws.internet.com/activex-qvp.html) which says it does support Microsoft Project files.

Mikkol
0
 

Author Comment

by:karup1k
ID: 8139263
Thanks Again. The link what you sent is third party plug in that we should buy and install in all the computers. But what I want is a piece of code that will do this.
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10131067
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 10215243
PAQed, with points refunded (25)

Computer101
E-E Admin
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question