Creating Custom Commands
Commands in AutoCode are xml files that can be created using any xml editor. You can create a new command from scratch or you can use the built in command wizard "AutoX" to create a simple command. To create a command using "AutoX" command follow these steps: - Open a document text
- Press Ctrl+Enter (the AutoCode input box will appear)
- Input the name you will give to the new command and the shortcut you will use to invoke the command, followed by "AX".
For example: "HelloWorld hw AX" - This will create and open the command in a new document window for edit
- Edit the <Code> element to insert the text you want to generate when invoking the command
- You can also edit the <CommandInfo> element to describe and categorize your command
- Save the file and the command will be ready to be used
The following is an example of a command created using AutoX command wizard. <?xml version="1.0"?>
<Commands xmlns="http://schemas.devprojects.net/AutoCode/v3.0">
<Command name="HelloWorld" priority="50">
<CommandBehavior>
<CommandLine shortcut="hw" />
<ActiveDocument extensions="*"/>
</CommandBehavior>
<CommandInfo>
<LanguageCategory>Common</LanguageCategory>
<Category>(Local)</Category>
<Usage>hw</Usage>
<Description>No description supplied.</Description>
<Author>Me</Author>
<HelpUrl></HelpUrl>
</CommandInfo>
<CommandCode language="csharp">
<Codes>
<Code id="Code1">
<![CDATA[]]>
</Code>
</Codes>
<Selection codeElement="Code1" codePoint="StartOfElement">
<SelectText></SelectText>
</Selection>
</CommandCode>
</Command>
</Commands>
For instance, to generate "Hello Word!" edit the <Code> element as follow: <Codes>
<Code id="Code1">
Hello World!
</Code>
</Codes>
Save the file and the command will be ready to use.
The command will be saved in \My Documents\AutoCode 2008\Commands folder, and will be available for all solution for the current user.
You can also create a command in the current Solution Folfer using "AXL" command instead of "AX". The command located in the current solution will be available only for the current solution.
To test the command, open a new document, press Ctrl+Enter and input "hw" in the AutoCode input box. This will insert "Hello World!" in the current position.
|