PC Review


Reply
Thread Tools Rate Thread

How do I make the mouse cursor get a value..?

 
 
Internetdomainowner@hotmail.com
Guest
Posts: n/a
 
      20th Jul 2008
Fellow programmers thank you for your time. I need some assistance...
I am trying to figure out how to get the mouse cursor select from text
from a specific x z cord and paste the value in a text box on my
userform. Here is some code I tried...

SetCursorPos 255, 413

Do Until UserForm1.TextBox1.Value = 521
DoEvents
Application.Run "mouscoords"
mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
SendKeys "^C", True
UserForm1.TextBox3.SetFocus
SendKeys "^V", True
mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
SetCursorPos UserForm1.TextBox1.Value, 413
DoEvents
Loop

It doesn't seem to want to work... I'd imagine that this isn't the
best way of doing this but but I'm curious if anyone has gotten
something simlar to work. I was also wondering if it was possible for
Excel VBA to read the value of a mouse cord x z value... Any ideas?
There seems to be alot of brilliant people on this message board so I
look forward to see what the end result is.

Thank you ever so much!
 
Reply With Quote
 
 
 
 
RB Smissaert
Guest
Posts: n/a
 
      20th Jul 2008
I get the feeling there must be a simpler way to do what you want, but this
will get you the mouse coordinates:

Option Explicit
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos _
Lib "user32" (lpPoint As POINTAPI) As Long

Function GetCursorPosition() As Long()

Dim Point As POINTAPI
Dim arr(1 To 2) As Long

GetCursorPos Point

arr(1) = Point.x
arr(2) = Point.y

GetCursorPosition = arr

End Function


Sub test()

Dim arr() As Long

arr = GetCursorPosition()

MsgBox "x " & arr(1) & vbCrLf & _
"y " & arr(2), , "mouse coordinates"

End Sub


RBS


<(E-Mail Removed)> wrote in message
news:64e0d135-1a5f-4a76-bf16-(E-Mail Removed)...
> Fellow programmers thank you for your time. I need some assistance...
> I am trying to figure out how to get the mouse cursor select from text
> from a specific x z cord and paste the value in a text box on my
> userform. Here is some code I tried...
>
> SetCursorPos 255, 413
>
> Do Until UserForm1.TextBox1.Value = 521
> DoEvents
> Application.Run "mouscoords"
> mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
> SendKeys "^C", True
> UserForm1.TextBox3.SetFocus
> SendKeys "^V", True
> mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
> UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
> SetCursorPos UserForm1.TextBox1.Value, 413
> DoEvents
> Loop
>
> It doesn't seem to want to work... I'd imagine that this isn't the
> best way of doing this but but I'm curious if anyone has gotten
> something simlar to work. I was also wondering if it was possible for
> Excel VBA to read the value of a mouse cord x z value... Any ideas?
> There seems to be alot of brilliant people on this message board so I
> look forward to see what the end result is.
>
> Thank you ever so much!


 
Reply With Quote
 
Internetdomainowner@hotmail.com
Guest
Posts: n/a
 
      20th Jul 2008
On Jul 20, 3:00*pm, "RB Smissaert" <bartsmissa...@blueyonder.co.uk>
wrote:
> I get the feeling there must be a simpler way to do what you want, but this
> will get you the mouse coordinates:
>
> Option Explicit
> Private Type POINTAPI
> * x As Long
> * y As Long
> End Type
> Private Declare Function GetCursorPos _
> * * * * * * * * * * * * *Lib "user32" (lpPoint As POINTAPI) As Long
>
> Function GetCursorPosition() As Long()
>
> * Dim Point As POINTAPI
> * Dim arr(1 To 2) As Long
>
> * GetCursorPos Point
>
> * arr(1) = Point.x
> * arr(2) = Point.y
>
> * GetCursorPosition = arr
>
> End Function
>
> Sub test()
>
> * Dim arr() As Long
>
> * arr = GetCursorPosition()
>
> * MsgBox "x " & arr(1) & vbCrLf & _
> * * * * *"y " & arr(2), , "mouse coordinates"
>
> End Sub
>
> RBS
>
> <Internetdomainow...@hotmail.com> wrote in message
>
> news:64e0d135-1a5f-4a76-bf16-(E-Mail Removed)...
>
>
>
> > Fellow programmers thank you for your time. I need some assistance...
> > I am trying to figure out how to get the mouse cursor select from text
> > from a specific x z cord and paste the value in a text box on my
> > userform. Here is some code I tried...

