Hi David,

this looks like an example (at least partially) of a windows script host
script.

in window eyes, you don't have access to the wscript object as you do in wsh
scripts, so making use of wscript.createobject needs to be changed to just
createobject.  I don't know why you aren't getting an error here, but the
result is that your object variable wshShell is undefined when you try to
call sendKeys.

window eyes has a built-in method equivalent to sendKeys (I believe), which
is easier to use if it works the same.  see the documentation for
keyboard.insertString().

finally, your hot key definition string seems to have double dashes in it at
one point; I'd be surprised if that works.

hth,

Chip

 

-----Original Message-----
From: David [mailto:[email protected]] 
Sent: Sunday, November 01, 2009 8:43 AM
To: Scripting List WE
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