Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

How to run a file from HTML ?

HTML

  • Please log in to reply
1 reply to this topic

#1 imobile9

imobile9

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 08 June 2008 - 03:20 AM

I have a file called secure.txt which contains user info
I need to be able to do this..
so here is the structure
C:\folder\ C:\folder\index.htm C:\folder\secure.txt
//source of index.htm
<html>

   <head>
function myfun () {
<!-- Javascript here to run secure.txt and display to user -->
}
   </head>

          <body>
<a onclick="myfun()">Display The contents of the File</a>
          </body>

</html>



what should be the javascript code that can do what I need ?
the below code does what I need but it only works If I know the folder details
function myfun()
{
var launcher = new ActiveXObject("WScript.Shell");
launcher.Run("file:///C:/folder/secure.txt");
}
The above code only works if the folder name is folder and resides in C:\
but some of my members can put it in any folder they want and still it should work..
assuming they only rename the folder and both secure.txt and the html file resides inside the same folder, How can I get this to work ???
please help
I need to know what variable is to be used instead of file:///C:/folder to address the folder
  • 0

#2 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8356 posts

Posted 08 June 2008 - 11:44 AM

Just change the name of the file in the code, no?
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download