Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Simple Web Query

Options
  • 14-07-2004 1:47pm
    #1
    Closed Accounts Posts: 537 ✭✭✭


    Does anyone know if you can execute an actual program from a web page

    i.e. normally when you click a link it attempts to download the application
    I want it to execute it for example microsoft word

    Consider the fact that the program is on a shared drive and everyone using it will be mapped to it


«1

Comments

  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 91,679 Mod ✭✭✭✭Capt'n Midnight


    Do you mean you want Word to open when you click on a URL to .DOC file stored on the web site ?

    That functionality is determined by the Browser and TBH opening Word Docs is dodgy since they can have Macros.

    If it's IE and an intranet - and it's in a trusted zone and you look at the settings - you should get a choice of open or save.


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    To launch a .exe - not really.
    The web is based on downloading information. So when someone clicks a link, if it's someone the browser recognises as displayable, it'll download it automatically. If it's something that browser cannot handle (a .exe for example), it'll ask the user if they want to download the file or open it ("run from its current location"). You may be able to force the local security policy to autorun .exe's but that's a huge security risk.

    There may also be embeddable ActiveX controls that will allow you to do this.


  • Moderators, Politics Moderators Posts: 39,765 Mod ✭✭✭✭Seth Brundle


    Is there a real need for this in your site?


  • Registered Users Posts: 1,931 ✭✭✭Zab


    I presume we are only talking about IE here?

    Something along the lines of this should work.
    <script language="vbscript">
    	Function Calc()
    		Set WShell = CreateObject("WScript.Shell") 
    		WShell.Run "calc.exe"
    	End Function
    </script>
    
    <a href='#' onClick='Calc()'>Calc.exe</a>
    

    You'll have to put the site into the trusted zone, and you can disable the ActiveX warnings for the zone too.


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    thats excellent
    However i need it to execute a .bat file which in turn will open A text file
    Could you show me how to edit it so that it will execute a .bat file


  • Advertisement
  • Closed Accounts Posts: 8,264 ✭✭✭RicardoSmith


    But if you run something like Word from your web server then you will slow the server to a crawl. Tried this in the past where clients might not have Word installed etc. Basically you need to rethink about the problem you are trying to solve. Theres likely a more elegant and better way of solving it.


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    im not running word from the server

    Imagine The database i want to load is located on a drive that everyone can map to
    The person goes onto the web page
    Clicks the link
    The database is loaded from the Shared drive
    So it would be the exact same as going to start run \\server\folder\database


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Originally posted by JohnnyBravo
    im not running word from the server

    Imagine The database i want to load is located on a drive that everyone can map to
    The person goes onto the web page
    Clicks the link
    The database is loaded from the Shared drive
    So it would be the exact same as going to start run \\server\folder\database
    Not exactly. IE treats that link as a hyperlink, not as an explorer link.

    As said about, the Wshell.run command may help if you put "Wshell.Run 'explorer \\server\folder\database'"


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    It wont load up .doc and .mdb files so i was investigating would it load up .bat files


  • Closed Accounts Posts: 8,264 ✭✭✭RicardoSmith


    Originally posted by JohnnyBravo
    im not running word from the server

    Imagine The database i want to load is located on a drive that everyone can map to
    The person goes onto the web page
    Clicks the link
    The database is loaded from the Shared drive
    So it would be the exact same as going to start run \\server\folder\database

    All you want to do is point the client to the file on the network. Or do you want them to download a local copy of the file/db?


  • Advertisement
  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    i want the file to open when the click
    You know like when you open a PDF


  • Registered Users Posts: 1,268 ✭✭✭hostyle


    Originally posted by JohnnyBravo
    It wont load up .doc and .mdb files so i was investigating would it load up .bat files

    I'm still not exactly sure what it is you're trying to do. If MS Word is installed on your client machine (presuming Internet Explorer) and your server is sending out the correct MIME type in its Content-type header, clicking on a link to a word .doc should open the document in word. If it doesn't there a couple of quick hacks you can use, but I have found that it _usually_ just works.


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    ok this is what i am using

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <script language="VBScript" type="text/VBScript">

    Function Calc()
    Set WShell = CreateObject("WScript.Shell")
    WShell.Run "C:\Documents and Settings\Owner\Desktop\db1.mdb" End Function

    </script>

    </head>

    <body>
    <a href='#' onClick='Calc()'>Calc.exe</a>
    </body>
    </html>


    nothing happens at all
    However it does work for .exe files


  • Registered Users Posts: 1,931 ✭✭✭Zab


    How about:
    WShell.Run "C:\DOCUME~1\Owner\Desktop\db1.mdb"
    
    or
    WShell.Run chr(34) & "C:\Documents and Settings\Owner\Desktop\db1.mdb" & chr(34)
    


  • Closed Accounts Posts: 8,264 ✭✭✭RicardoSmith


    I don't understand the problem you are trying to solve. But it looks like you are trying to replace a round wheel with a square one.

    If its just have a link on a webpage (intranet) that opens a file on the server then the link should be the UNC path (not the mapped path) to that file on the network. It shouldn't be the local path on the server either (C:\... etc)

    PDF's (and word docs) can be opened inside an IE window, but its very slow way of doing it. Linking to the file directly (if its on the network) or downloading to the client machine is massively faster.


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    yes i want to link to the file directly



    WShell.Run chr(34) & "C:\Documents and Settings\Owner\Desktop\db1.mdb" & chr(34)

    doesnt work and neither does the other one

    its infuriating


  • Closed Accounts Posts: 8,264 ✭✭✭RicardoSmith


    Navigate to the file using the network neighbourhood/my networkplaces. Right click on it, go to properties and you should see the UNC path. It looks like //servername/folder/filename etc. Use that and see if it works. There should be no drive letters in the path.

    All you should need is

    <A HREF="path & filename ">
    <IMG SRC="path & imagefile" WIDTH="x" HEIGHT="y" BORDER=0 ALT="">
    </A>

    Assuming I'm on the same wavelength...


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    For testing purposes it simply resides on the desktop
    What should i type


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Originally posted by JohnnyBravo
    For testing purposes it simply resides on the desktop
    What should i type
    <a href="file://C:\Documents and Settings\Owner\Desktop\Doc1.doc">Clicky</a>


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    should i take this line out so

    Set WShell = CreateObject("WScript.Shell")
    WShell.Run "C:\Documents and Settings\Owner\Desktop\db1.mdb" End Function


    and replace this line

    <a href='#' onClick='Calc()'>Calc.exe</a>


    with the line you have just given me


    if so it cant do anything it just keeps asking me to refresh the page


  • Advertisement
  • Closed Accounts Posts: 8,264 ✭✭✭RicardoSmith


    If you launch the file the OS knows to load it with the correct application. You'll be asked to download it or run it. Just run it. As hoststyle said earlier if you MIME types are correct this should all happen automatically.

    Why are you trying to shell out and run an exe. You don't need to do that once the app is installed on the client.

    Listen I'll send you a link via PM to a file I have online. let me know if thats what you are trying to do...


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    ok
    I should stress here that i dont want them to download the file off the server
    I want them to run it on the server based on the link selected


    I just tried your link and it wants me to install the word document or run it
    How ever when i i choose your link winzip loads automatically

    I want this to happen for an MDB


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 91,679 Mod ✭✭✭✭Capt'n Midnight


    Originally posted by JohnnyBravo
    i want the file to open when the click
    You know like when you open a PDF
    In Adobe 5 - Edit - Preferences
    - Options - Untick the web Browser options
    (seems to load faster if startup - tick certified add ins only and untick splash screen)
    - update - set to manual
    - Web buy - untick

    Otherwise a lot of sites the PDF's don't work

    LOL - re trying to get a text file to run...

    If the serve is Windows 2000 - and the clients are Windows 2000 Pro or Windows XP Pro, then you can use terminal services - nice and light. NB. if clients are opening a dB through Access then M$ insist that each has a licence to use it locally


  • Closed Accounts Posts: 8,264 ✭✭✭RicardoSmith


    Originally posted by JohnnyBravo
    ok
    I should stress here that i dont want them to download the file off the server
    I want them to run it on the server based on the link selected


    I just tried your link and it wants me to install the word document or run it
    How ever when i i choose your link winzip loads automatically

    I want this to happen for an MDB

    Ok, I see where you are going with this.

    You can't run Access (the application) across an intranet or the internet. Its not a web application. End of story. Its not designed to do this, and you're not allowed to do this by Microsoft. Same with any Office app, word, excel etc. So you have two choices.

    1) You can put an Access database (the file) on your webserver and write and application in Java, VBscript, PHP to allows users to work with the Access database across the web, internet or intranet. (this has nothing to using Access the application)

    2) You can put an Access database on your local network server (not a webserver) share it, and have users who have Access (the application) installed on their local PC, work with the Access database on the server. This has nothing to do with intranets, internet or indeed any web technologies.

    One small but important point though. When you see a Word Doc or a PDF open in a browser window. You are actually seeing Word or Acrobat running. But they are hidden underneath the browser (usually IE) They (the applications) are running from the local PC and NOT the web server. The doc or PDF isn't on the server either , its been copied to your local machine, to a temp location or browser cache and opened from there. If you open your task manager you'll see the applications are running on your local machine.

    In my example that I linked you do. The Zip file has been downloaded and winzip on your machine launched. Its not running on the server. TThe file you open is not on the server. Its on your machine somewhere.

    Hopefully some of that is a) correct b) helpful c) not complete gibberish.

    You could also use Remote Access software, but that again is replacing a round wheel with a square one, for this kind of scenerio.


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    Ok
    So is it possible to set up the mdb so that a local copy is loaded just like winzip

    Or better still can you get it to execute a batch file because that would solve all my problems


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Just on a point of note

    Access can only have 1 write user at any one time and up to ten concurrent read users (ie people with read locks)

    Hence why access shouldnt used in the ASP access role unless you have very few users.


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    No one can write to it except me

    And max there is only going to be 3 users for this database link


  • Registered Users Posts: 1,931 ✭✭✭Zab


    You should be able to have it launch a batch file with the WShell method. For a start, stop using the documents and settings directory, as the spaces aren't helping much. Also, when something doesn't work, it should give an error message, possibly in the lower left corner of explorer ( click it ). What error is it giving?

    I presume that the machine will launch Access if you double click a MDB file? How about if you try "start file.mdb" from a command prompt?


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    i tried lauunching the .mdb file but that doesnt work i also moved the .bat file to the c directory

    i use this code

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <script language="VBScript" type="text/VBScript">

    Function Calc()
    Set WShell = CreateObject("WScript.Shell")
    WShell.Run "C:\test1.bat" End Function

    </script>

    </head>

    <body>
    <a href='#' onClick='Calc()'>Calc.exe</a>
    </body>
    </html>



    How ever it keeps asking me to refresh the page that there is an error


  • Advertisement
  • Registered Users Posts: 1,931 ✭✭✭Zab


    Does it not give the error? If you double-click on the error message in the bottom left of the page?

    If Access isn't launched automatically, you should look into why this isn't happening ( have a look at Explorer's Folder Options->File Types ).


Advertisement