Here is the macro (modified only by replacing my companies name with "MyCompany"). I had loaded and unloaded it several times by hand before I tried loading it programatically. There's not much to it. It just looks for a copyright string when you save a buffer and adds one if you don't have it and want it.
The macro that caused the problem is below this one and is part of a different file. I was just starting to experiment, so it isn't very pretty (of course, neither is the first macro; oh well). The thought was to have a way to deploy a set of macros to my co-workers. I was using the cpyrite macro to experiment with.
#include "slick.sh"
void _cbsave_cpyrite()
{
_save_pos2(p);
split(p_buf_name, '/', splitResult);
if ((search('copyright', '@HI') != 0) &&
(search('copyright', '-@HI') != 0) &&
(strcmp(splitResult[1], 'vobs') == 0))
{
if (_message_box('Would you like to add a Copyright string to ' :+
p_buf_name :+ '?',
'Copyright Query',
MB_YESNO | MB_ICONQUESTION) == IDYES)
{
date = _date('U');
_str yyyy, mm, dd;
parse date with mm'/'dd'/'yyyy;
cpyriteStr = '// Copyright (C) ' :+
yyyy :+
' by MyCompany Corporation. All rights reserved.';
top();
insert_literal("\n");
top();
insert_line(cpyriteStr);
insert_line('');
save();
}
}
_restore_pos2(p);
}
----------
from boostrapmacros.e:
#include "slick.sh"
_command void bootstrapmacros()
{
_str macroPath = get_env('VSLICKCONFIG') :+ 'macros';
if (file_match(macroPath, 1) == '')
{
execute('mkdir ' :+ macroPath);
}
// Copy to macro directory if necessary.
_str fileToCopy = macroPath :+ '/cpyrite.e';
if (file_match(fileToCopy, 1) != '')
{
execute('rm ' :+ fileToCopy);
}
commandString = 'cp /Toolkit/util/cpyrite.e ' :+ macroPath;
execute(commandString);
// Load macro.
load(macroPath :+ '/cpyrite.e');
save_config();
safe_exit(); // <-- Added this morning after response in this forum.
}