>
> > SetCursorPos 255, 413

>
> > Do Until UserForm1.TextBox1.Value = 521
> > DoEvents
> > Application.Run "mouscoords"
> > mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
> > SendKeys "^C", True
> > UserForm1.TextBox3.SetFocus
> > SendKeys "^V", True
> > mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
> > UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
> > SetCursorPos UserForm1.TextBox1.Value, 413
> > DoEvents
> > Loop

>
> > It doesn't seem to want to work... I'd imagine that this isn't the
> > best way of doing this but but I'm curious if anyone has gotten
> > something simlar to work. I was also wondering if it was possible for
> > Excel VBA to read the value of a mouse cord x z value... Any ideas?
> > There seems to be alot of brilliant people on this message board so I
> > look forward to see what the end result is.

>
> > Thank you ever so much!- Hide quoted text -

>
> - Show quoted text -


Thank you for your reply however, I'm already aware of how to get the
X Z cords... what I'm looking for it to do is select a range of text
in a given x z cordinate -- then copy it. My macro is programmed do
this but for whatever reason it's not. The process is explained
below...

'------------------- STARTING POSISTION OF HIGHLIGHT TEXT
SetCursorPos 255, 413
'------------------- END POSISTION OF TEXT is equal to 521, 413
Do Until UserForm1.TextBox1.Value = 521
DoEvents
'------------------- Grabs the current X Z values
Application.Run "mouscoords"
'------------------- LEFT CLICK THE MOUSE BUTTON
mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
'------------------- COPY THE CURRENT LETTER HIGHLIGHTED
SendKeys "^C", True
'------------------- SETFOCUS TO THE OUTPUT TEXT BOX ON THE USERFORM
UserForm1.TextBox3.SetFocus
'------------------- PASTE THE COPIED VALUE
SendKeys "^V", True
'------------------- RELEASE THE LEFT MOUSE CLICK
mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
'------------------- +1 to the X value so the cursor moves again
UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
'------------------- NEW CURSOR POSISTION
SetCursorPos UserForm1.TextBox1.Value, 413
'------------------- REPEAT THE WHOLE PROCESS OVER AGAIN
DoEvents
Loop
 
Reply With Quote
 
RB Smissaert
Guest
Posts: n/a
 
      20th Jul 2008
Well, you asked:
if it was possible for Excel VBA to read the value of a mouse cord x z
value...

I am sure what you want is possible, but it looks messy to me, particularly
Sendkeys, which
really should be your very last option. What situation in practical terms
are you trying to solve?

RBS


<(E-Mail Removed)> wrote in message
news:b2a9b358-b0ab-4811-9f7e-(E-Mail Removed)...
On Jul 20, 3:00 pm, "RB Smissaert" <bartsmissa...@blueyonder.co.uk>
wrote:
> I get the feeling there must be a simpler way to do what you want, but
> this
> will get you the mouse coordinates:
>
> Option Explicit
> Private Type POINTAPI
> x As Long
> y As Long
> End Type
> Private Declare Function GetCursorPos _
> Lib "user32" (lpPoint As POINTAPI) As Long
>
> Function GetCursorPosition() As Long()
>
> Dim Point As POINTAPI
> Dim arr(1 To 2) As Long
>
> GetCursorPos Point
>
> arr(1) = Point.x
> arr(2) = Point.y
>
> GetCursorPosition = arr
>
> End Function
>
> Sub test()
>
> Dim arr() As Long
>
> arr = GetCursorPosition()
>
> MsgBox "x " & arr(1) & vbCrLf & _
> "y " & arr(2), , "mouse coordinates"
>
> End Sub
>
> RBS
>
> <Internetdomainow...@hotmail.com> wrote in message
>
> news:64e0d135-1a5f-4a76-bf16-(E-Mail Removed)...
>
>
>
> > Fellow programmers thank you for your time. I need some assistance...
> > I am trying to figure out how to get the mouse cursor select from text
> > from a specific x z cord and paste the value in a text box on my
> > userform. Here is some code I tried...

