Jump to content
Sign in to follow this  

Remove "empty" space from end off a line

Recommended Posts


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


$Msg = GuiGetMsg()

If $msg = $GenKnapp Then


$s_Adbrukernavn = GuiCtrlRead($Adbrukernavn)

$s_LdapPass = GuiCtrlRead($LdapPass)

$s_EditText = GuiCtrlRead($EditText)

$s_Adidle = GuiCtrlRead($Adidle)

$s_Adtimeout = GuiCtrlRead($Adtimeout)


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

If $lagring = -1 Then

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



FileWrite($lagring, $s_EditText)




If $KunMailKnapp Then

; Email()


If $msg = $AvsluttKnapp Then



Until $msg = $GUI_EVENT_CLOSE;


Share this post

Link to post
Share on other sites



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.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...