Old 22nd November 2011, 10:24   #1
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
wscript.exe problem when run javascript

test.js

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

	var m_tb_prefs = Components.classes["@mozilla.org/preferences-service;1"].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
HTML Code:
Exec 'wscript.exe "c:\test.js"'
Error: "netscape is undefined"
NOCaut is offline   Reply With Quote
Old 22nd November 2011, 11:21   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 22nd November 2011, 11:23   #3
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
I get url: http://www.4shared.com/ for example.
NOCaut is offline   Reply With Quote
Old 22nd November 2011, 11:25   #4
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
i want know i can change *.js file using nsis?
NOCaut is offline   Reply With Quote
Old 22nd November 2011, 11:30   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
Quote:
Originally Posted by NOCaut View Post
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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 22nd November 2011, 11:34   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
Quote:
Originally Posted by NOCaut View Post
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

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 22nd November 2011, 12:33   #7
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
ok thanks
NOCaut is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump