Sign in to follow this  
Followers 0
BattleOfMoonShae

Calculating

4 posts in this topic

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)

Share this post


Link to post
Share on other sites



You can use StringReplace.

StringReplace ("this, is, a, string, with, lots, of, commas", ",", "")

Put that inside a MsgBox to see how it turns out.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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?

[center]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.[/center]

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