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 

Search for string at beginning of my script

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
MCPBecker



Joined: 02 Nov 2009
Posts: 4
Location: Seattle

PostPosted: Mon Nov 02, 2009 10:54 pm    Post subject: Search for string at beginning of my script Reply with quote

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
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 2431

PostPosted: Mon Nov 02, 2009 11:14 pm    Post subject: Reply with quote

What are you searching? Are you searching the text document itself? Are you searching the Clipboard?
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message
MCPBecker



Joined: 02 Nov 2009
Posts: 4
Location: Seattle

PostPosted: Tue Nov 03, 2009 12:14 am    Post subject: Reply with quote

Text document.
_________________
M Becker
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 2431

PostPosted: Tue Nov 03, 2009 12:22 am    Post subject: Reply with quote

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
View user's profile Send private message
MCPBecker



Joined: 02 Nov 2009
Posts: 4
Location: Seattle

PostPosted: Tue Nov 03, 2009 5:00 pm    Post subject: Reply with quote

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. Very Happy
_________________
M Becker
Back to top
View user's profile Send private message
MCPBecker



Joined: 02 Nov 2009
Posts: 4
Location: Seattle

PostPosted: Tue Nov 03, 2009 11:36 pm    Post subject: Reply with quote

I figured out how to make this work. It was too simple.
_________________
M Becker
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   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