Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

O/T: HTML/JS to launch local app


Smidge204

Recommended Posts

I'm developing a small intranet PHP application. What I'd like to do is provide a hyperlink or button that will open a folder or file, such as a MS Word document, that is located on a network share. (The share is common to all workstations on the intranet)

The difficulty is that it must open the copy on the network share and not download a local copy first. Changes made to the document need to be saved accordingly without the user having to "save as" to the original location.

I realize that most browsers have disabled launchign of local files for security reasons, but I'm confident I can configure any browser to allow it over the intranet zone. First, I need to get the links working!

Any thoughts?

=Smidge=

Link to comment
Share on other sites

So to clarify..

Bob opens up his intranet portal and sees a new excel spreadsheet. Normally bob would have to download this spreadsheet locally, modify it, and then save it to the original network machine.

We want it so bob can just click the link to open excel with the file already in it, then just allow him to save to the original location?

Well.. I think it's possible. Links to network machines should work (Only on IE if I recall correctly). IE: http://machine1/excel/spreadsheet.xls.

Now, getting it to automatically open without first saving locally is an issue. I don't any office programs support a from-the-browser protocol. As say, AIM's aim:goim?.

So what might be possible, is to draft up something in AJAX that would serve as a browser based editor (a la writely).

I'll do some research and get back to you.

Link to comment
Share on other sites

Normally, Bob would have to browse the network share and open the file from wherever it is, and edit it in-place. The network share is the fileserver (nightly backups!) which contains folders for each job. In each folder is a set of subfolders for things like letters, photographs, specifications and (mostly) AutoCAD files.

The problem is people are people and tend to do stupid things, and files frequently end up where they don't belong or the wrong file gets edited. I seek to reduce problems by removing opportunity for stupid mistakes.

One solution I was kicking around, is defining a custom file type which I could generate on the fly in PHP, which basically has just the path fo the file to be opened. Train the browser to open it automatically with my own little proxy application that would be associated with that file type. The application would then launch the file via Win32 API and let the system launch the appropriate application for it.

Sounds like it'll work...

=Smidge=

Link to comment
Share on other sites

Nah, wasn't that bad. Observe:

header("Content-Type: application/proxylaunch; name=app.pla");
header("Content-disposition: attachment; filename=app.pla");
header("Content-type: binary");
header("Pragma: no-cache");
die($filetolaunch);[/PHP]

(Written in VisualBasic 6)

[CODE]Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Main()
Dim LaunchPath As String

If Command$ = "" Then Exit Sub

Open Command$ For Input As #1
Line Input #1, LaunchPath
Close

ShellExecute 0, "Open", LaunchPath, 0&, 0&, 1
End Sub[/CODE]

When the link is clicked, the browser asks what to do with the "pla" file. Open the file with the VB6 program (set as default so it doesn't ask again) and the appropriate program launches seamlessly, including Explorer if it's just a folder. The only 'catch' is it requires a little extra setup at each station, which isn't that bad... there's only 15 computers on the network.

=Smidge=

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...