2004-08-16 17:41:11 +01:00
|
|
|
// =================================================================
|
|
|
|
// Logtalk - Object oriented extension to Prolog
|
2006-03-26 18:31:34 +01:00
|
|
|
// Release 2.27.1
|
2004-08-16 17:41:11 +01:00
|
|
|
//
|
2006-02-10 17:44:05 +00:00
|
|
|
// Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved.
|
2004-08-16 17:41:11 +01:00
|
|
|
// =================================================================
|
|
|
|
|
2005-12-24 18:00:21 +00:00
|
|
|
var prolog_path = "C:\\Yap\\bin\\yap.exe";
|
2004-08-16 17:41:11 +01:00
|
|
|
|
|
|
|
if (WScript.Arguments.Unnamed.Length > 0) {
|
|
|
|
usage_help();
|
|
|
|
WScript.Quit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
WScript.Echo('');
|
|
|
|
WScript.Echo('Creating a shortcut named "Logtalk - YAP" for running Logtalk');
|
|
|
|
WScript.Echo('with YAP...');
|
|
|
|
WScript.Echo('');
|
|
|
|
|
|
|
|
var FSObject = new ActiveXObject("Scripting.FileSystemObject");
|
|
|
|
|
|
|
|
if (!FSObject.FileExists(prolog_path)) {
|
|
|
|
WScript.Echo("Error! Cannot find yap.exe at the expected place!");
|
2005-12-24 18:00:21 +00:00
|
|
|
WScript.Echo("Please edit the script and update the location of the yap.exe executable.");
|
2004-08-16 17:41:11 +01:00
|
|
|
WScript.Quit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
var WshShell = new ActiveXObject("WScript.Shell");
|
|
|
|
|
|
|
|
var WshSystemEnv = WshShell.Environment("SYSTEM");
|
|
|
|
var WshUserEnv = WshShell.Environment("USER");
|
|
|
|
var logtalk_home;
|
|
|
|
|
2004-12-05 21:52:49 +00:00
|
|
|
if (WshSystemEnv.Item("LOGTALKHOME"))
|
2004-08-16 17:41:11 +01:00
|
|
|
logtalk_home = WshSystemEnv.Item("LOGTALKHOME");
|
|
|
|
else if (WshUserEnv.Item("LOGTALKHOME"))
|
|
|
|
logtalk_home = WshUserEnv.Item("LOGTALKHOME")
|
|
|
|
else {
|
|
|
|
WScript.Echo("Error! The environment variable LOGTALKHOME must be defined first!");
|
|
|
|
usage_help();
|
|
|
|
WScript.Quit(1);
|
|
|
|
}
|
|
|
|
|
2005-12-24 18:00:21 +00:00
|
|
|
if (!FSObject.FolderExists(logtalk_home)) {
|
|
|
|
WScript.Echo("The environment variable LOGTALKHOME points to a non-existing directory!");
|
|
|
|
WScript.Echo("Its current value is: %LOGTALKHOME%");
|
|
|
|
WScript.Echo("The variable must be set to your Logtalk installation directory!");
|
|
|
|
WScript.Echo("");
|
|
|
|
usage_help();
|
|
|
|
WScript.Quit(1);
|
|
|
|
}
|
|
|
|
|
2004-08-16 17:41:11 +01:00
|
|
|
logtalk_home = logtalk_home.replace(/\\/g, "\\\\");
|
|
|
|
|
|
|
|
if (!FSObject.FolderExists(logtalk_home + "\\bin"))
|
|
|
|
FSObject.CreateFolder(logtalk_home + "\\bin");
|
|
|
|
|
2004-11-29 20:36:31 +00:00
|
|
|
var f = FSObject.CreateTextFile(logtalk_home + "\\bin\\logtalk_yap.pl", true);
|
2004-08-16 17:41:11 +01:00
|
|
|
|
2004-11-29 20:36:31 +00:00
|
|
|
f.WriteLine(":- reconsult('$LOGTALKUSER\\\\configs\\\\yap.config').");
|
2004-08-16 17:41:11 +01:00
|
|
|
f.WriteLine(":- reconsult('$LOGTALKHOME\\\\compiler\\\\logtalk.pl').");
|
2004-11-29 20:36:31 +00:00
|
|
|
f.WriteLine(":- reconsult('$LOGTALKUSER\\\\libpaths\\\\libpaths.pl').");
|
2004-08-16 17:41:11 +01:00
|
|
|
f.Close();
|
|
|
|
|
|
|
|
var ProgramsPath = WshShell.SpecialFolders("AllUsersPrograms");
|
2004-09-15 00:11:12 +01:00
|
|
|
|
|
|
|
if (!FSObject.FolderExists(ProgramsPath + "\\Logtalk"))
|
|
|
|
FSObject.CreateFolder(ProgramsPath + "\\Logtalk");
|
|
|
|
|
|
|
|
var link = WshShell.CreateShortcut(ProgramsPath + "\\Logtalk\\Logtalk - YAP.lnk");
|
2004-11-29 20:36:31 +00:00
|
|
|
link.Arguments = "-l %LOGTALKHOME%\\bin\\logtalk_yap.pl";
|
2004-08-16 17:41:11 +01:00
|
|
|
link.Description = "Runs Logtalk with YAP";
|
|
|
|
link.IconLocation = "app.exe,1";
|
|
|
|
link.TargetPath = prolog_path;
|
|
|
|
link.WindowStyle = 1;
|
|
|
|
link.WorkingDirectory = logtalk_home;
|
|
|
|
link.Save();
|
|
|
|
|
|
|
|
WScript.Echo('Done. The "Logtalk - YAP" shortcut was been added to the Start Menu');
|
2004-11-29 20:36:31 +00:00
|
|
|
WScript.Echo('Programs. Make sure that the environment variables LOGTALKHOME and');
|
|
|
|
WScript.Echo('LOGTALKUSER are defined for all users wishing to use the shortcut.');
|
2004-08-16 17:41:11 +01:00
|
|
|
WScript.Echo('');
|
2005-12-24 18:00:21 +00:00
|
|
|
WScript.Echo('Users must run the batch script "cplgtdirs" before using the');
|
|
|
|
WScript.Echo('"Logtalk - YAP" shortcut.');
|
|
|
|
WScript.Echo('');
|
2004-08-16 17:41:11 +01:00
|
|
|
|
|
|
|
WScript.Quit(0);
|
|
|
|
|
|
|
|
function usage_help() {
|
|
|
|
WScript.Echo('');
|
|
|
|
WScript.Echo('This script creates a shortcut named "Logtalk - YAP" for running Logtalk');
|
|
|
|
WScript.Echo('with YAP. The script must be run by a user with administrative rights.');
|
|
|
|
WScript.Echo('The LOGTALKHOME environment variable must be defined before running this');
|
|
|
|
WScript.Echo('script.');
|
|
|
|
WScript.Echo('');
|
|
|
|
WScript.Echo('Usage:');
|
|
|
|
WScript.Echo(' ' + WScript.ScriptName + ' help');
|
|
|
|
WScript.Echo(' ' + WScript.ScriptName);
|
|
|
|
WScript.Echo('');
|
|
|
|
}
|