Jump to content

How to not paste text if characters are below or above a certain number?


Recommended Posts

So I have this code. It pulls text from a txt file, removes the characters that I want removed, and then pastes the result somewhere:

Local $MyFileLocation = @ScriptDir & "\my.txt"

Local $FuckedUpString = FileRead($MyFileLocation)

Sleep(1000)

Local $FuckedUp2 = $FuckedUpString
Local $Cleaner

Local $Removal[6]
    $Removal[0] = "-"
    $Removal[1] = "_"
    $Removal[2] = "."
    $Removal[3] = ","
    $Removal[4] = " "
    $Removal[5] = "|"

For $i = 0 To UBound($Removal) - 1
    $Cleaner = StringReplace($FuckedUp2,$Removal[$i],"")
    $FuckedUp2 = $Cleaner
Next

Sleep(250)
MouseClick("left",1500,246)
Sleep(250)
MouseClick("left",738,462)
Sleep(250)
Send($Cleaner, 1)

I think this code is very beautiful and easy to understand, anyone can use it :)

What I would like to add to this is, if the result that needs to be pasted (after cleanup) is 4 characters or less, or 7 characters or more, then remove everything, don't paste anything.

I'm coming up empty when searching. Not sure how complicated this would be to implement. If anyone can help I'd appreciate it.

Thanks

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...