}
return;
} else if (split[1].equalsIgnoreCase("folder") || split[1].equalsIgnoreCase("dir")) {
if (Desktop.isDesktopSupported()) {
try {
Desktop d = Desktop.getDesktop();
d.open(macrodir);
} catch (Exception e) {
sendError(ERRMSG_OSNOTSUPPORTED);
}
} else {
sendError(ERRMSG_OSNOTSUPPORTED);
}
return;
} else if (split.length < 3) {
sendError(ERRMSG_PARAM);
return;
}
String filename = join(split, 2, split.length);
File macro = new File(macrodir, filename + ".txt");
if (split[1].equalsIgnoreCase("delete")) {
if (macro.exists() && macro.isFile()) {
try {
macro.delete();
sendMessage("Macro successfully deleted");
} catch (Exception e) {
sendError("Could not delete specified macro " + filename);
}
} else {
sendError("Could not delete specified macro " + filename);
}
return;
} else if (split[1].equalsIgnoreCase("engine")) {
ScriptEngineManager engineMgr = new ScriptEngineManager();
ScriptEngine engine = engineMgr.getEngineByName(filename);
if (engine == null) {
sendError("Specified language engine could not be loaded.");
return;
}
this.engine = filename;
saveSettings();
sendMessage("Script engine changed to " + filename);
return;
}
if (!macro.exists()) {
try {
macro.createNewFile();
} catch (Exception e) {
sendError("Could not open the macro for editing");
}
}
if (Desktop.isDesktopSupported()) {
try {
Desktop d = Desktop.getDesktop();
d.edit(macro);
} catch (Exception e) {
sendError(ERRMSG_OSNOTSUPPORTED);
}
} else {
sendError(ERRMSG_OSNOTSUPPORTED);