SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: flethuseo on April 30, 2015, 11:01:41 PM

Title: Procedure associated_file_exists not found.
Post by: flethuseo on April 30, 2015, 11:01:41 PM
Hi all,

I want to create the following macro with an already existing function,
but it cannot find it; I get this error:

Code: [Select]
  Procedure associated_file_exists not found.
Code: [Select]
    #include "slick.sh"

        _command void edit_associated_ruby()
        {
            _str filename = strip_filename(p_buf_name, 'N');
            // extract the extension
            _str extension = _get_extension(filename);
            filename = _strip_filename(filename, 'E');

            if (!associated_file_exists(filename, "xml", returnAll)) {
                filename = "";
            }

            // edit the file
            if (file_exists(filename)) {
                edit(maybe_quote_filename(filename),EDIT_DEFAULT_FLAGS);
                message("Found: " filename);
            } else {
                message("No match found");
            }
        }

I tried including stdcmds.e but I get another error.
Title: Re: Procedure associated_file_exists not found.
Post by: Graeme on May 01, 2015, 12:37:36 PM
The function is static so you can't call it.  Just copy the entire function out of stdcmds.e into your own file and rename it my_associated_file_exists or something.
Title: Re: Procedure associated_file_exists not found.
Post by: flethuseo on May 03, 2015, 05:18:41 PM
Hmm I didn't want to do that. If I do that, I have to copy a bunch of other static functions that are called by that very function.
Title: Re: Procedure associated_file_exists not found.
Post by: Graeme on May 04, 2015, 02:07:17 AM
Did you actually try it?  I tried it before my last post and it compiled fine without copying any other static functions.