Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Anbang24 on February 25, 2024, 08:59:25 am

Title: OnScriptMenu: the index 'GetFileName' does not exist
Post by: Anbang24 on February 25, 2024, 08:59:25 am
I write a piece of script to get the filename in the active editor as following:

Code
        local edman = GetEditorManager();
        if (IsNull(edman))
       {
            ShowError(_("Could not query the Editor manager. Cannot continue."));
            return 0;
        }
        local editor = edman.GetActiveEditor();
        if (IsNull(editor)) 
       {
            ShowError(_("No active editor. Cannot continue."));
            return 0;
        }
        local fname = editor.GetFileName();  //??
        ShowInfo(fname);

It is very simple, however, I got the following message in running:
    OnScriptMenu:the index 'GetFileName' does not exist

I carefully read the Scripting commands (https://wiki.codeblocks.org/index.php/Scripting_commands),
but still don't understand why this happens. Does the command deprecated?



Title: Re: OnScriptMenu: the index 'GetFileName' does not exist
Post by: Miguel Gimenez on February 25, 2024, 11:42:37 am
Scripts are case-sensitive:
Code
wxString 	GetFilename
Title: Re: OnScriptMenu: the index 'GetFileName' does not exist
Post by: Anbang24 on February 26, 2024, 05:45:41 am
Thanks!