home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 2001 - Modelworks Software
- // @Created build 561 cm20011116
-
- /**
- @Tool: createUserContext~create an application context that
- has its own data folder. This is done by creating a new
- shortcut that will start the IDE using the specified data
- folder. Each context will have its own state including
- window list, last project, toolbar states, findParameters,
- and so on. This script uses the /inifile command line option.
- @EndTool:
- @Summary: createUserContext~create an application context
- */
-
-
- function DoCommand()
- {
- var name = prompt("Enter the name of your user configuration", "");
- if (name && name.length > 0)
- {
- var directory = Application.getFolder("Personal") + "\\" + Application.name + "\\Configurations";
- var userDirectory = newFile(directory + "\\" + name);
- if (!userDirectory.exists)
- {
- if (userDirectory.create())
- {
- var iniFile = newFile(userDirectory.path + "\\" + name + ".ini");
- if (iniFile.create())
- {
- var editor = openEditor(iniFile.path);
- if (editor)
- {
- editor.append("[Workspace]\nDataPath=" + userDirectory.path + "\n");
- editor.close(true,false);
- }
-
- var path = directory + "\\" + name + ".lnk";
- var targetPath = Application.path;
- var arguments = "/inifile=\"" + iniFile.path + "\"";
- var workingDirectory = File.getApplicationPath();
- var description = Application.name + " configuration for " + name;
- File.createShortcutFile(path, targetPath, arguments, workingDirectory, description);
-
- path = Application.getFolder("Desktop") + "\\" + name + ".lnk";
- File.createShortcutFile(path, targetPath, arguments, workingDirectory, description);
- }
- }
- }
- else
- {
- alert("A user context already exists with this name.\nYou must choose a different name.");
- }
- }
- }
-
- !!/Script
-