>
> > SetCursorPos 255, 413

>
> > Do Until UserForm1.TextBox1.Value = 521
> > DoEvents
> > Application.Run "mouscoords"
> > mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
> > SendKeys "^C", True
> > UserForm1.TextBox3.SetFocus
> > SendKeys "^V", True
> > mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
> > UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
> > SetCursorPos UserForm1.TextBox1.Value, 413
> > DoEvents
> > Loop

>
> > It doesn't seem to want to work... I'd imagine that this isn't the
> > best way of doing this but but I'm curious if anyone has gotten
> > something simlar to work. I was also wondering if it was possible for
> > Excel VBA to read the value of a mouse cord x z value... Any ideas?
> > There seems to be alot of brilliant people on this message board so I
> > look forward to see what the end result is.

>
> > Thank you ever so much!- Hide quoted text -

>
> - Show quoted text -


Thank you for your reply however, I'm already aware of how to get the
X Z cords... what I'm looking for it to do is select a range of text
in a given x z cordinate -- then copy it. My macro is programmed do
this but for whatever reason it's not. The process is explained
below...

'------------------- STARTING POSISTION OF HIGHLIGHT TEXT
SetCursorPos 255, 413
'------------------- END POSISTION OF TEXT is equal to 521, 413
Do Until UserForm1.TextBox1.Value = 521
DoEvents
'------------------- Grabs the current X Z values
Application.Run "mouscoords"
'------------------- LEFT CLICK THE MOUSE BUTTON
mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
'------------------- COPY THE CURRENT LETTER HIGHLIGHTED
SendKeys "^C", True
'------------------- SETFOCUS TO THE OUTPUT TEXT BOX ON THE USERFORM
UserForm1.TextBox3.SetFocus
'------------------- PASTE THE COPIED VALUE
SendKeys "^V", True
'------------------- RELEASE THE LEFT MOUSE CLICK
mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
'------------------- +1 to the X value so the cursor moves again
UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
'------------------- NEW CURSOR POSISTION
SetCursorPos UserForm1.TextBox1.Value, 413
'------------------- REPEAT THE WHOLE PROCESS OVER AGAIN
DoEvents
Loop

 
Reply With Quote
 
Internetdomainowner@hotmail.com
Guest
Posts: n/a
 
      20th Jul 2008
On Jul 20, 5:21*pm, "RB Smissaert" <bartsmissa...@blueyonder.co.uk>
wrote:
> Well, you asked:
> if it was possible for Excel VBA to read the value of a mouse cord x z
> value...
>
> I am sure what you want is possible, but it looks messy to me, particularly
> Sendkeys, which
> really should be your very last option. What situation in practical terms
> are you trying to solve?
>
> RBS
>
> <Internetdomainow...@hotmail.com> wrote in message
>
> news:b2a9b358-b0ab-4811-9f7e-(E-Mail Removed)...
> On Jul 20, 3:00 pm, "RB Smissaert" <bartsmissa...@blueyonder.co.uk>
> wrote:
>
>
>
>
>
> > I get the feeling there must be a simpler way to do what you want, but
> > this
> > will get you the mouse coordinates:

>
> > Option Explicit
> > Private Type POINTAPI
> > x As Long
> > y As Long
> > End Type
> > Private Declare Function GetCursorPos _
> > Lib "user32" (lpPoint As POINTAPI) As Long

>
> > Function GetCursorPosition() As Long()

>
> > Dim Point As POINTAPI
> > Dim arr(1 To 2) As Long

>
> > GetCursorPos Point

>
> > arr(1) = Point.x
> > arr(2) = Point.y

>
> > GetCursorPosition = arr

>
> > End Function

>
> > Sub test()

