forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Get selected text from various windows

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Mar 07, 2002 12:35 pm    Post subject: Get selected text from various windows Reply with quote

Does anyone know of a way to obtain selected text from a window other
than using @CTRL(C). Sending Ctrl+C to windows has proven to be a bit
wacky because some programs have disabled this shortcut and various
clipboard managers may interfere with it.

Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Thu Mar 07, 2002 1:03 pm    Post subject: Reply with quote

Sure, You will need to find the ID or CLASS number of the edit
box you want to copy from then you can use the following API call.

%q = #Window_Class_Or_Id_Number
%z = @sendmsg(%q,$0301,0,0)

This will copy the text to the clipboard.

You can use the various VDS window functions to find the ID number.

Hope that helped.

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Mar 07, 2002 4:20 pm    Post subject: Reply with quote

Thanks, Chris! I was looking for something like that. However, I am not
retrieving text from edit boxes or GUI controls but rather from text
sections with some text strings high-lighted. I find these a bit hard to
identify, though.

I can make it work fairly good by using @mousepos() + @winatpoint(), like this:
Code:

%%pos = @mousepos(XY)
parse "%%Xpos;%%Ypos",%%pos
%x = @WINATPOINT(%%Xpos,%%Ypos)
%z = @sendmsg(%x,$0301,0,0)


However, this routine fails to work if the user moves the cursor away
from the section holding the selected text string prior to calling my
program. Because then @mousepos() identifies some other window
element.

Is there, by any chance, a more fail-safe way of identifying the element
holding a selected piece of text?

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Thu Mar 07, 2002 8:38 pm    Post subject: Reply with quote

I don't have time to try this but you can try to use the following
API call to get the starting and ending position of the selected
text then have your program resend an api call to reselect the
text and copy it.

@win(~EDIT1) is use to get the control but it can be a
class name or and ID #.

%A = @sendmsg(@win(~EDIT1),$0B0,0,0)
%B = @div(%A,65536)
%C = @diff(%A,@prod(%B,65536))

%B is the starting position and %C is the ending position.

Then the following code will reselect the text from %B to %C
and copy it.

%A = @sendmsg(@win(~EDIT1),$0B1,%B,%C)
%z = @sendmsg(@win(~EDIT1),$0301,0,0)

Give that a try.

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Fri Mar 08, 2002 7:22 am    Post subject: Reply with quote

Thankx. I'll give it a spin today.

Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group