Skip to content

Instantly share code, notes, and snippets.

@kou1okada
Created April 7, 2013 17:06
Show Gist options
  • Save kou1okada/5331339 to your computer and use it in GitHub Desktop.
Save kou1okada/5331339 to your computer and use it in GitHub Desktop.
inkscape.exe wrapper for evading a bug of gtk_entry at Japanese environment.

Install

  1. Copy inkscape.exe.js to your Inkscape folder.
  2. Edit following registory entry.
  • HKCR\svgfile\shell\edit\command
  • HKCR\svgfile\shell\Inkscape\command
  • HKCR\svgzfile\shell\edit\command
  • HKCR\svgzfile\shell\Inkscape\command

If your inkscape.exe is installed to "C:\Program Files\Inkscape" or "C:\Program Files (x86)\Inkscape", you can use following .reg file in substitution for above step 2.

  • "inkscape.exe.js.Program Files.reg"
  • "inkscape.exe.js.Program Files (x86).reg"

And for rollback for step 2 is

  • "inkscape.exe.js.Program Files.orig.reg"
  • "inkscape.exe.js.Program Files (x86).orig.reg"
/**
* inkscape.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 INKSCAPE_PATH = [
// Please append here path for inkscape.exe if you want to use it preferentially.
//"C:\\Program Files\\Inkscape\\inkscape.exe",
//"C:\\Program Files (x86)\\Inkscape\\inkscape.exe",
];
var REG_APP_PATH = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\inkscape.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 = "";
try {
INKSCAPE_PATH.push(shell.RegRead(REG_APP_PATH));
} catch(e) {
WScript.Echo(e);
}
for (var i = 0; i < INKSCAPE_PATH.length; i++) {
if (fs.FileExists(INKSCAPE_PATH[i])) {
cmd = '"' + INKSCAPE_PATH[i] + '"';
break;
}
}
if (cmd != "") {
for (var i = 0; i < args.length; i++) {
cmd += " " + '"' + args(i) + '"';
}
shell.run(cmd);
} else {
WScript.Echo("Error: inkscape.exe is not found.");
}
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\svgfile\shell\edit\command]
@="\"C:\\Program Files (x86)\\Inkscape\\Inkscape.exe\" \"%1\""
[HKEY_CLASSES_ROOT\svgfile\shell\Inkscape\command]
@="\"C:\\Program Files (x86)\\Inkscape\\Inkscape.exe\" \"%1\""
[HKEY_CLASSES_ROOT\svgzfile\shell\edit\command]
@="\"C:\\Program Files (x86)\\Inkscape\\Inkscape.exe\" \"%1\""
[HKEY_CLASSES_ROOT\svgzfile\shell\Inkscape\command]
@="\"C:\\Program Files (x86)\\Inkscape\\Inkscape.exe\" \"%1\""
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\svgfile\shell\edit\command]
@="wscript \"C:\\Program Files (x86)\\Inkscape\\Inkscape.exe.js\" \"%1\""
[HKEY_CLASSES_ROOT\svgfile\shell\Inkscape\command]
@="wscript \"C:\\Program Files (x86)\\Inkscape\\Inkscape.exe.js\" \"%1\""
[HKEY_CLASSES_ROOT\svgzfile\shell\edit\command]
@="wscript \"C:\\Program Files (x86)\\Inkscape\\Inkscape.exe.js\" \"%1\""
[HKEY_CLASSES_ROOT\svgzfile\shell\Inkscape\command]
@="wscript \"C:\\Program Files (x86)\\Inkscape\\Inkscape.exe.js\" \"%1\""
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\svgfile\shell\edit\command]
@="\"C:\\Program Files\\Inkscape\\Inkscape.exe\" \"%1\""
[HKEY_CLASSES_ROOT\svgfile\shell\Inkscape\command]
@="\"C:\\Program Files\\Inkscape\\Inkscape.exe\" \"%1\""
[HKEY_CLASSES_ROOT\svgzfile\shell\edit\command]
@="\"C:\\Program Files\\Inkscape\\Inkscape.exe\" \"%1\""
[HKEY_CLASSES_ROOT\svgzfile\shell\Inkscape\command]
@="\"C:\\Program Files\\Inkscape\\Inkscape.exe\" \"%1\""
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\svgfile\shell\edit\command]
@="wscript \"C:\\Program Files\\Inkscape\\Inkscape.exe.js\" \"%1\""
[HKEY_CLASSES_ROOT\svgfile\shell\Inkscape\command]
@="wscript \"C:\\Program Files\\Inkscape\\Inkscape.exe.js\" \"%1\""
[HKEY_CLASSES_ROOT\svgzfile\shell\edit\command]
@="wscript \"C:\\Program Files\\Inkscape\\Inkscape.exe.js\" \"%1\""
[HKEY_CLASSES_ROOT\svgzfile\shell\Inkscape\command]
@="wscript \"C:\\Program Files\\Inkscape\\Inkscape.exe.js\" \"%1\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment