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>
|