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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can Javascript read/check .txt file or windows registry?

Status
Not open for further replies.

janicefoo

Programmer
Apr 17, 2003
53
0
0
MY
Dear Gurus and members,

I am a newbie in JavaScript. I developed an e-learning website using mostly Flash MX 2004 and ActionScript 1.0. I plan to create a record/playback plugin using media control interface (MCI). The plugin is a one time installation. During the installation, the installer will store a value in the user's window registry. In that way, whenever user clicks on the record/playback button, it will check the user's window registry for the value. If it exists, it will display the record/playback pop up window. Otherwise, it will request the user to download the plugin before proceeding.

Is there any sample codes in checking for the registry value, prompting message if value does not exist?

If Javascript can't do that, is there any alternative method to do so? If the plug-in download stores a .txt file in the user's computer instead of a value in the registry, is it possible for Javascript to check the existance of the .txt file instead? How does the codes look like?

Summary:
1.How to write the Javascript that checks the existance of a value in the registry or the existance of a txt file in the user's pc?

2. How to write the if-else statement whereby, if the registry value exists, it will run the MCI record/playback plugin; otherwise, it will prompt a message to request user to download the plugin?

Hope to hear some reply soon as it is urgent. Thanks in advance!

Cheers,
Janice
 
I don't think that JavaScript is allowed to do that (read from the registry)
 
that's done using an ActiveX component, which is different... but I believe they're not allowed to do that either (after all it's a security problem) and that any attempt will be blocked
 
Thanks Dazzled for your information. Do you have any suggestions or idea in solving this problem I have? I am at total lost now as there isn't ways to continue my development. Initially I wanted to use VBScript but it does not support multiplatform. Therefore, I turned to looking for other scriptings but in vain. Can you please give me some pointers? Hope to hear from you soon.

Thanks in advance,
Janice
 
try creating an ActiveX component instead of the MCI interface so that the user uses it directly from your site with no need to download it. however if it's too big, try looking at the sintax of calling such an MCI and, if possible, try enclosing the instantiation of it in an try catch sintax to avoid errors and also find out if the plugin is installed.
 
Thanks. I create MCI interface for the record/playback is because I would like the wav files recorded by the user to be saved on his computer. The saved wav files are later played back one by one like a long conversation. That's is one of the reason why I have to create MCI interface.
I am not sure if I understand your last phrase "...try enclosing the instantiation......plugin is installed". Can you please explain again? Sorry for I am quite 'dumb' in this. Hope to hear from your reply soon.

Thanks in advance,
Janice
 
I never used an MCI plug-in from JavaScript but assuming it's somewhat like using ActiveX:
Code:
a1=document.applets[0];
try
{
        // here you will instantiate the plugin
        a1.createInstance();
}
catch(e)
{
        // this means that tere was an error instantiating the plugin (probably because it was not installed)
        if (window.confirm("You don't have the plugin installed. Do you want to install it now?"))
               window.open("donwload_page_url", "download");
}
 
Hi DaZZleD,
Thanks alot for your suggestions and sample codes. It gives me a clearer idea on solving the problem. I will look into the matter to try out. Hope I can still keep in touch with you regarding this matter in near future, when I have difficulties. I really appreciate your kindness. Thanks in advance and have a pleasant weekend.

Cheers,
Janice
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top