> -----Original Message----- > From: Jerry Johnson [mailto:jmi...@gmail.com] > Sent: Wednesday, April 08, 2009 3:21 PM > To: cf-community > Subject: Hosts file editor for non-tech types > > > We are finding a need to have non-developers modify their hosts file to > view > development versions of our sites using the main domain url. > > Does anyone know of a wysiwyg app for windows, and one for mac, to > allow > easy modification, and preferably the ability to toggle/comment out > existing
I just recently had the same problem but couldn't find anything. I ended up writing a simple HTA (HyperText Application) to do this for our one site - perhaps you might find it useful (I've appended it below)? I'm not sure if Mac IE supports HTA tho. Since you're talking about specific sites do you really need a generic tool or just a tool with your specific options? The basic code below (the non-HTML code) could be used in a Windows Scripting Host script as well - you could set up specific scripts/icons for specific needs perhaps? In any case the basic code is appended (save it a file with an "HTA" extension and run it). This is set up for Windows XP (the HOST path in Vista is different - c:/windows/ rather than c:/WINNT). You may get a permissions error (you wouldn't with a scripting host script) if so go to IE Options > Advanced and enable "Allow active content to run...". Of course the end users will need rights (probably admin rights) to actually edit the hosts file as well. That was a major problem for us. I know this isn't what you're looking for, but maybe it'll give you some ideas. Jim Davis <html> <head> <title>SmartApp Diagnostics Console</title> </head> <body onload="init();"> <script language="JavaScript"> // Create a FileSystem object oFS = new ActiveXObject("Scripting.FileSystemObject"); // Path to hosts file (hardcoded for now) hostspath = "C:\\WINNT\\system32\\drivers\\etc\\"; // Backs-up the original hosts file if it's not already function backupHosts() { if ( !oFS.FileExists(hostspath + "hosts.original") ) { oFS.CopyFile(hostspath + "hosts", hostspath + "hosts.original", true); }; }; // Restores the backed-up Hosts file and deletes the back up function restoreHosts() { if ( oFS.FileExists(hostspath + "hosts.original") ) { // Copy the original oFS.CopyFile(hostspath + "hosts.original", hostspath + "hosts", true); // Delete the backup oFS.DeleteFile(hostspath + "hosts.original", true); }; }; function setHosts(loc) { var siscIP = "255.255.255.255"; var riscIP = "255.255.255.255"; var url = "site.com" var newEntry = ""; // Restore Original Hosts restoreHosts() // Backup Original Hosts backupHosts(); // Construct the new Hosts entry if ( loc == "sisc" ) { newEntry += siscIP + " " + url + " #SISC"; } else if ( loc == "risc" ) { newEntry += riscIP + " " + url + " #RISC"; }; // Open the Hosts file hostsFile = oFS.OpenTextFile(hostspath + "hosts", 8); // Append the new entry hostsFile.WriteLine(newEntry); // Close the Hosts file hostsFile.Close(); // Display the hosts file displayHosts(); }; function displayHosts(loc) { // Open the Hosts file var CurHostsFile = oFS.OpenTextFile(hostspath + "hosts", 1).ReadAll(); // Load the display document.getElementById("Div_HostsFileDisplay").innerHTML = "<pre>" + CurHostsFile + "</pre>"; }; function displayIPInfo() { // Get the Temp Folder / Get Temp File var tmpFolder = oFS.GetSpecialFolder(2); var tmpFilename = oFS.GetTempName(); var tmpPath = tmpFolder + "\\" + tmpFilename; // Run GetIPConfig (new ActiveXObject("wscript.shell")).run ("%comspec% /c ipconfig.exe > " + tmpPath, 0, true); // Get the Temp File data var CurIPData = oFS.OpenTextFile(tmpPath).ReadAll(); // Load the display document.getElementById("Div_IPInfoDisplay").innerHTML = "<pre>" + CurIPData + "</pre>"; } // Initial Stuff function init() { window.resizeTo(550, 550); displayHosts(); displayIPInfo(); }; </script> <style type="text/css"> /* Basic Definitions */ body,td,p,dt,ul { font-family: Verdana, Arial, sans-serif; font-size: 12px; } A:LINK { color: #007bc6; text-decoration: none; } A:VISITED { color: #007bc6; text-decoration: none; } A:HOVER { text-decoration: none; } /* Standard Definitions */ b { font-weight: bold; } i { font-style: italic; } u { text-decoration: underlined; } /* General Sizing and spacing */ li { line-height: 150%; } .indent { padding-left: 15px } /* Header Definitions */ h1 { font-weight: bold; font-size: 18px; } h2 { font-weight: bold; font-size: 14px; } h3 { font-weight: bold; font-size: 12px; } h4 { font-weight: bold; font-size: 11px; } /* Relative Size Declarations */ .smaller { font-size: 80%; } .small { font-size: 90%; } .large { font-size: 110%; } .larger { font-size: 130%; } .App_Control_Active { cursor: pointer; text-align: center; border: 1px solid #007bc6; border-left: 3px solid #007bc6; padding-left: 2px; padding-right: 2px; margin: 1px; background-color: #ffffff; color: #007bc6; } .App_Control_Inactive { cursor: default; text-align: center; border: 1px solid #999999; border-left: 3px solid #999999; padding-left: 2px; padding-right: 2px; margin: 1px; background-color: #ffffff; color: #999999; } </style> <!--- Title ---> <h2>Diagnostics Console</h2> <!--- Hosts File Manipulation ---> <h2>Hosts File</h2> <ul> <li><span class="App_Control_Active" onclick="JavaScript: setHosts('risc'); alert('Hosts File set to RISC for site.com');">Set to RISC</span></li> <li><span class="App_Control_Active" onclick="JavaScript: setHosts('sisc'); alert('Hosts File set to SISC for site.com');">Set to SISC</span></li> <li><span class="App_Control_Active" onclick="JavaScript: restoreHosts(); alert('Hosts File Restored to Original State');">Restore Original</span></li> </ul> <div id="Div_HostsFileDisplay" style="height: 200px; width: 500px; overflow: scroll;"></div> <ul> <li><span class="App_Control_Active" onclick="JavaScript: displayHosts();">Refresh</span></li> </ul> <h2>Current IP Information</h2> <div id="Div_IPInfoDisplay" style="height: 200px; width: 500px; overflow: scroll;"></div> <ul> <li><span class="App_Control_Active" onclick="JavaScript: displayIPInfo();">Refresh</span></li> </ul> </body> </html> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:294484 Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5