vbscript sendkeys()

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

vbscript sendkeys()

Geoff Canyon via use-livecode
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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: vbscript sendkeys()

Geoff Canyon via use-livecode
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 <[hidden email]>, 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: vbscript sendkeys()

Geoff Canyon via use-livecode
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 <
[hidden email]> 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 <
> [hidden email]>, 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
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: vbscript sendkeys()

Geoff Canyon via use-livecode
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 <[hidden email]> 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 <
> [hidden email]> 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 <
>> [hidden email]>, 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
>> > [hidden email]
>> > Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> > http://lists.runrev.com/mailman/listinfo/use-livecode
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: vbscript sendkeys()

Geoff Canyon via use-livecode
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 <[hidden email]> 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 <[hidden email]> 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 <
>> [hidden email]> 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 <
>>> [hidden email]>, 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
>>> > [hidden email]
>>> > Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> > http://lists.runrev.com/mailman/listinfo/use-livecode
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

RE: vbscript sendkeys()

Geoff Canyon via use-livecode
You could "ping" a nonexistent IP with a repeat of 1 and a timeout of x
seconds.

Ralph DiMola
IT Director
Evergreen Information Services
[hidden email]


-----Original Message-----
From: use-livecode [mailto:[hidden email]] On Behalf
Of Tom Glod via use-livecode
Sent: Saturday, October 13, 2018 1:06 AM
To: How to use LiveCode
Cc: Tom Glod
Subject: Re: vbscript sendkeys()

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 <[hidden email]> 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 <[hidden email]> 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 <
>> [hidden email]> 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 <
>>> [hidden email]>, 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
>>> > [hidden email]
>>> > Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> > http://lists.runrev.com/mailman/listinfo/use-livecode
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: vbscript sendkeys()

Geoff Canyon via use-livecode
ya wow..i guess there are many ways of creating a wait...... i've actually
resolved this by using livecode's wait instead of vb.... it happens
automatically as part of a function now so i never have to think about
delay again.

thanks for the suggestion

On Sat, Oct 13, 2018 at 4:23 PM Ralph DiMola via use-livecode <
[hidden email]> wrote:

> You could "ping" a nonexistent IP with a repeat of 1 and a timeout of x
> seconds.
>
> Ralph DiMola
> IT Director
> Evergreen Information Services
> [hidden email]
>
>
> -----Original Message-----
> From: use-livecode [mailto:[hidden email]] On
> Behalf
> Of Tom Glod via use-livecode
> Sent: Saturday, October 13, 2018 1:06 AM
> To: How to use LiveCode
> Cc: Tom Glod
> Subject: Re: vbscript sendkeys()
>
> 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 <[hidden email]> 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 <[hidden email]> 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 <
> >> [hidden email]> 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 <
> >>> [hidden email]>, 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
> >>> > [hidden email]
> >>> > Please visit this url to subscribe, unsubscribe and manage your
> >>> subscription preferences:
> >>> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >>> _______________________________________________
> >>> use-livecode mailing list
> >>> [hidden email]
> >>> Please visit this url to subscribe, unsubscribe and manage your
> >>> subscription preferences:
> >>> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>>
> >>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode