How can we help you today? How can we help you today?

Restore SendKeys functionality?

Some of my snippts used SendKeys codes, as in http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformssendkeysclasstopic.asp
RAISERROR{(}N'<msg, nvarchar{(}200{)},>',0,1{)} WITH NOWAIT+{HOME}^+M

This types the RAISERROR command then selects the line (+{HOME}) and initiates a template fill-in dialog (^+M which is Ctrl+Shift+M) all in one keystroke.

Can you enhance v3 to support SendKeys again, please?
PDinCA
0

Comments

5 comments

  • Tilman
    Hi,

    Thanks for the suggestion. I've added it to our list. I daresay it won't make it into v3, though.

    Regards,

    Tilman

    PS: You can specify where the cursor goes by putting '$CURSOR$'. c.f. the 'acud' default snippet.
    Tilman
    0
  • Bart Read
    Hi Stephen,


    Can you clarify what you're after with this please? It looks like you're trying to get a kind of live templates type function, so would it be better if you could specify variable placeholders like this, and have SQL Prompt 3 iterate over them in turn:

    RAISEERROR( N'$MESSAGE$') WITH NOWAIT ?


    Thanks,
    Bart
    Bart Read
    0
  • PDinCA
    Yes, some kind of "live template" is exactly what I've been using the sample snippet for. I noticed one of the Snippet "donations" used sp_who followed by F5 to run the command immediately, so the "automation" of snippets is something those of us from Prompt SQL heritage benefitted from.

    I tried to find something about $MESSAGE$ in the preliminary Help, but no joy. $CURSOR$ I understand and have adapted my snippets to use, but what's $MESSAGE$ about?

    Are there other $xx$ tokens we should know about?
    PDinCA
    0
  • Bart Read
    I was starting to suspect as much, except that SendKeys basically turns the whole thing into a sort of macro rather than a true live template.

    $MESSAGE$ is just a placeholder for something you'd type in. You could call it anything you wanted (we don't yet support this and it'll be a while before it appears - certainly not in version 3), but the point is that if you use the placeholder multiple times in a snippet you only have to enter the text that replaces it once.

    As an example, you could get quite sophisticated and do things like this self-join example:

    SELECT $ALIAS$.* FROM $TABLENAME$ AS $ALIAS$ INNER JOIN $TABLENAME$ AS $ALIAS$2 ON $ALIAS$.$COLUMNNAME$ = $ALIAS$2.$COLUMNNAME2$

    The point here is that you only have to enter values for $ALIAS$, $TABLENAME$, $COLUMNAME$ and $COLUMNNAME2$ once for each placeholder and you do your editing in situ.

    Let me just say again: we don't support this yet! To get this working in SSMS and QA is going to be complicated as anything so it absolutely will not in any way shape or form be appearing in SQL Prompt 3. I'm just saying that it's something we might consider doing for the future. Maybe. :)

    Hope that clears it up.


    Thanks,
    Bart
    Bart Read
    0
  • PDinCA
    Sadly, does this mean that SendKeys functionality is entirely defunct and way over the horizon, if at all?

    The automation feature was REALLY useful - do say that you smart chaps can bump equivalent functionlaity up the to-do list :D:D:D
    PDinCA
    0

Add comment

Please sign in to leave a comment.