AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Convert a string to an integer

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Mon Oct 22, 2007 4:15 am    Post subject: Convert a string to an integer Reply with quote

I have a program that uses ControlGetText to get a string from a program. This string is just a number, and I would like to know if it is possible to convert this string to an integer. (string to int).

%string%="23"

Does anyone know how to convert this to an integer that can be used in formulas? Thanks! And sorry about the lack of code -- This is a program I am using at work.

Drarum
Back to top
Jayman



Joined: 21 Oct 2007
Posts: 15

PostPosted: Mon Oct 22, 2007 5:18 am    Post subject: Reply with quote

I "Think" its...

var := string
Back to top
View user's profile Send private message
YMP



Joined: 23 Dec 2006
Posts: 266
Location: Russia

PostPosted: Mon Oct 22, 2007 9:57 am    Post subject: Reply with quote

There's usually no need for any conversion. AutoHotkey will convert it for you automatically.
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6063

PostPosted: Mon Oct 22, 2007 10:07 am    Post subject: Reply with quote

As YMP said... In case you want to remove the leading spaces / zeroes you may += 0 it like follows:

Code:
Str := " 000212"
Str += 0
MsgBox, % Str


Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group