Grax Posted May 22, 2008 Posted May 22, 2008 Is there anyway in AutoIT to do Custom Data Types? I'm wanting to do something like this VB code: Type SettingInfo AppID As String CurrentPath As String UserName As String Password As String ExpirationDate As Date UsageCount As Integer AccessLevel As Integer AllowChanges As Boolean End Type Dim Settings As SettingInfo Settings.AppID = "Something" Settings.CurrentPath ="C:\Something\"
nobbe Posted May 23, 2008 Posted May 23, 2008 no , but as a workaround you could use 1dimensional array autoit doesnt distinguish variables, so "$i" can be integer or string or array... it becomes what you set it up to..
enaiman Posted May 23, 2008 Posted May 23, 2008 From all your code it will remain only: Dim $AppID, $CurrentPath, $UserName, $Password, $ExpirationDate, $UsageCount, $AccessLevel, $AllowChanges $AppID = "Something" $CurrentPath ="C:\Something\" As nobbe pointed out - every of these variables can hold anything: now $AppID holds a string and if your next command is $AppID = 55 + 45 you will see that the new value is 100 which is a number. I don't feel I lose anything with this variable behaviour. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
nobbe Posted May 23, 2008 Posted May 23, 2008 another idea may be to setup variable names with prefix soType SettingInfo AppID As String CurrentPath As String UserName As String Password As String ExpirationDate As Date UsageCount As Integer AccessLevel As Integer AllowChanges As BooleanEnd Typecould be $SettingInfo_AppID =" 123"$SettingInfo_CurrentPath = "C:\Something\"$SettingInfo_UsageCount = 3and so on .. or you may even more use variables following the "Hungarian notation" to give them better naming structurehttp://en.wikipedia.org/wiki/Hungarian_notationwhich could maybe look like$SettingInfo_sz_AppID =" 123"$SettingInfo_sz_CurrentPath = "C:\Something\"$SettingInfo_i_UsageCount = 3
rasim Posted May 23, 2008 Posted May 23, 2008 From help: Quote In AutoIt there is only one datatype called a Variant. A variant can contain numeric or string data and decides how to use the data depending on the situation it is being used in. For example, if you try and multiply two variants they will be treated as numbers, if you try and concatenate (join) two variants they will be treated as strings.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now