BattleOfMoonShae Posted March 10, 2006 Share Posted March 10, 2006 Writing a script to calculate bank totals for the day but with the section of script I have pasted below I can not get it to calculate correctly because the mainframe incorps comma's (ie 00,000.00). If I manually remove the comma's from the text file it works perfectly. Can anyone help or give an idea with removing the comma's from the stringstrip. Thanks in advance for taking the time. FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 12) $Dollar1 = StringMid($line, 71, 88) FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 13) $Dollar2 = StringMid($line, 71, 88) FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 14) $Dollar3 = StringMid($line, 71, 88) FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 15) $Dollar4 = StringMid($line, 71, 88) FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 16) $Dollar5 = StringMid($line, 71, 88) FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 17) $Dollar6 = StringMid($line, 71, 88) $Total = Number ($Dollar1+$Dollar2+$Dollar3+$Dollar4+$Dollar5+$Dollar6) Link to comment Share on other sites More sharing options...
greenmachine Posted March 10, 2006 Share Posted March 10, 2006 You can use StringReplace. StringReplace ("this, is, a, string, with, lots, of, commas", ",", "") Put that inside a MsgBox to see how it turns out. Link to comment Share on other sites More sharing options...
ossyconno Posted March 10, 2006 Share Posted March 10, 2006 Writing a script to calculate bank totals for the day but with the section of script I have pasted below I can not get it to calculate correctly because the mainframe incorps comma's (ie 00,000.00). If I manually remove the comma's from the text file it works perfectly. Can anyone help or give an idea with removing the comma's from the stringstrip.Thanks in advance for taking the time.FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 12) $Dollar1 = StringMid($line, 71, 88) FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 13) $Dollar2 = StringMid($line, 71, 88) FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 14) $Dollar3 = StringMid($line, 71, 88) FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 15) $Dollar4 = StringMid($line, 71, 88) FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 16) $Dollar5 = StringMid($line, 71, 88) FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 17) $Dollar6 = StringMid($line, 71, 88) $Total = Number ($Dollar1+$Dollar2+$Dollar3+$Dollar4+$Dollar5+$Dollar6)Here go. Solves your problem with the comma's.Just repeat 2-6 FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 12) $Dollar1 = StringMid($line, 71, 88) $Dollar1 = StringReplace ($Dollar1, ",", " ", " ") $Dollar1 = StringStripWS($Dollar1, 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 10, 2006 Moderators Share Posted March 10, 2006 Here go. Solves your problem with the comma's.Just repeat 2-6 FileWriteLine('file7.txt', ClipGet()) Sleep(250) $line = FileReadLine('file7.txt', 12) $Dollar1 = StringMid($line, 71, 88) $Dollar1 = StringReplace ($Dollar1, ",", " ", " ") $Dollar1 = StringStripWS($Dollar1, 8)That is Case Sense there... and you have a space for that... any particular reason? 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now