?
Solved

Open an Application in a different window!

Posted on 2003-03-12
10
Medium Priority
?
11,201 Views
Last Modified: 2013-12-24
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????
0
Comment
Question by:k_kishore
[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
  • 3
  • 2
  • 2
  • +2
10 Comments
 
LVL 1

Expert Comment

by:Victor_R
ID: 8128963
k_kishore,

how files are opened is totally dependent on individual users' settings on their machines. All you can do is force the file to open in a new browser window, but even so, what happens then is dependent on local settings. If it's only your boss's computer that needs to be changed, do this:

[Go into Windows Explorer | Tools | Folder Options | File Types. Find the .doc extension (Microsoft Word Document) then edit it or select advanced (depending on OS) and deselect 'browse in same window'.]

Let me know.
0
 

Expert Comment

by:MattNield
ID: 8129818
You can't really over-ride the end users settings, what ever they have set usually goes.  What you can do is over-ride the function of opening the file.

A way to do this may be to set a content-disposition header which should force the end user to download the file.

In ASP (sorry, I'm an ASP-boy), this would be done as follows

<%
'***Init resp. obj
Response.Expires = 0
Response.Buffer
Response.Clear
Response.CacheControl = "public"

'***Add content disp header
Response.AddHeader "content-disposition","attachment; filename=MyPdf.pdf"))

'***Spit out the right kind of stuff
Response.CharSet = "UTF-8"
Response.ContentType = "application/pdf"

Dim objFile
Dim objStream

Set objFile = Server.CreateObject("File.binaryRead")
objStream = objFile.binaryRead("d:\data\MyPdf.pdf")

'***Write to the response object
Response.BinaryWrite objStream

'***Tidy up
Set objFile = Nothing
Response.Flush
Response.End
%>

I hope thatthis is helpful.

Matt
0
 

Expert Comment

by:MattNield
ID: 8129826
When I say force, I mean 'ask'.  The good old @save or open' option box.

:o)

Matt
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 
LVL 1

Expert Comment

by:Victor_R
ID: 8130298
It sounds like this is only for his boss, not for an Internet application or even for a corporation of 500 computers. He should be able to fix this at the end user level.
0
 

Author Comment

by:k_kishore
ID: 8136543
Guys,

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
 

Expert Comment

by:MattNield
ID: 8136672
The main problem here is having access rights on the clients machine to spawn a new application.  You'll find that most people will have this locked down by default as it means that anyone can run anything from a web page using this command.  This is clearly undesirable as they could quite happily run "format c: /s" if they really wanted too.

From my experience, I don't think you're going to achieve it this way, nor do I believe that there is anyway to override the users settings in this instance.

As far as I can see, the only choice is 'save or open'.  Believe me - I've spent a while looking in to this on other occasions with not joy.  It is a very frustrating problem.

This is the extent of help I can offer on this.  I would be interested to hear if you find a way to do what you wish to achieve.

Matt
0
 
LVL 2

Accepted Solution

by:
Psyclones earned 100 total points
ID: 8715901
You may want to try these:

The Scripts
Starting Word.
<script language="JavaScript">
  function startWord(strFile)
  {
    var myApp = new ActiveXObject("Word.Application");
    if (myApp != null)
    {
      myApp.Visible = true;
      myApp.Documents.Open(strFile);
    }
  }
</script>
You can now start Word with a hyperlink:

<a href="javascript:startWord('http://yoursite/test.doc')">Test.doc</a>.

As Word is running locally, mind to feed a full URL as a parameter if you want to open a web document.

Starting Excel.
<script language="JavaScript">
  function startExcel(strFile)
  {
    var myApp = new ActiveXObject("Excel.Application");
    if (myApp != null)
    {
      myApp.Visible = true;
      myApp.Workbooks.Open(strFile);
    }
  }
</script>
You can now start Excel with a hyperlink:

<a href="javascript:startExcel('http://yoursite/test.xls')">Test.xls</a>.

As Excel is running locally, mind to feed a full URL as a parameter if you want to open a web document.

Starting Powerpoint.
<script language="JavaScript">
  function startPowerPoint(strFile)
  {
    var myApp = new ActiveXObject("PowerPoint.Application");
    if (myApp != null)
    {
      myApp.Visible = true;
      myApp.Presentations.Open(strFile);
    }
  }
</script>
You can now start PowerPoint with a hyperlink:

<a href="javascript:startPowerPoint('http://yoursite/test.ppt')">Test.ppt</a>.

As PowerPoint is running locally, mind to feed a full URL as a parameter if you want to open a web document.

0
 
LVL 2

Expert Comment

by:Psyclones
ID: 8841159
You may want to add comments on this topic or accept an answer if the subject is now closed.

Thanks

Psyclones
0
 
LVL 11

Expert Comment

by:turn123
ID: 10192385
k_kishore,
No comment has been added lately (206 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: Award points to Psyclones http:#8715901

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

turn123
EE Cleanup Volunteer
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

One of the biggest challenges facing freelancers is balancing multiple projects and deadlines. Organizational skills and time management are key to keeping up with projects and staying on track. Luckily, we’ve curated seven tools to help you focus o…
This story has been written with permission from the scammed victim, a valued client of mine – identity protected by request.
The Bounty Board allows you to request an article or video on any technical topic, or fulfill a bounty request to earn points. Watch this video to learn how to use the Bounty Board to get the content you want, earn points, and browse submitted bount…
Saved searches can save you time by quickly referencing commonly searched terms on any topic. Whether you are looking for questions you can answer or hoping to learn about a specific issue, a saved search can help you get the most out of your time o…
Suggested Courses

800 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