Jump to content

Remove "empty" space from end off a line


Joppe
 Share

Recommended Posts

Hello

I`m making a small script at work. Never done this before, so going slowly. I have made a Gui, were i paste in some information that we get on mail. The mail system that we use on work makes an anyoing blank space after the last charachter on each line. This is again causing some trouble when i use the information.

Say i get John Smith on a line , and im gonna use that line to make an email adress, it comes out like a invalid email adress for me :

John.Smith @gmail.com

So im wondering is there anyway to remove that "blank" space after the end of each line ? Can`t post all my code as it getting pretty big , but here i what i use to put the information into a .txt file, It may be this can be done when extracting the info from the file after also , as i said im no expert ;p

Do

$Msg = GuiGetMsg()

If $msg = $GenKnapp Then

GuiSetState(@SW_DISABLE,$WinMain)

$s_Adbrukernavn = GuiCtrlRead($Adbrukernavn)

$s_LdapPass = GuiCtrlRead($LdapPass)

$s_EditText = GuiCtrlRead($EditText)

$s_Adidle = GuiCtrlRead($Adidle)

$s_Adtimeout = GuiCtrlRead($Adtimeout)

GuiSetState(@SW_ENABLE,$WinMain)

$lagring = FileOpen("mail.txt",2)

If $lagring = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Return

EndIf

FileWrite($lagring, $s_EditText)

FileClose($lagring)

Opprett()

EndIf

If $KunMailKnapp Then

; Email()

EndIf

If $msg = $AvsluttKnapp Then

Exit

EndIf

Until $msg = $GUI_EVENT_CLOSE;

EndFunc

Link to comment
Share on other sites

  • Moderators

StringStripWs

Or

If StringRight($sText, 1) = " " Then $sText = StringTrimRight($sText, 1)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...