Jump to content

Calculating


Recommended Posts

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

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

  • Moderators

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

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