Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTA - Save file to network drive

Status
Not open for further replies.

Aubs010

Technical User
Apr 4, 2003
306
GB
Hi,

I have set up a HTA that displays training modules for users WITHIN my office.

The problem I have is finding out what modules each person has actually attempted (even viewing a second of it would suffice!).

Using login scripts, I can place shortcuts on everyones desktop and/or start menu to the HTA file.

The HTA file consists of 2 frames:
[tt]
+------------+------------------------+
| Module 1 | |
| Module 2 | |
| Module 3 | This is where the |
| Module 4 | module loads and |
| | is a video clip |
| | using swf |
| | |
| | |
+------------+------------------------+
[/tt]

When the user clicks on say Module 1, the swf file is loaded into the right frame.

Is there any way to write a file to a network folder (everyone will have write permissions)?

With batch files, this would be easy, by simply:
[tt]echo %USERNAME% - Module 1 >> \\server\folder\log.txt[/tt]
or even:
[tt]echo Completed >> "\\server\folder\%USERNAME% - Module 1.txt"[/tt]

It doesn't really matter how the files are saved, be it:
[tt]
| FileName | Contents |
|------------+-----------------|
| Aubs.txt | Module1 |
| | Module2 |
| Andrew.txt | Module2 |
| | Module3 |
|____________|_________________|
[/tt]

or

[tt]
| FileName | Contents |
|------------+-----------------|
| log.txt | Aubs-Module1 |
| | Andrew-Module2 |
| | Andrew-Module3 |
| | Aubs-Module2 |
|____________|_________________|
[/tt]

Thanks in advance for any help provided :)





Aubs
 
I have found this:
Code:
    <SCRIPT LANGUAGE='JavaScript'>
      function WriteToFile() {
        try {
          var fso, s;
          fso = new ActiveXObject("Scripting.FileSystemObject");
          s = fso.OpenTextFile("C:\\test.txt" , 8, 1, -2);
          s.writeline("This is a test");
          s.Close();
        }
        catch(err){
          var strErr = 'Error:';
          strErr += '\nNumber:' + err.number;
          strErr += '\nDescription:' + err.description;
          document.write(strErr);
        }
      }
      WriteToFile()
    </SCRIPT>
...which writes a file fine.

Great news!

Now all I need to do is to get a system variable %USERNAME% into javascript...

Any ideas?

Thanks again,



Aubs
 
Ooops, sorry people, I think this thread should go to the Javascript forum (thread216-993311) for anyone who is interested.

Regards,



Aubs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top