>
> > Dim arr() As Long

>
> > arr = GetCursorPosition()

>
> > MsgBox "x " & arr(1) & vbCrLf & _
> > "y " & arr(2), , "mouse coordinates"

>
> > End Sub

>
> > RBS

>
> > <Internetdomainow...@hotmail.com> wrote in message

>
> >news:64e0d135-1a5f-4a76-bf16-(E-Mail Removed)...

>
> > > Fellow programmers thank you for your time. I need some assistance...
> > > I am trying to figure out how to get the mouse cursor select from text
> > > from a specific x z cord and paste the value in a text box on my
> > > userform. Here is some code I tried...

>
> > > SetCursorPos 255, 413

>
> > > Do Until UserForm1.TextBox1.Value = 521
> > > DoEvents
> > > Application.Run "mouscoords"
> > > mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
> > > SendKeys "^C", True
> > > UserForm1.TextBox3.SetFocus
> > > SendKeys "^V", True
> > > mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
> > > UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
> > > SetCursorPos UserForm1.TextBox1.Value, 413
> > > DoEvents
> > > Loop

>
> > > It doesn't seem to want to work... I'd imagine that this isn't the
> > > best way of doing this but but I'm curious if anyone has gotten
> > > something simlar to work. I was also wondering if it was possible for
> > > Excel VBA to read the value of a mouse cord x z value... Any ideas?
> > > There seems to be alot of brilliant people on this message board so I
> > > look forward to see what the end result is.

>
> > > Thank you ever so much!- Hide quoted text -

>
> > - Show quoted text -

>
> Thank you for your reply however, I'm already aware of how to get the
> X Z cords... what I'm looking for it to do is select a range of text
> in a given x z cordinate -- then copy it. My macro is programmed do
> this but for whatever reason it's not. The process is explained
> below...
>
> '------------------- STARTING POSISTION OF HIGHLIGHT TEXT
> SetCursorPos 255, 413
> '------------------- END POSISTION OF TEXT is equal to 521, 413
> Do Until UserForm1.TextBox1.Value = 521
> DoEvents
> '------------------- Grabs the current X Z values
> Application.Run "mouscoords"
> '------------------- LEFT CLICK THE MOUSE BUTTON
> mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
> '------------------- COPY THE CURRENT LETTER HIGHLIGHTED
> SendKeys "^C", True
> '------------------- SETFOCUS TO THE OUTPUT TEXT BOX ON THE USERFORM
> UserForm1.TextBox3.SetFocus
> '------------------- PASTE THE COPIED VALUE
> SendKeys "^V", True
> '------------------- RELEASE THE LEFT MOUSE CLICK
> mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
> '------------------- +1 to the X value so the cursor moves again
> UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
> '------------------- NEW CURSOR POSISTION
> SetCursorPos UserForm1.TextBox1.Value, 413
> '------------------- REPEAT THE WHOLE PROCESS OVER AGAIN
> DoEvents
> Loop- Hide quoted text -
>
> - Show quoted text -


