Created
April 7, 2013 18:47
-
-
Save kou1okada/5331880 to your computer and use it in GitHub Desktop.
gimp-2.8.exe wrapper for evading a bug of gtk_entry at Japanese environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* gimp-2.8.exe wrapper for evading a bug of gtk_entry at Japanese environment. | |
* | |
* Copyright (c) 2013 Koichi OKADA. All rights reserved. | |
* This script is distributed under the MIT license. | |
* http://www.opensource.org/licenses/mit-license.php | |
*/ | |
//var REG_APP_PATH = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\gimp-2.8.exe\\"; | |
var SEARCH_PATH = [ | |
// Please append here path for .exe if you want to use it preferentially. | |
"C:\\Program Files\\GIMP 2\\bin\\gimp-2.8.exe", | |
]; | |
var args = WScript.Arguments; | |
var shell = new ActiveXObject("WScript.Shell"); | |
var env = shell.Environment("Process"); | |
var fs = new ActiveXObject("Scripting.FileSystemObject"); | |
env("LANG") = "en"; | |
var cmd = ""; | |
if (typeof(REG_APP_PATH) != "undefined") { | |
try { | |
SEARCH_PATH.push(shell.RegRead(REG_APP_PATH)); | |
} catch(e) { | |
WScript.Echo(e); | |
} | |
} | |
for (var i = 0; i < SEARCH_PATH.length; i++) { | |
if (fs.FileExists(SEARCH_PATH[i])) { | |
cmd = '"' + SEARCH_PATH[i] + '"'; | |
break; | |
} | |
} | |
if (cmd != "") { | |
for (var i = 0; i < args.length; i++) { | |
cmd += " " + '"' + args(i) + '"'; | |
} | |
shell.run(cmd); | |
} else { | |
WScript.Echo("Error: .exe is not found."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment