Mofi wrote:Smart templates are just for quickly inserting text snippets with or without parameters. This feature is not a language dependent IntelliSense feature. The user using the templates for a language must know the meaning. So tooltips for parameters are not possible. That's a typical IntelliSense feature of editors designed for a specific language.
Well maybe it should be a feature request...as the tooltip/intellisense could be defined in the Smart Template XML.
- Code: Select all
<?xml version="1.0"?>
<Templates encode="utf8escenc">
<Template Name="Command"
Description="Some Text."
Comments="0"
Strings="0">
<Insert>Command( [+Value1|Value2|Value3+] , [+Param1|Param2|Param3+] )</Insert>
<ParameterTip Slot=1 Option="Value1">Some Text Tip 1</ParameterTip>
<ParameterTip Slot=1 Option="Value2">Some Text Tip 2</ParameterTip>
<ParameterTip Slot=1 Option="Value3">Some Text Tip 3</ParameterTip>
<ParameterTip Slot=2 Option="Param1">Some Other Text Tip 1</ParameterTip>
<ParameterTip Slot=2 Option="Param2">Some Other Text Tip 2</ParameterTip>
<ParameterTip Slot=2 Option="Param3">Some Other Text Tip 3</ParameterTip>
</Template>
</Templates>
- Code: Select all
<?xml version="1.0"?>
<Templates encode="utf8escenc">
<Template Name="Opt"
Description="Changes the operation of various AutoIt functions/parameters."
Comments="0"
Strings="0">
<Insert>Opt( [+"CaretCoordMode"|"ExpandEnvStrings"|"ExpandVarStrings"|"GUICloseOnESC"|"GUICoordMode"|"GUIDataSeparatorChar"|"GUIOnEventMode"|"GUIResizeMode"|"GUIEventOptions"|"MouseClickDelay"|"MouseClickDownDelay"|"MouseClickDragDelay"|"MouseCoordMode"|"MustDeclareVars"|"PixelCoordMode"|"SendAttachMode"|"SendCapslockMode"|"SendKeyDelay"|"SendKeyDownDelay"|"TCPTimeout"|"TrayAutoPause"|"TrayIconDebug"|"TrayIconHide"|"TrayMenuMode"|"TrayOnEventMode"|"WinDetectHiddenText"|"WinSearchChildren"|"WinTextMatchMode"|"WinTitleMatchMode"|"WinWaitDelay"+] , [+param+] )</Insert>
<ParameterTip Slot=1 Option="CaretCoordMode">Sets the way coords are used in the caret functions, either absolute coords or coords relative to the current active window: 0 = relative coords to the active window 1 = absolute screen coordinates (default) 2 = relative coords to the client area of the active window</ParameterTip>
<ParameterTip Slot=1 Option="ExpandEnvStrings">Changes how literal strings and % symbols are interpreted. By default strings are treated literally, this option allows you to use %environment% variables inside strings, e.g., "The temp directory is: %temp%". 1 = expand environment variables (similar to AutoIt v2) 0 = do not expand environment variables (default) Without this option the usual way would be: "The temp directory is: " & EnvGet("temp")</ParameterTip>
<ParameterTip Slot=1 Option="ExpandVarStrings">Changes how literal strings and variable/macro ($ and @) symbols are interpreted. By default strings are treated literally, this option allows you to use variables and macros inside strings, e.g., "The value of var1 is $var1$". 1 = expand variables (when in this mode and you want to use a literal $ or @ then double it up: "This is a single dollar $$ sign". 0 = do not expand variables (default)</ParameterTip>
<ParameterTip Slot=1 Option="GUICloseOnESC">When ESC is pressed on a GUI the $GUI_EVENT_CLOSE message is sent. This option toggles this behavior on and off. 1 = Send the $GUI_EVENT_CLOSE message when ESC is pressed (default). 0 = Don't send the $GUI_EVENT_CLOSE message when ESC is pressed.</ParameterTip>
<ParameterTip Slot=1 Option="GUICoordMode">Alters the position of a control defined by GUICtrlSetPos. 1 = absolute coordinates (default) still relative to the dialog box. 0 = relative position to the start of the last control (upper left corner). 2 = cell positioning relative to current cell. A -1 for left or top parameter don't increment the start. So next line is -1,offset; next cell is offset,-1; current cell is -1,-1. Obviously "offset" cannot be -1 which reserved to indicate the no increment. But if you can use a multiple of the width you choose to skip or go back.</ParameterTip>
<ParameterTip Slot=1 Option="GUIDataSeparatorChar">Define the character which delimits subitems in GUICtrlSetData. The default character is '|'.</ParameterTip>
<ParameterTip Slot=1 Option="GUIOnEventMode">Enable/disable OnEvent functions notifications. 0 = (default) disable. 1 = enable.</ParameterTip>
<ParameterTip Slot=1 Option="GUIResizeMode">Change default resizing for a control. 0 = (default) keep default control resizing. <1024 = anytype of resizing see GUICtrlSetResizing.</ParameterTip>
<ParameterTip Slot=1 Option="GUIEventOptions">Change special event behavior or GUI function return values. 0 = (default) Windows behavior on click on Minimize,Restore, Maximize, Resize. 1 = suppress windows behavior on minimize, restore or maximize click button or window resize. Just sends the notification.</ParameterTip>
<ParameterTip Slot=1 Option="MouseClickDelay">Alters the length of the brief pause in between mouse clicks. Time in milliseconds to pause (default=10).</ParameterTip>
<ParameterTip Slot=1 Option="MouseClickDownDelay">Alters the length a click is held down before release. Time in milliseconds to pause (default=10).</ParameterTip>
<ParameterTip Slot=1 Option="MouseClickDragDelay">Alters the length of the brief pause at the start and end of a mouse drag operation. Time in milliseconds to pause (default=250).</ParameterTip>
<ParameterTip Slot=1 Option="MouseCoordMode">Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window: 0 = relative coords to the active window 1 = absolute screen coordinates (default) 2 = relative coords to the client area of the active window</ParameterTip>
<ParameterTip Slot=1 Option="MustDeclareVars">If this option is used then all variables must be pre-declared with Dim, Local or Global before they can be used - removes the chance for misspelled variables causing bugs. 1 = Variables must be pre-declared 0 = Variables don't need to be pre-declared (default)</ParameterTip>
<ParameterTip Slot=1 Option="PixelCoordMode">Sets the way coords are used in the pixel functions, either absolute coords or coords relative to the window defined by hwnd (default active window): 0 = relative coords to the defined window 1 = absolute screen coordinates (default) 2 = relative coords to the client area of the defined window</ParameterTip>
<ParameterTip Slot=1 Option="SendAttachMode">Specifies if AutoIt attaches input threads when using Send() function. When not attaching (default mode=0) detecting the state of capslock/scrolllock and numlock can be unreliable under NT4. However, when you specify attach mode=1 the Send("{... down/up}") syntax will not work and there may be problems with sending keys to "hung" windows. ControlSend() ALWAYS attaches and is not affected by this mode. 0 = don't attach (default) 1 = attach</ParameterTip>
<ParameterTip Slot=1 Option="SendCapslockMode">Specifies if AutoIt should store the state of capslock before a Send function and restore it afterwards. 0 = don't store/restore 1 = store and restore (default)</ParameterTip>
<ParameterTip Slot=1 Option="SendKeyDelay">Alters the length of the brief pause in between sent keystrokes. A value of 0 removes the delay completely. Time in milliseconds to pause (default=5).</ParameterTip>
<ParameterTip Slot=1 Option="SendKeyDownDelay">Alters the length of time a key is held down before being released during a keystroke. For applications that take a while to register keypresses you may need to raise this value from the default. A value of 0 removes the delay completely. Time in milliseconds to pause (default=5).</ParameterTip>
<ParameterTip Slot=1 Option="TCPTimeout">Defines the time before TCP functions stop if no communication. Time in milliseconds before timeout (default=100).</ParameterTip>
<ParameterTip Slot=1 Option="TrayAutoPause">Script pauses when click on tray icon. 0 = no pause 1 = pause (default). If there is no DefaultMenu no pause will occurs.</ParameterTip>
<ParameterTip Slot=1 Option="TrayIconDebug">If enabled shows the current script line in the tray icon tip to help debugging. 0 = no debug information (default) 1 = show debug</ParameterTip>
<ParameterTip Slot=1 Option="TrayIconHide">Hides the AutoIt tray icon. Note: The icon will still initially appear ~750 milliseconds. 0 = show icon (default) 1 = hide icon</ParameterTip>
<ParameterTip Slot=1 Option="TrayMenuMode">Extend the behaviour of the script tray icon/menu. This can be done with a combination (adding) of the following values. 0 = default menu items (Script Paused/Exit) are appended to the usercreated menu; usercreated checked items will automatically unchecked; if you double click the tray icon then the controlid is returned which has the "Default"-style (default). 1 = no default menu 2 = user created checked items will not automatically unchecked if you click it 4 = don't return the menuitemID which has the "default"-style in the main contextmenu if you double click the tray icon 8 = turn off auto check of radio item groups</ParameterTip>
<ParameterTip Slot=1 Option="TrayOnEventMode">Enable/disable OnEvent functions notifications for the tray. 0 = (default) disable 1 = enable</ParameterTip>
<ParameterTip Slot=1 Option="WinDetectHiddenText">Specifies if hidden window text can be "seen" by the window matching functions. 0 = Do not detect hidden text (default) 1 = Detect hidden text</ParameterTip>
<ParameterTip Slot=1 Option="WinSearchChildren">Allows the window search routines to search child windows as well as top-level windows. 0 = Only search top-level windows (default) 1 = Search top-level and child windows</ParameterTip>
<ParameterTip Slot=1 Option="WinTextMatchMode">Alters the method that is used to match window text during search operations. 1 = Complete / Slow mode (default) 2 = Quick mode In quick mode AutoIt can usually only "see" dialog text, button text and the captions of some controls. In the default mode much more text can be seen (for instance the contents of the Notepad window). If you are having performance problems when performing many window searches then changing to the "quick" mode may help.</ParameterTip>
<ParameterTip Slot=1 Option="WinTitleMatchMode">Alters the method that is used to match window titles during search operations. 1 = Match the title from the start (default) 2 = Match any substring in the title 3 = Exact title match 4 = Advanced mode, see Window Titles & Text (Advanced) -1 to -4 = force lower case match according to other type of match.</ParameterTip>
<ParameterTip Slot=1 Option="WinWaitDelay">Alters how long a script should briefly pause after a successful window-related operation. Time in milliseconds to pause (default=250).</ParameterTip>
</Template>
</Templates>
Mofi wrote:There is no possibility to define in a template optional parameters and handle them really optional on inserting the template. Of course a user inserting a smart templates with parameters can at any time stop entering the parameters and finish inserting the template. But every fixed text in the template is nevertheless inserted in this case.
If there are various variants for example for a command, appropriate smart templates for most often needed variants should be defined with good names and perhaps also an appropriate description for the template. For example in HTML there are many attributes which can be applied to tables, table rows and table cells. But most often within a website not more than 3 to 10 different table layouts are used (otherwise the website is designed poorly). Creating smart templates for the 3 to 10 tables with good names for quick inserting them is what makes the smart templates feature so efficient. If it would be necessary to always fill in all available options for an entire table it would not make much sense to use smart templates feature at all.
I suggest for your examples with the commands with multiple options, create a smart template with all optional parameters and some more with the parameters you usually really use very often. The goal with smart templates is reducing typing as much as possible.
Well my idea is that you would display all of them, then upon a key combo say ALT+Enter or something, optional parameters beyond where the cursor is are stripped. Markup in the template could be something like:
- Code: Select all
<?xml version="1.0"?>
<Templates encode="utf8escenc">
<Template Name="Command"
Description="Some Text."
Comments="0"
Strings="0">
Command( [+Value1|Value2|Value3+][? , [+1Param1|1Param2|1Param3+]?][? , [+2Param1|2Param2|2Param3+]?] )
</Template>
</Templates>
Where anything between [? ?] is optional...so if I was in slot 1 dealing with Value# and hit ALT+Enter the following two param entries are removed. If I was in 1Param# and did ALT+Enter then the last param would only get nuked.
Anyways to bad some of this stuff isn't available at this time...and may never be...but would be cool...hehe might be a mild headache creating the smart templates like this but would give a bit more power.
Course I didn't go over linking param slots to on another or suggested defaults...but some times its nice to day dream.
Anyways Mofi thanks for your suggestion to use Smart Templates, I'm making good use of them...and thanks for taking the time to respond.
