Sign in to follow this  
Followers 0
estemarito

How to select specific text?

6 posts in this topic

Hi, I'm new at AutoIt, and I must say that AutoIt is Amazing!

but I have only one problem.

How can I select specific text in notepad?

select from "here" to "here2" (the underlined text)

ej:

Julius Caesar is probably one of the most popular Roman military of all time. With him, casting the foundations for the future Roman Empire. But Caesar's military career would be boosted by an indisputable fact that led him to obtain great wealth and increase his personal prestige far.

"HERE"

For any Roman military to annex new territories, then the Roman Republic, led to great privileges, titles and power ... very powerful. Caesar, a military and political career with a good chance of promotion

"HERE2"

thanks and greetings!

Share this post


Link to post
Share on other sites



I was looking for information on StringRegExp, and got the following code:

#Include <String.au3>
$Text = FileRead("email.txt")
$EmailFound = StringRegExp($Text, "([A-Za-z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})", 3)
If @error = 1 Then
    MsgBox(0, "E-Mail", "No E-Mail addressess found in the supplied text")
Else
    For $i = 0 To UBound($EmailFound) - 1
        MsgBox(0, "E-Mail", $EmailFound[$i])
    Next
EndIf

But this works only for e-mails... I need that works for any text

any idea?

Share this post


Link to post
Share on other sites

Please, i need some help whith this.

is only select X text between A and B

and copy to clipboard.

plz..

Share this post


Link to post
Share on other sites

estemarito,

We expect you to do some work for yourself here. Just posting a script you found on the forum does not qualify as "work". :(

However, wnat you want is very simple. And as I have some time to spare, here is how you do what you want. Put your complete text into Notepad and run this: :)

#Include <String.au3>

; Activate Notepad
WinActivate("Untitled - Notepad")
WinWaitActive("Untitled - Notepad")

; Get the text from Notepad
$sText = ControlGetText("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]")
; And display it
MsgBox(0, "Notepad text", $sText)

; Set UNIQUE start and end points for your extract
$sStart = "For any "
$sEnd = " promotion."

; Extract the extract
$aExtract = _StringBetween($sText, $sStart, $sEnd)

; Add back the start and end strings
$sExtract = $sStart & $aExtract[0] & $sEnd
; And display it
MsgBox(0, "Extract", $sExtract)

; Put the extract on the clipboard
ClipPut($sExtract)

But remember, the next time you ask for help, we will expect you to have made much more effort to solve your problem by yourself first. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thank you very much Melba23 and Volly.

Please understand that just 2 days ago I found autoit. I know php, html and many other languages, but recently I'm starting with autoit. again, thank you very much. the script worked perfectly

sry my english, i use traductor.,..

Share this post


Link to post
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
Sign in to follow this  
Followers 0