AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Capture/save highlighted text *WITHOUT* using clipboard?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
rick k
Guest





PostPosted: Tue Jul 14, 2009 1:24 pm    Post subject: Capture/save highlighted text *WITHOUT* using clipboard? Reply with quote

This is to help resolve my other question posted.

Is there a way to capture the contents of highlighted text (text only) and send it to a variable without using the clipboard or ^c ?

Basically the technique I want to employ would see what is highlighted, copy it, and ouput it to a file such as "TEXT.INI" or some equivalent. From there I can grab that text and complete my task.

This should work generically, regardless of what application program is running, and regardless of the window in which the text appears. So I could get text that is highlighted from, say, a browser or Word or Notepad, or anywhere.

Another way of saying this is: can I write a function that will do basically the same thing as ^c but does *not* use Windows clipboard but instead stores the resulting text in an external file?

Thanks for any suggestions.

Rick
Back to top
drmurdoch



Joined: 10 Nov 2006
Posts: 110

PostPosted: Tue Jul 14, 2009 1:30 pm    Post subject: Reply with quote

I didnt want my script to interfere with the windows clipboard, so I saved the clipboard, used the clipboard, then restored the clipboard.
Not sure if that helps you.
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 5043
Location: the tunnel(?=light)

PostPosted: Tue Jul 14, 2009 2:05 pm    Post subject: Reply with quote

It depends on what program you're using but ControlGet, , Selected might work for you if the highlighted text is in an Edit control.
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
rick k
Guest





PostPosted: Tue Jul 14, 2009 2:36 pm    Post subject: Reply with quote

drmurdoch wrote:
I didnt want my script to interfere with the windows clipboard, so I saved the clipboard, used the clipboard, then restored the clipboard.
Not sure if that helps you.


Well, not in this case. I have another program running that takes over full control of the clipboard, which is why I'm looking for another solution to capturing highlighted text.

Thanks,
Rick
Back to top
rick k
Guest





PostPosted: Tue Jul 14, 2009 2:42 pm    Post subject: Reply with quote

sinkfaze wrote:
It depends on what program you're using but ControlGet, , Selected might work for you if the highlighted text is in an Edit control.


I've tried playing with the ControlGet function without success. I don't know what constitutes an "Edit control." If I highlight text in a browser window, will that be accessible? What do I need to do to see if it's an Edit control?

I guess I don't really understand the parameters for ControlGet because I'm not getting anything with the way I have a test script written:

#C::
controlget, myclipboard, selected
MsgBox Win+C variable "myclipboard" now contains: %myclipboard%
return

I'm not sure what I should do.

Thanks,
Rick
Back to top
helpless?
Guest





PostPosted: Wed Jul 15, 2009 12:21 am    Post subject: Reply with quote

rick k wrote:
I don't know what constitutes an "Edit control." If I highlight text in a browser window, will that be accessible? What do I need to do to see if it's an Edit control?

Try using the forum seach functions! How to identify an edit control?

rick k wrote:
I guess I don't really understand the parameters for ControlGet because I'm not getting anything with the way I have a test script written:

Code:
#C::
controlget, myclipboard, selected,,ControlIdentifier,WinTitle
MsgBox Win+C variable "myclipboard" now contains: %myclipboard%
return

rick k wrote:
I'm not sure what I should do.
Try some experiments until you get it working and understand why.
  1. Read the help file and look at the examples.
  2. Open a new notepad window, and select some text, then run this code.
    Code:
    ControlGet, text, selected,, Edit1, Untitled - Notepad
    msgbox, %text%

Now open the help file and make some attempt to understand!

Now, when you understand the basics using the above simple example, only then, try it with your application.
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group