Jump to content

Find/Replace in an Edit control


WFC
 Share

Recommended Posts

Is there any way to do a Find/Replace in an Edit control? If so I haven't found it.

Also, is there any way to get a Printer Dialog/Setup? The print function in AutoIt appears to use the NotePad print function since I can set up a printer there and my program will use it. It would be nice if I could set it up without going through Notepad.

Thirdly, I downloaded a script and attempted to compile it and got the error:

GUICtrlCreateActiveX(): undefined function.

Is that function still under developement? I am using the lasted beta.

WFC

Link to comment
Share on other sites

yes

guictrlread() ; read the edit

stringinstring() ; find your search

stringreplace() ; replace that string

guictrlsetdata() ; replace the data in the edit

8)

That will certainly replace the string. What I had in mind was a popup that would allow you to enter a search string and a replace string. When you hit OK it finds the text in the editor , highlights the string found and gives you the option of replacing it or search for the next instance of the search string. Even being able to search for the string, place the cursor on it and scroll to it would be nice.

WFC

Link to comment
Share on other sites

The GuiEdit set of UDFs contains some functions that might help you out. Look in the help file section "User Defined Functions" and then "GuiEdit Management". In particular, _GUICtrlEditSetSel and _GUICtrlEditReplaceSel could be useful for a search/replace interface.

Link to comment
Share on other sites

The GuiEdit set of UDFs contains some functions that might help you out. Look in the help file section "User Defined Functions" and then "GuiEdit Management". In particular, _GUICtrlEditSetSel and _GUICtrlEditReplaceSel could be useful for a search/replace interface.

doesnt that do a "Line" at a time??

8)

NEWHeader1.png

Link to comment
Share on other sites

The GuiEdit set of UDFs contains some functions that might help you out. Look in the help file section "User Defined Functions" and then "GuiEdit Management". In particular, _GUICtrlEditSetSel and _GUICtrlEditReplaceSel could be useful for a search/replace interface.

For what the user is wanting to do, it would be easier to create your own udf that does the functions that Valuator posted (might want to check your spelling on those functions tho).

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

doesnt that do a "Line" at a time??

I'm not entirely sure what you mean, but both of those functions deal with absolute character positions. I was thinking of doing a StringInStr on a GUICtrlRead and using the result in a _GUICtrlEditSetSel for the "search" part of the problem, then following it up with _GUICtrlEditReplaceSel for the "replace" part. This is all thought experiments, though, so it may or may not actually work the way I'm thinking it will.

Of course, with Gafrost's handy UDF, the point is rather moot. :o

Edited by Sokko
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...