Jump to content

Text to number and divide by a number


Ram
 Share

Recommended Posts

Hi,

I have Text box that can't be copied by mouse or tab. So I was looking at AutoIT Active Window Info. I placed the mouse on the text box of the application found these.

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 416 Y: 167 W: 80 H: 20

Control ID: 18102

ClassNameNN: Static15

Text: $13,668.40

Style: 0x50000002

ExStyle: 0x00000204

Now I would like to get the text value ("Text:$13,668.40) and divide that value by 10 and give out an answer. Is this possible? if so how do I go about doing that?

How do I get this text value?

Please let me know...!!

Thanks!

Edited by Ram
Link to comment
Share on other sites

Alright.. I tried this...

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 416 Y: 167 W: 80 H: 20

Control ID: 18102

ClassNameNN: Static15

Text: $13,668.40

Style: 0x50000002

ExStyle: 0x00000204

$var = ControlGetText("Edit", "", "Static15")
$OutPut = StringRight($var, StringInStr($var, "$") + 1)
Msgbox (0, "test", $OutPut)

I get value after the decimal. "40" in the message box. All I want to trim is "$" how do I go about doing that - and get only the numbers "13,668.40".. How can I get it?

Link to comment
Share on other sites

StringTrimLeft ???

StringTrimLeft can't be used as the number of digits cannot be judged. As it can be more than 8 digits or can be lesser too...!! so need some other solution..!!

Link to comment
Share on other sites

  • Moderators

StringTrimLeft can't be used as the number of digits cannot be judged. As it can be more than 8 digits or can be lesser too...!! so need some other solution..!!

StringReplace()... but seriously, you asked to remove the $ sign (P.S. no need for the incognito on what your doing, think we all get it), so why wouldn't StringTrimLeft(ControlGetText($hPSite, '', $hPControl), 1) not work? Or did you even read what StringTrimLeft did?

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

StringReplace()... but seriously, you asked to remove the $ sign (P.S. no need for the incognito on what your doing, think we all get it), so why wouldn't StringTrimLeft(ControlGetText($hPSite, '', $hPControl), 1) not work? Or did you even read what StringTrimLeft did?

Alright Cool it...!! I didn't put the count value for StringTrinLeft correctly hence it didn't work.... I gave it a try again now.. with the correct count value. It's working fine. The first time. I thought the logic was to trim the text that are from left. i.e if I have value 12345 - trimleft start from 1 then I thought it should give an answer as 1234 triming 5. I think it's the other way round..so I was confused...!!

Now everything is all set.. Thanks Guys!!

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