David,

Kill the parenthesis on that line.  Meaning the line should read:

KB.InsertString "tll"

Only use the parens if you are assigning the method to a variable which of course you are not here. This is a VBScript thing.

Regards,
Doug


David wrote:
Thanks for your suggestion. When scrolling the WE Script manual, I found the InsertKey, that you suggested, but also found the InsertString, which seemed better. This due to the fact, I want to send a string to the keyboard. So, I edited my script, and it now reads the following. But when pressing the hotkey, I get the speech, then an error message, which I have quoted below: dim MyHotkey1 : Set myHotkey1 = Keyboard.RegisterHotkey("Control-q", "NextItem")
Set KB = Keyboard
sub NextItem()
Speak "Next Item"
KB.InsertString( "tll" )
end sub ' NextItem
' error message:
type mismatch: 'InsertString'
0800A000D

    ----- Original Message -----
    *From:* Roy Shtupler <mailto:[email protected]>
    *To:* [email protected] <mailto:[email protected]>
    *Sent:* Sunday, November 01, 2009 5:12 PM
    *Subject:* Re: What's wrong here - please help

    what does the error message say?
    have you also tried using the InsertKeys method of the Keyboard
    object?
    best
    Roy.
    ----- Original Message -----

        *From:* David <mailto:[email protected]>
        *To:* Scripting List WE <mailto:[email protected]>
        *Sent:* Sunday, November 01, 2009 3:43 PM
        *Subject:* What's wrong here - please help

        Hi,
        I am trying to write a script. The following code should press
        the keysequence
            tll
        for me, whenever the hotkey is pressed. But all that I get, is
        an error message for the line, which I have marked with (*).
        In other words, the (*) itself, does not apper in the code...
dim MyHotkey1 : Set myHotkey1 =
        Keyboard.RegisterHotkey("Control--Shift-A", "NextItem")
        Set WshShell = WScript.CreateObject("WScript.Shell")
        sub NextItem()
        Speak "Next Item"
        (*)WShShell.SendKeys "tll"
        end sub 'NextItem

Reply via email to