| View previous topic :: View next topic |
| Author |
Message |
MCPBecker
Joined: 02 Nov 2009 Posts: 4 Location: Seattle
|
Posted: Mon Nov 02, 2009 10:54 pm Post subject: Search for string at beginning of my script |
|
|
I'm totally new, so please bear with me. I have searched this community for a solution to this very simple problem, but I can't find what I need.
I have a simple script that does a cut and paste operation to move part of a line of text to another location. In this case it is from normal text to a popup in an HTML Help application. The part I have done is to select the text starting from a cursor location to the end of the line, and then use keystrokes to open the pull-down menus to place this text in the popup. This part all works fine.
What I can't figure out how to do is to search the line of text for the character where the text cutting begins. I don't want to do a whole file full at once, because I want to take a second to check that everything looks right before going on to the next line.
The code is attached. All I need is to add a search function for the » character at the beginning of the script.
| Code: | #x::
Send, {RIGHT}{SHIFTDOWN}{END}{SHIFTUP}{CTRLDOWN}x{CTRLUP}{SHIFTDOWN}{LEFT}{SHIFTUP}{ALTDOWN}d{ALTUP}e{CTRLDOWN}a{CTRLUP}{CTRLDOWN}v{CTRLUP} |
_________________ M Becker |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2431
|
|
| Back to top |
|
 |
MCPBecker
Joined: 02 Nov 2009 Posts: 4 Location: Seattle
|
Posted: Tue Nov 03, 2009 12:14 am Post subject: |
|
|
Text document. _________________ M Becker |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2431
|
Posted: Tue Nov 03, 2009 12:22 am Post subject: |
|
|
Well » isn't a non-typical character so you should be able to search the document with it well enough. Are you attempting to copy everything after the » or just certain text? If you're using Notepad to view text files here's an idea:
| Code: | ControlGetText, var, Edit1, ahk_class Notepad
MsgBox % SubStr(var,InStr(var,"»")+1) ; should display everything after the '»' |
For reference:
ControlGetText
InStr()
SubStr() _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
MCPBecker
Joined: 02 Nov 2009 Posts: 4 Location: Seattle
|
Posted: Tue Nov 03, 2009 5:00 pm Post subject: |
|
|
Hmmm.... Well, this does something, but not quite what I need. Here's what my script does for me. It's ridiculously simple:
| Code: | Send,
{RIGHT]{SHIFTDOWN}{END}{SHIFTUP} ;Moves the cursor one character right and selects everthing from the cursor position to the end of the line.
{CTRLDOWN}x{CTRLUP} ;Cuts selected text to the clipboard.
{SHIFTDOWN}{LEFT}{SHIFTUP} ;Selects the character to the left of the cursor position.
{ALTDOWN}d{ALTUP} ;Opens a menu in my application.
e ; Selects an item from the menu that opens an editor box.
{CTRLDOWN}a{CTRLUP} ;Selects the example text in the editor box.
{CTRLDOWN}v{CTRLUP} ;Pastes the clipboard text into the editor box.
|
All I really need to do is to get the cursor from where it is in the document to the next instance of the character ».
I use this kind of script very often, so if I could get one example down, I'd be set for life.  _________________ M Becker |
|
| Back to top |
|
 |
MCPBecker
Joined: 02 Nov 2009 Posts: 4 Location: Seattle
|
Posted: Tue Nov 03, 2009 11:36 pm Post subject: |
|
|
I figured out how to make this work. It was too simple. _________________ M Becker |
|
| Back to top |
|
 |
|