Archive: wscript.exe problem when run javascript


wscript.exe problem when run javascript
test.js

function SetHomePage()
netscape.security.PrivilegeManager.enablePrivilege ('UniversalBrowserRead');

var m_tb_prefs = Components.classes***91;"@mozilla.org/preferences-service;1"***93;.getService(Components.interfaces.nsIPrefBranch);
var res = false;

curHomePage = m_tb_prefs.getCharPref('browser.startup.homepage');
m_tb_prefs.setCharPref('browser.startup.homepage', 'http://www.4shared.com/');
m_tb_prefs.setIntPref('browser.startup.page', 1);
}

SetHomePage()
and run
Exec 'wscript.exe "c:\test.js"'
Error: "netscape is undefined"

The NSIS forum is not the correct place to post javascript questions!

...wscript is windows scripting host and not a general web browser, you cannot access browser specific objects with it.

Who would want 4shared.com as their homepage anyway? All this seems a bit fishy to me, you should just let the user set their homepage.


I get url: http://www.4shared.com/ for example.


i want know i can change *.js file using nsis?


Originally posted by NOCaut
I get url: http://www.4shared.com/ for example.
Use example.com next time you need a general URL.

My point still stands, you cannot set the homepage this way. Setting the users homepage like this is usually done by spyware like applications, if you don't have evil intentions you should just let the user set the homepage.

Originally posted by NOCaut
i want know i can change *.js file using nsis?
If you are rolling out Firefox in a domain environment I believe there are better ways of dealing with this than editing .js files that belong to the user. You should take a look at the unofficial Firefox MSI installers or edit the profile defaults in \FireFox\defaults\profile

ok thanks