Click here to Skip to main content
15,887,683 members
Home / Discussions / JavaScript
   

JavaScript

 
Questionjava script can't receive an event from MFC activex? Pin
creative2617-Jun-12 22:04
creative2617-Jun-12 22:04 
QuestionPython Bulk-Renamer for Date-Modified Pin
johtnkucz10-Jun-12 0:41
johtnkucz10-Jun-12 0:41 
AnswerRe: Python Bulk-Renamer for Date-Modified Pin
Diana Weiss13-Jun-12 1:49
Diana Weiss13-Jun-12 1:49 
QuestionPlotting libraries - spider plots Pin
Wjousts6-Jun-12 4:12
Wjousts6-Jun-12 4:12 
GeneralChange the wallpaper Pin
Weli055-Jun-12 17:18
Weli055-Jun-12 17:18 
GeneralRe: Change the wallpaper Pin
enhzflep5-Jun-12 18:25
enhzflep5-Jun-12 18:25 
GeneralRe: Change the wallpaper Pin
Weli055-Jun-12 21:53
Weli055-Jun-12 21:53 
GeneralRe: Change the wallpaper Pin
enhzflep6-Jun-12 0:19
enhzflep6-Jun-12 0:19 
No worries. Smile | :)

Sure. There's a couple of approaches. None of which use javascript as a complete solution, since (a) javascript can't modify the registry and (b) Javascript can't write a .reg file, finally (c) I don't remember if we can get the full path of a files saved from the browser with javascript.

1) Set the Registry Keys directly (you can do this with c#)
2) Create a text file (a reg file) that contains text that when Imported with RegEdit will create/modify the required key(s).

An example of #2 may be:
CSS
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop]
"WallpaperOriginX"=dword:00000000
"WallpaperOriginY"=dword:00000000
"WallpaperStyle"="10"
"Wallpaper"="C:\\Users\\enhzflep\\AppData\\Roaming\\Microsoft\\Windows\\Themes\\TranscodedWallpaper.jpg"


And, since I've nothing better to do just now, here's a webpage that will generate data that you can copy and paste into a text-file. You can then save that file with a .reg extension. Once done, you can double-click the file to have it's contents added to or modified in the registry.
Notes
  1. I only set a wallpaper to stretch-mode
  2. I expect the path to have double backslashes in it already
  3. If constructing the string in something other than a browser, you'll want to replace those <br> tags with "\n" - since the browser displays <br> as a newline.

    HTML
    <html>
    <head>
    <script>
    	function byId(e) 
    	{
    		return document.getElementById(e);
    	}
    
    	function makeRegFileData(imgFilePath)
    	{
    		var result;
    		
    		result = "Windows Registry Editor Version 5.00" + "<br>";
    		result += "<br>";
    		result += "[HKEY_CURRENT_USER\\Control Panel\\Desktop]" + "<br>";
    		result += "\"WallpaperStyle\"=\"" + 2 + "\"" + "<br>";
    		result += "\"Wallpaper\"=\"" + imgFilePath + "\"" + "<br>";
    		return result;
    	}
    
    	function processInput()
    	{
    		var path, regStr;
    		
    		path = byId("sourceImage").value;
    		regStr = makeRegFileData(path);
    		byId("resultDiv").innerHTML = regStr;
    	}
    </script>
    <style>
    #resultDiv
    {
    	border: 1px solid black;
    	border-radius: 8px;
    	background-color: #EEE;
    	display: inline-block;
    }
    </style>
    <title>genRegFileData</title>
    </head>
    <body>
    
    Enter image filename: <input id="sourceImage" size="60"/>
    <button onclick="processInput();">Generate</button><br>
    <div id="resultDiv"></div>
    </body>
    </html>

AnswerRe: Change the wallpaper Pin
Weli056-Jun-12 6:31
Weli056-Jun-12 6:31 
QuestionHTML 5 Tutorial Pin
pix_programmer1-Jun-12 20:56
pix_programmer1-Jun-12 20:56 
AnswerRe: HTML 5 Tutorial Pin
Ali Al Omairi(Abu AlHassan)3-Jun-12 20:08
professionalAli Al Omairi(Abu AlHassan)3-Jun-12 20:08 
AnswerRe: HTML 5 Tutorial Pin
berba4-Jun-12 21:43
berba4-Jun-12 21:43 
Questionpassing argument from javascript Pin
dineshbabub1-Jun-12 0:55
dineshbabub1-Jun-12 0:55 
AnswerRe: passing argument from javascript Pin
Manfred Rudolf Bihy1-Jun-12 3:11
professionalManfred Rudolf Bihy1-Jun-12 3:11 
GeneralRe: passing argument from javascript Pin
dineshbabub3-Jun-12 18:13
dineshbabub3-Jun-12 18:13 
GeneralRe: passing argument from javascript Pin
dineshbabub3-Jun-12 21:06
dineshbabub3-Jun-12 21:06 
GeneralRe: passing argument from javascript Pin
Manfred Rudolf Bihy4-Jun-12 1:51
professionalManfred Rudolf Bihy4-Jun-12 1:51 
GeneralRe: passing argument from javascript Pin
Manfred Rudolf Bihy3-Jun-12 21:43
professionalManfred Rudolf Bihy3-Jun-12 21:43 
GeneralRe: passing argument from javascript Pin
dineshbabub3-Jun-12 22:14
dineshbabub3-Jun-12 22:14 
GeneralRe: passing argument from javascript Pin
Manfred Rudolf Bihy4-Jun-12 1:48
professionalManfred Rudolf Bihy4-Jun-12 1:48 
GeneralRe: passing argument from javascript Pin
Manfred Rudolf Bihy4-Jun-12 2:02
professionalManfred Rudolf Bihy4-Jun-12 2:02 
GeneralRe: passing argument from javascript Pin
dineshbabub4-Jun-12 16:08
dineshbabub4-Jun-12 16:08 
GeneralRe: passing argument from javascript Pin
Manfred Rudolf Bihy4-Jun-12 22:24
professionalManfred Rudolf Bihy4-Jun-12 22:24 
QuestionFormatting Numbers to Local Settings Pin
Nagy Vilmos31-May-12 1:33
professionalNagy Vilmos31-May-12 1:33 
AnswerRe: Formatting Numbers to Local Settings Pin
Manfred Rudolf Bihy31-May-12 3:02
professionalManfred Rudolf Bihy31-May-12 3:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.