Basically, what I want to do is get a system variable %USERNAME% into javascript...!
I started this in another forum and realised it should have been in here!
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.
I also want it to write to a file. 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]
I have found this:
...which writes a file fine.
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]
Great news!
Basically, what I want to do is get a system variable %USERNAME% into javascript...!
Any ideas?
Thanks,
Aubs
I started this in another forum and realised it should have been in here!
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.
I also want it to write to a file. 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]
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>
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]
Great news!
Basically, what I want to do is get a system variable %USERNAME% into javascript...!
Any ideas?
Thanks,
Aubs