Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Buttons to output strings to cursor focus

Reply
 
Old 09-09-2009   #1 (permalink)
mocha99


 
 

Buttons to output strings to cursor focus

Hi all

I need to create a window or little dashboards with buttons, if I click
on a button this should output a string of text (associated with that
button) to wherever the cursor is blinking at the moment I click
(without loosing the focus).

Is thta possible?

Any example?

Thanks

My System SpecsSystem Spec
Old 09-10-2009   #2 (permalink)
Tom Lavedas


 
 

Re: Buttons to output strings to cursor focus

On Sep 9, 7:15*pm, mocha99 <moch...@xxxxxx> wrote:
Quote:

> Hi all
>
> I need to create a window or little dashboards with buttons, if I click
> on a button this should output a string of text (associated with that
> button) to wherever the cursor is blinking at the moment I click
> (without loosing the focus).
>
> Is thta possible?
>
> Any example?
>
> Thanks
I think this does what you want. Save it as an HTA (hypertext
application) file ...

<html>
<script language="vbscript">
dim oWSHShell

sub initiate
set oWSHShell = createobject("wscript.shell")
end sub

sub droptext
txtwdw.focus
oWSHShell.Sendkeys window.event.srcElement.title
end sub

</script>
<body onload=initiate>
<input id=btn1 type=button value="Text 1"
title="Text Item 1" onclick=droptext>&nbsp;
<input id=btn2 type=button value="Text 2"
title="Text Item 2" onclick=droptext>&nbsp;
<input id=btn3 type=button value="Text 3"
title="Text Item 3" onclick=droptext><br>
<textarea id=txtwdw cols=72 rows=20></textarea>
</body>
</html>
_____________________
Tom Lavedas
My System SpecsSystem Spec
Old 09-10-2009   #3 (permalink)
tzuc


 
 

Re: Buttons to output strings to cursor focus

OK Tom, thanks a lot for your time and help!!!
Quote:

> I believe it might be possible to wrap the example HTA around a frame
> that displays the target web page. In that case, it might be possible
> (if IE8 is not loaded) to then send the information from the buttons
> into the web page at the previously referenced cursor location.
> Unfortunately, I am moments away from leaving on vacation, so I can't
> go any further with this, sorry. Maybe someone else will be
> interested in taking up the challenge.
> _____________________
> Tom Lavedas
My System SpecsSystem Spec
Old 09-10-2009   #4 (permalink)
mocha99


 
 

Re: Buttons to output strings to cursor focus

Hi,

thanks a lot for the code. It doesnt exactly do what i need though...

I'd need something that, while the cursor is blinking in any field in a
web page (like in form) enables me to automatically fill in that field
by pressing a button. The page where the curso is blinking is a web page
that is not the same where the button is (it is a web page that I do not
provide, i.e. a web page that I browse to on the internet).

Can this be done?

Thanks alot

Tom Lavedas wrote:
Quote:

> On Sep 9, 7:15 pm, mocha99 <moch...@xxxxxx> wrote:
Quote:

>> Hi all
>>
>> I need to create a window or little dashboards with buttons, if I click
>> on a button this should output a string of text (associated with that
>> button) to wherever the cursor is blinking at the moment I click
>> (without loosing the focus).
My System SpecsSystem Spec
Old 09-10-2009   #5 (permalink)
Tom Lavedas


 
 

Re: Buttons to output strings to cursor focus

On Sep 10, 10:37*am, mocha99 <moch...@xxxxxx> wrote:
Quote:

> Hi,
>
> thanks a lot for the code. It doesnt exactly do what i need though...
>
> I'd need something that, while the cursor is blinking in any field in a
> web page (like in form) enables me to automatically fill in that field
> by pressing a button. The page where the curso is blinking is a web page
> that is not the same where the button is (it is a web page that I do not
> provide, i.e. a web page that I browse to on the internet).
>
> Can this be done?
>
> Thanks alot
>
> Tom Lavedas wrote:
Quote:

> > On Sep 9, 7:15 pm, mocha99 <moch...@xxxxxx> wrote:
Quote:

> >> Hi all
>
Quote:
Quote:

> >> I need to create a window or little dashboards with buttons, if I click
> >> on a button this should output a string of text (associated with that
> >> button) to wherever the cursor is blinking at the moment I click
> >> (without loosing the focus).
The same technique "might" be made to work in that situation, IF (and
it's a big if) some means of knowing which was the target window for
the insertion. I don't know of a way to get that information -
besides entering it into the application that contains the buttons.
That is, in script, there is really no way to know where the mouse
came from once the mouse leaves the target window and clicks on the
app with the buttons (at least not AFAIK). This means, the button app
doesn't know where to send its information.

I believe it might be possible to wrap the example HTA around a frame
that displays the target web page. In that case, it might be possible
(if IE8 is not loaded) to then send the information from the buttons
into the web page at the previously referenced cursor location.
Unfortunately, I am moments away from leaving on vacation, so I can't
go any further with this, sorry. Maybe someone else will be
interested in taking up the challenge.
_____________________
Tom Lavedas
My System SpecsSystem Spec
Old 09-10-2009   #6 (permalink)
Al Dunbar


 
 

Re: Buttons to output strings to cursor focus


"Tom Lavedas" <tglbatch@xxxxxx> wrote in message
news:69c070cc-1e7d-4d39-9648-90f86698a46c@xxxxxx
Quote:

> On Sep 9, 7:15 pm, mocha99 <moch...@xxxxxx> wrote:
Quote:

>> Hi all
>>
>> I need to create a window or little dashboards with buttons, if I click
>> on a button this should output a string of text (associated with that
>> button) to wherever the cursor is blinking at the moment I click
>> (without loosing the focus).
>>
>> Is thta possible?
>>
>> Any example?
>>
>> Thanks
>
> I think this does what you want. Save it as an HTA (hypertext
> application) file ...
LOL, his answer was in his question: "is tHTA possible?"

/Al
Quote:

> <html>
> <script language="vbscript">
> dim oWSHShell
>
> sub initiate
> set oWSHShell = createobject("wscript.shell")
> end sub
>
> sub droptext
> txtwdw.focus
> oWSHShell.Sendkeys window.event.srcElement.title
> end sub
>
> </script>
> <body onload=initiate>
> <input id=btn1 type=button value="Text 1"
> title="Text Item 1" onclick=droptext>&nbsp;
> <input id=btn2 type=button value="Text 2"
> title="Text Item 2" onclick=droptext>&nbsp;
> <input id=btn3 type=button value="Text 3"
> title="Text Item 3" onclick=droptext><br>
> <textarea id=txtwdw cols=72 rows=20></textarea>
> </body>
> </html>
> _____________________
> Tom Lavedas


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
controlling cursor position or other way to control placement of output to screen PowerShell
cursor keyboard touch pad very sensitive and cursor bounces around Vista General
Mouse cursor freezes but focus moves on Vista Ultimate x64 Vista General
crazy cursor - cursor keeps bouncing back form certain clickable a Vista performance & maintenance
working with strings PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46