Thiago Torres
Thiago Torres

Reputation: 11

How do I convert string to interger in AHK

I have this code below and I would like to get a string like "0,0" convert to integer and sum boths variable putting it on a new variable. I was looking for solution in internet but without sucess.

code:

    MouseMove, 238,282
    MouseClickDrag, Left, 238,282, 238,282
    Sleep, 200
    Send, {CTRLDOWN}c{CTRLUP}
    CLIPWAIT, 0.5
    SaldoContabil = %ClipBoard% ; here is getting 0,0
    Sleep, 400

    MouseMove, 602,283
    MouseClickDrag, Left, 602,283, 602,283
    Sleep, 500
    Send, {CTRLDOWN}c{CTRLUP}
    CLIPWAIT, 0.5
    ArredAcumulado = %ClipBoard% ; here is getting 0,0
    Sleep, 400


    baixa = %ArredAcumulado% - %SaldoContabil%

Upvotes: 1

Views: 702

Answers (1)

Yane
Yane

Reputation: 837

Add the following lines before the final calculation.
StrReplace just replaces the , with a . so from 0,0 you get 0.0, no further conversion is necessary.

SaldoContabil := StrReplace(SaldoContabil,",",".")
ArredAcumulado := StrReplace(ArredAcumulado ,",",".")

Upvotes: 2

Related Questions