Solved

Developer Studio key to mark a word

Posted on 2004-09-24
7
166 Views
Last Modified: 2012-05-05
From within Developer Studio, I want to create a keystroke that will mark a word. Currently ctrl/shift/left will mark a word but  ctrl/shift/right marks the word plus the spaces to the next word.

Any ideas?
0
Comment
Question by:ESQuicksall
  • 4
  • 3
7 Comments
 
LVL 19

Expert Comment

by:drichards
ID: 12146753
Once again, start off with the macro recorder.  You want to do ctrl-shift-right and then a shift-left to back up if there was a space after the word.  This gets you a start.  Then you need to go edit the macro.  You want to back up until the last selected character is not a space.  It's actually a bit more complicated than that if you really want to do it right because you have to back up until to the last non-whitespace character.  I'll think about this a bit and see what I can come up with.
0
 
LVL 19

Accepted Solution

by:
drichards earned 250 total points
ID: 12146900
How do you want it to behave?  This will select from current position (in word or at start of word) to the end of the word, not including whitespace.  As I use it , though, it doesn't seem particularly useful because the selection can't be extended since it backs up over spaces.  Try it and let me know exactly what behavior you want.  Maybe this is enough to get you on the right track.
------------------------------
Sub SelWordRight()
'DESCRIPTION: A description was not provided.


'Begin Recording
      ActiveDocument.Selection.WordRight dsExtend
      While (Right(ActiveDocument.Selection,1) = " ") Or (Right(ActiveDocument.Selection,1) = vbTab)
            ActiveDocument.Selection.CharLeft dsExtend
      Wend
'End Recording
End Sub
0
 
LVL 19

Expert Comment

by:drichards
ID: 12146933
Two other options:

1) Use the original CTRL-SHIFT-RIGHT and add a macro to back out the whitespace if you want.  This could be assigned to ALT-SHIFT-LEFT or something.
2) Use the macro above and assign it to ALT-SHIFT-RIGHT and choose whether you want CTRL or ALT version of the command.

The trouble is that the software doesn't know whether you want to extend over the whitespace or not.  Somehow youneed to tell it.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:ESQuicksall
ID: 12168615
SelWordRight works perfectly. All I really want is to have a keystroke that does a "double click" on a word (I hate using a mouse). It does extend the selection if I use shift/right.

Also, with your example, I am able to see how to do more things.

Eddy
0
 

Author Comment

by:ESQuicksall
ID: 12168617
Adding more points for a hard problem.
0
 

Author Comment

by:ESQuicksall
ID: 12168854
I'm wondering why the word "Right" is used in the While. It does not seem intuitive because the highlight would be on a blank and not to the "Right".


Eddy
0
 

Author Comment

by:ESQuicksall
ID: 12168941
I'm going to add another one for you (or anyone else if they are knowledgable). It will be called "Making backspace act like rubout if not insert mode".
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now