The applications of code that does this endless... versus a normal
webquery imagine if you were able to read the value of text on any
program that doesn't normally allow you to copy it. Or if it was
possible having this as an option for websites that use frames (which
makes it so that a normal excel webquery doesn't work).

I got the program to select the text on a basic website but I can't
seem to get it to copy the text after it's highlighted...

Private Sub CommandButton1_Click()
SetCursorPos 255, 413 ' 552, 357

DoEvents
Application.Run "mouscoords"
mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
Do Until UserForm1.TextBox1.Value = 521
UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 5
SetCursorPos UserForm1.TextBox1.Value, 413
DoEvents
Loop

SendKeys "^C", True

mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
UserForm1.Spreadsheet1.ActiveCell.Paste

End Sub
 
Reply With Quote
 
RB Smissaert
Guest
Posts: n/a
 
      20th Jul 2008
Ah, you want the text from an external application!
In that case do some Googling for the SendMessage API and WM_GETTEXT.

RBS


<(E-Mail Removed)> wrote in message
news:59edd0b4-71c6-4600-aa71-(E-Mail Removed)...
On Jul 20, 5:21 pm, "RB Smissaert" <bartsmissa...@blueyonder.co.uk>
wrote:
> Well, you asked:
> if it was possible for Excel VBA to read the value of a mouse cord x z
> value...
>
> I am sure what you want is possible, but it looks messy to me,
> particularly
> Sendkeys, which
> really should be your very last option. What situation in practical terms
> are you trying to solve?
>
> RBS
>
> <Internetdomainow...@hotmail.com> wrote in message
>
> news:b2a9b358-b0ab-4811-9f7e-(E-Mail Removed)...
> On Jul 20, 3:00 pm, "RB Smissaert" <bartsmissa...@blueyonder.co.uk>
> wrote:
>
>
>
>
>
> > I get the feeling there must be a simpler way to do what you want, but
> > this
> > will get you the mouse coordinates:

>
> > Option Explicit
> > Private Type POINTAPI
> > x As Long
> > y As Long
> > End Type
> > Private Declare Function GetCursorPos _
> > Lib "user32" (lpPoint As POINTAPI) As Long

>
> > Function GetCursorPosition() As Long()

>
> > Dim Point As POINTAPI
> > Dim arr(1 To 2) As Long

>
> > GetCursorPos Point

>
> > arr(1) = Point.x
> > arr(2) = Point.y

>
> > GetCursorPosition = arr

>
> > End Function

>
> > Sub test()

>
> > Dim arr() As Long

>
> > arr = GetCursorPosition()

>
> > MsgBox "x " & arr(1) & vbCrLf & _
> > "y " & arr(2), , "mouse coordinates"

>
> > End Sub

>
> > RBS

>
> > <Internetdomainow...@hotmail.com> wrote in message

>
> >news:64e0d135-1a5f-4a76-bf16-(E-Mail Removed)...

>
> > > Fellow programmers thank you for your time. I need some assistance...
> > > I am trying to figure out how to get the mouse cursor select from text
> > > from a specific x z cord and paste the value in a text box on my
> > > userform. Here is some code I tried...

>
> > > SetCursorPos 255, 413

>
> > > Do Until UserForm1.TextBox1.Value = 521
> > > DoEvents
> > > Application.Run "mouscoords"
> > > mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
> > > SendKeys "^C", True
> > > UserForm1.TextBox3.SetFocus
> > > SendKeys "^V", True
> > > mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
> > > UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
> > > SetCursorPos UserForm1.TextBox1.Value, 413
> > > DoEvents
> > > Loop

>
> > > It doesn't seem to want to work... I'd imagine that this isn't the
> > > best way of doing this but but I'm curious if anyone has gotten
> > > something simlar to work. I was also wondering if it was possible for
> > > Excel VBA to read the value of a mouse cord x z value... Any ideas?
> > > There seems to be alot of brilliant people on this message board so I
> > > look forward to see what the end result is.

>
> > > Thank you ever so much!- Hide quoted text -

>
> > - Show quoted text -

>
> Thank you for your reply however, I'm already aware of how to get the
> X Z cords... what I'm looking for it to do is select a range of text
> in a given x z cordinate -- then copy it. My macro is programmed do
> this but for whatever reason it's not. The process is explained
> below...
>
> '------------------- STARTING POSISTION OF HIGHLIGHT TEXT
> SetCursorPos 255, 413
> '------------------- END POSISTION OF TEXT is equal to 521, 413
> Do Until UserForm1.TextBox1.Value = 521
> DoEvents
> '------------------- Grabs the current X Z values
> Application.Run "mouscoords"
> '------------------- LEFT CLICK THE MOUSE BUTTON
> mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
> '------------------- COPY THE CURRENT LETTER HIGHLIGHTED
> SendKeys "^C", True
> '------------------- SETFOCUS TO THE OUTPUT TEXT BOX ON THE USERFORM
> UserForm1.TextBox3.SetFocus
> '------------------- PASTE THE COPIED VALUE
> SendKeys "^V", True
> '------------------- RELEASE THE LEFT MOUSE CLICK
> mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
> '------------------- +1 to the X value so the cursor moves again
> UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
> '------------------- NEW CURSOR POSISTION
> SetCursorPos UserForm1.TextBox1.Value, 413
> '------------------- REPEAT THE WHOLE PROCESS OVER AGAIN
> DoEvents
> Loop- Hide quoted text -
>
> - Show quoted text -


The applications of code that does this endless... versus a normal
webquery imagine if you were able to read the value of text on any
program that doesn't normally allow you to copy it. Or if it was
possible having this as an option for websites that use frames (which
makes it so that a normal excel webquery doesn't work).

I got the program to select the text on a basic website but I can't
seem to get it to copy the text after it's highlighted...

Private Sub CommandButton1_Click()
SetCursorPos 255, 413 ' 552, 357

DoEvents
Application.Run "mouscoords"
mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
Do Until UserForm1.TextBox1.Value = 521
UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 5
SetCursorPos UserForm1.TextBox1.Value, 413
DoEvents
Loop

SendKeys "^C", True

mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
UserForm1.Spreadsheet1.ActiveCell.Paste

End Sub

 
Reply With Quote
 
Internetdomainowner@hotmail.com
Guest
Posts: n/a
 
      21st Jul 2008
On Jul 20, 6:01*pm, "RB Smissaert" <bartsmissa...@blueyonder.co.uk>
wrote:
> Ah, you want the text from an external application!
> In that case do some Googling for the SendMessage API and WM_GETTEXT.
>
> RBS
>
> <Internetdomainow...@hotmail.com> wrote in message
>
> news:59edd0b4-71c6-4600-aa71-(E-Mail Removed)...
> On Jul 20, 5:21 pm, "RB Smissaert" <bartsmissa...@blueyonder.co.uk>
> wrote:
>
>
>
>
>
> > Well, you asked:
> > if it was possible for Excel VBA to read the value of a mouse cord x z
> > value...

>
> > I am sure what you want is possible, but it looks messy to me,
> > particularly
> > Sendkeys, which
> > really should be your very last option. What situation in practical terms
> > are you trying to solve?

>
> > RBS

>
> > <Internetdomainow...@hotmail.com> wrote in message

>
> >news:b2a9b358-b0ab-4811-9f7e-(E-Mail Removed)....
> > On Jul 20, 3:00 pm, "RB Smissaert" <bartsmissa...@blueyonder.co.uk>
> > wrote:

>
> > > I get the feeling there must be a simpler way to do what you want, but
> > > this
> > > will get you the mouse coordinates:

>
> > > Option Explicit
> > > Private Type POINTAPI
> > > x As Long
> > > y As Long
> > > End Type
> > > Private Declare Function GetCursorPos _
> > > Lib "user32" (lpPoint As POINTAPI) As Long

>
> > > Function GetCursorPosition() As Long()

>
> > > Dim Point As POINTAPI
> > > Dim arr(1 To 2) As Long

>
> > > GetCursorPos Point

>
> > > arr(1) = Point.x
> > > arr(2) = Point.y

>
> > > GetCursorPosition = arr

>
> > > End Function

>
> > > Sub test()

>
> > > Dim arr() As Long

>
> > > arr = GetCursorPosition()

>
> > > MsgBox "x " & arr(1) & vbCrLf & _
> > > "y " & arr(2), , "mouse coordinates"

>
> > > End Sub

>
> > > RBS

>
> > > <Internetdomainow...@hotmail.com> wrote in message

>
> > >news:64e0d135-1a5f-4a76-bf16-(E-Mail Removed)....

>
> > > > Fellow programmers thank you for your time. I need some assistance....
> > > > I am trying to figure out how to get the mouse cursor select from text
> > > > from a specific x z cord and paste the value in a text box on my
> > > > userform. Here is some code I tried...

>
> > > > SetCursorPos 255, 413

>
> > > > Do Until UserForm1.TextBox1.Value = 521
> > > > DoEvents
> > > > Application.Run "mouscoords"
> > > > mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
> > > > SendKeys "^C", True
> > > > UserForm1.TextBox3.SetFocus
> > > > SendKeys "^V", True
> > > > mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
> > > > UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
> > > > SetCursorPos UserForm1.TextBox1.Value, 413
> > > > DoEvents
> > > > Loop

>
> > > > It doesn't seem to want to work... I'd imagine that this isn't the
> > > > best way of doing this but but I'm curious if anyone has gotten
> > > > something simlar to work. I was also wondering if it was possible for
> > > > Excel VBA to read the value of a mouse cord x z value... Any ideas?
> > > > There seems to be alot of brilliant people on this message board soI
> > > > look forward to see what the end result is.

>
> > > > Thank you ever so much!- Hide quoted text -

>
> > > - Show quoted text -

>
> > Thank you for your reply however, I'm already aware of how to get the
> > X Z cords... what I'm looking for it to do is select a range of text
> > in a given x z cordinate -- then copy it. My macro is programmed do
> > this but for whatever reason it's not. The process is explained
> > below...

>
> > '------------------- STARTING POSISTION OF HIGHLIGHT TEXT
> > SetCursorPos 255, 413
> > '------------------- END POSISTION OF TEXT is equal to 521, 413
> > Do Until UserForm1.TextBox1.Value = 521
> > DoEvents
> > '------------------- Grabs the current X Z values
> > Application.Run "mouscoords"
> > '------------------- LEFT CLICK THE MOUSE BUTTON
> > mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
> > '------------------- COPY THE CURRENT LETTER HIGHLIGHTED
> > SendKeys "^C", True
> > '------------------- SETFOCUS TO THE OUTPUT TEXT BOX ON THE USERFORM
> > UserForm1.TextBox3.SetFocus
> > '------------------- PASTE THE COPIED VALUE
> > SendKeys "^V", True
> > '------------------- RELEASE THE LEFT MOUSE CLICK
> > mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
> > '------------------- +1 to the X value so the cursor moves again
> > UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 1
> > '------------------- NEW CURSOR POSISTION
> > SetCursorPos UserForm1.TextBox1.Value, 413
> > '------------------- REPEAT THE WHOLE PROCESS OVER AGAIN
> > DoEvents
> > Loop- Hide quoted text -

>
> > - Show quoted text -

>
> The applications of code that does this endless... versus a normal
> webquery imagine if you were able to read the value of text on any
> program that doesn't normally allow you to copy it. Or if it was
> possible having this as an option for websites that use frames (which
> makes it so that a normal excel webquery doesn't work).
>
> I got the program to select the text on a basic website but I can't
> seem to get it to copy the text after it's highlighted...
>
> Private Sub CommandButton1_Click()
> SetCursorPos 255, 413 ' 552, 357
>
> DoEvents
> Application.Run "mouscoords"
> mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&
> Do Until UserForm1.TextBox1.Value = 521
> UserForm1.TextBox1.Value = UserForm1.TextBox1.Value + 5
> SetCursorPos UserForm1.TextBox1.Value, 413
> DoEvents
> Loop
>
> SendKeys "^C", True
>
> mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
> UserForm1.Spreadsheet1.ActiveCell.Paste
>
> End Sub- Hide quoted text -
>
> - Show quoted text -


I can't seem to get this work or even grasp the concept of
WM_GETWINDOWTEXT.. I'm looking to get the selected text only not
everything. I appreciate your responce...


Thanks!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I make the cursor change on mouse click? Mike Windows XP Help 1 31st Jan 2009 09:02 AM
How to make a program which would move the mouse cursor,click and so on... marko svaco Microsoft VB .NET 0 17th Jun 2006 03:03 PM
So nobody knows how to make a custom mouse cursor, eh? Peter Oliphant Microsoft VC .NET 6 4th Jun 2006 08:57 PM
app to make mouse cursor jump to default button in dialog boxes? asdf Freeware 5 19th Oct 2005 10:51 PM
Can you make an image/object follow the mouse cursor? =?Utf-8?B?YW5vbnltb3VzbWU=?= Microsoft Powerpoint 1 14th Jan 2005 10:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:28 PM.