Champak Posted October 21, 2008 Share Posted October 21, 2008 Need some help translating this. This is an object enumeration, but how does the "Each" translate into autoit? For Each suppSpeedX In Speeds Call lstSpeeds.AddItem(Str(suppSpeedX.SpeedR) _ + "x" _ + " (" _ + Str(suppSpeedX.Speed) _ + " kbs)" _ ) If (objInfo.WSpeedX = suppSpeedX.Speed) Then lstSpeeds.ListIndex = lstSpeeds.ListCount - 1 End If Next Thanks. Link to comment Share on other sites More sharing options...
Zedna Posted October 21, 2008 Share Posted October 21, 2008 (edited) For suppSpeedX In Speeds lstSpeeds.AddItem(suppSpeedX.SpeedR & "x" & " (" & suppSpeedX.Speed & " kbs)" ) If objInfo.WSpeedX = suppSpeedX.Speed Then lstSpeeds.ListIndex = lstSpeeds.ListCount - 1 End If Next Edited October 21, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Champak Posted October 21, 2008 Author Share Posted October 21, 2008 What you have is what I've tried. So the "Each" and "Str" serve no purpose in the translation? Because I seem to only be getting the last thing/element, or whatever it's called, from the object array. I figured the "Each" would be the defining thing. What this is doing..the VB version..is adding things to a combobox. But it seems like AutoIts enumeration works differently from VBs enumeration. VBs Enumeration seems to work like AutoIts "For $x = 1" style loop. Or am I totally off base here? Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 21, 2008 Share Posted October 21, 2008 What you have is what I've tried. So the "Each" and "Str" serve no purpose in the translation? Because I seem to only be getting the last thing/element, or whatever it's called, from the object array. I figured the "Each" would be the defining thing. What this is doing..the VB version..is adding things to a combobox. But it seems like AutoIts enumeration works differently from VBs enumeration. VBs Enumeration seems to work like AutoIts "For $x = 1" style loop. Or am I totally off base here? Do you have an object reference in $1stSpeeds that has an .AddItem method while in AutoIt? Zedna didn't show any conversion to AutoIt variable syntax. Maybe something like: #include <GuiComboBox.au3> Global $1stSpeed; Contains handle to combo control... Global $1stSpeedCount; Contains count of items in combo ; ... For $suppSpeedX In $Speeds _GUICtrlComboBox_AddString($1stSpeed, String($suppSpeedX.SpeedR * $suppSpeedX.Speed) & "kbs") Next $1stSpeedCount = _GUICtrlComboBox_GetCount($1stSpeed) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Champak Posted October 22, 2008 Author Share Posted October 22, 2008 (edited) Good thought, but I have actually been using consolewrite. I went ahead and tried _GUICtrlComboBox_AddString() anyway, but I get the same result. EDIT: It is always the simple things. I went ahead and put a slight sleep in the loop, which I really shouldn't have to do, and that worked. Thanks to both for the effort. Edited October 22, 2008 by Champak Link to comment Share on other sites More sharing options...
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