Welcome Guest Search | Active Topics | Members | Log In | Register

Command Help - Display Command Info Options · View
AutoCoDEV
Posted: Monday, May 05, 2008 11:54:48 PM
Rank: Advanced Member
Groups: Member

Joined: 4/17/2008
Posts: 2
Points: -91
Location: Spain
This command shows a MessageBox describing a specific command given it's shortcut.

For Example, executing "help p" shows the following info:

Paste the content of the Clipboard and replace all occurrences of <oldText> with <newText>.

Usage: <oldText> <newText> cr
Language: Common
Author: Devprojects (http://www.devprojects.net)


Here is the code:

Code:

<?xml version="1.0"?>
<Commands xmlns="http://schemas.devprojects.net/AutoCode/v3.0">
  <Command name="HelpCommand" priority="50">
    <CommandBehavior>
      <CommandLine shortcut="help" shortcutPosition="First" />
      <ActiveDocument extensions="*"/>
    </CommandBehavior>

    <CommandInfo>
      <LanguageCategory>Common</LanguageCategory>
      <Category>AutoX</Category>
      <Usage><![CDATA[help <shortcut>]]></Usage>
      <Description>Describe the specify command.</Description>
      <Author>devprojects.net</Author>
      <HelpUrl>http://www.devprojects.net</HelpUrl>
    </CommandInfo>

    <CommandCode language="csharp">

      <Execute>
        if( Arguments.Length == 1)
        {
          bool found = false;
          string text;
         
          foreach (ICommand cmd in base.Catalog.Commands)
          {
            if(cmd.Shortcut.ToLower() == Arguments[0])
            {
              found = true;
              text = String.Format("{0}\r\n\r\n", cmd.Description);
              text += String.Format("Usage: {0}\r\n\r\n", cmd.Usage);
              text += String.Format("Language: {0}\r\n\r\n", cmd.LanguageCategory);
              text += String.Format("Author: {0} ({1})\r\n", cmd.Author, cmd.HelpUrl);
              MessageBox.Show(text, "AutoCode Command " + cmd.Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
          }
         
          if(!found)
          {
            text = String.Format("Command not found for shortcut '{0}'", Arguments[0]);
            MessageBox.Show(text, "AutoCode Command not found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
          }
        }
        else
        {
            Response.Handled = false;
        }
      </Execute>

    </CommandCode>
  </Command>
</Commands>
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008