vbscript sendkeys()

Tom Glod tom at makeshyft.com
Sat Oct 13 01:06:29 EDT 2018


SOLVED. I split the vbscript in 2 parts.... focused the desire application
then wait then send keys

it now works every time..... if i could delay the script using a"Wscript"
less solution, that would be ideal.

>From the dictionary

"Any which contains a reference to WScript will fail to run, because
WScript objects do not exist in the LiveCode environment. "

For anyone who finds this thread later.

On Sat, Oct 13, 2018 at 12:35 AM Tom Glod <tom at makeshyft.com> wrote:

> It seems like the problem is indeed with sendkeys happening too
> quickly..but i have also concluded that when I try the Wscript.Sleep 500
> command it is not compiling and my vbscript, and the sendkeys are never
> sent. when i take the wait out...it works, but too quickly.
>
> so i just need to find a working syntax to halt the vbscript.  thanks for
> the hint...i'll just try a bunch of things to try to narrow down.
>
>
>
> On Fri, Oct 12, 2018 at 9:52 PM Tom Glod <tom at makeshyft.com> wrote:
>
>> Hi Brian, thanks.....I have tried that, seems to work even less than
>> without it.
>>
>> but you might be onto something here.... because sometimes "most" of the
>> text gets written... mostly none.....and other times all of them.  will
>> keep on testing to see if i can find the cause of this inconsistency.
>>
>> Ty
>>
>>
>>
>> On Fri, Oct 12, 2018 at 6:02 PM Brian Milby via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>
>>> Have you tried adding a delay? It could be that the sendkeys is
>>> happening before the app is ready for input. (Have not tried from LC, but I
>>> do something similar in a .vbs file.)
>>>
>>> Wsh.AppActivate "Notepad" : WScript.Sleep 500
>>>
>>> Thanks,
>>> Brian
>>> On Oct 12, 2018, 4:38 PM -0500, Tom Glod via use-livecode <
>>> use-livecode at lists.runrev.com>, wrote:
>>> > Hey folks, is anyone currently successfully using "do as vbscript" and
>>> > sending keystrokes to other application windows?
>>> >
>>> > I have it set to work when i hit a hotkey....
>>> >
>>> > this is my vb script:
>>> >
>>> > Dim Wsh
>>> > Set Wsh = CreateObject("Wscript.Shell")
>>> > Wsh.AppActivate "Notepad"
>>> > Wsh.SendKeys "Test abc"
>>> >
>>> > it works to focus notepad every time
>>> >
>>> > but only once in a while do the sendkeys work, what am I doing wrong?
>>> >
>>> > Thanks,
>>> >
>>> > Tom
>>> > _______________________________________________
>>> > use-livecode mailing list
>>> > use-livecode at lists.runrev.com
>>> > Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> > http://lists.runrev.com/mailman/listinfo/use-livecode
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>



More information about the use-livecode mailing list