Skorm92 Posted November 11, 2014 Posted November 11, 2014 So, Im trying to let my software create a label for each user found Current Code: $defaultfriendsize = "67" For $i = 1 To $onlinevriendraw[0] ;MsgBox($MB_SYSTEMMODAL, "test", "online: " & $onlinevriendraw[$i]) MsgBox(64, "test2", $onlinevriendraw[$i]) $usernumber = +1 GUICtrlCreateLabel($onlinevriendraw[$i], 5, $usernumber*$defaultfriendsize, 195, 35) Next EndIf The software pulls the Username and Userid in a string (Username,1 - OtherUsername,2) The msgbox puts out the retreived data fine, However when I want to create a label for each it creates them all on the same spot... (with the code above I hoped it would calculate a different position for each [$i] found) Other than that, I wanted to split the Username from the ID by using stringsplit For $i = 1 To $onlinevriendraw[0] $onlinevriend = $onlinevriendraw[$i] For $i = 1 To $onlinevriend[0] $onlineuser = StringSplit($onlinevriend[$i], ",") MsgBox(64, "SplStr Test", $onlineuser[$i]) Next It only returns the first one, as in $onlinevriendraw[1] How can I achive to create a unique label position for each user found, and also split their data by using "," to split? Thank you very much in Advance!
Luigi Posted November 11, 2014 Posted November 11, 2014 (edited) maybe this? $defaultfriendsize = StringSplit("67", "") ; if you use ',', then StringSplit("67", ",") For $i = 1 To $onlinevriendraw[0] ;MsgBox($MB_SYSTEMMODAL, "test", "online: " & $onlinevriendraw[$i]) MsgBox(64, "test2", $onlinevriendraw[$i]) $usernumber = +1 GUICtrlCreateLabel($onlinevriendraw[$i], 5, $usernumber*$defaultfriendsize, 195, 35) Next EndIf Edited November 11, 2014 by Detefon Visit my repository
MikahS Posted November 11, 2014 Posted November 11, 2014 (edited) We're going to need more than just a couple snippets of code. A reproducer or your full script will help us help you out immensely. EDIT: As you can see, people are shooting from the hip. Edited November 11, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
mikell Posted November 11, 2014 Posted November 11, 2014 (edited) GUICtrlCreateLabel($onlinevriendraw[$i], 5, $i*$defaultfriendsize, 195, 35) BTW : $usernumber = +1 => $usernumber += 1 Edited November 11, 2014 by mikell
Skorm92 Posted November 11, 2014 Author Posted November 11, 2014 (edited) maybe this? $defaultfriendsize = StringSplit("67", "") ; if you use ',', then StringSplit("67", ",") For $i = 1 To $onlinevriendraw[0] ;MsgBox($MB_SYSTEMMODAL, "test", "online: " & $onlinevriendraw[$i]) MsgBox(64, "test2", $onlinevriendraw[$i]) $usernumber = +1 GUICtrlCreateLabel($onlinevriendraw[$i], 5, $usernumber*$defaultfriendsize, 195, 35) Next EndIf GUICtrlCreateLabel($onlinevriendraw[$i], 5, $i*$defaultfriendsize, 195, 35) BTW : $usernumber = +1 => $usernumber += 1 Somewhat of a combination of these worked for me, Thank you! For the split string, The output given now is First Label: Username, ID1 Label x pixels below it: Username2, ID2 I want to split the ID from the username to show with @CRLF below it. So the end result would be: First Label: Username, ID1 ID1 Label x pixels below it: Username2 ID2 But again, If I use stringsplit on "$onlinevriendraw[$i]" it only splits the first entry ([1]) and creates a label for it. The others are not showing up. Edited November 11, 2014 by Skorm92
jdelaney Posted November 11, 2014 Posted November 11, 2014 (edited) For $i = 1 To $onlinevriendraw[0] $onlinevriend = $onlinevriendraw[$i] For $i = 1 To $onlinevriend[0] $onlineuser = StringSplit($onlinevriend[$i], ",") MsgBox(64, "SplStr Test", $onlineuser[$i]) Next If you have a loop within a loop, make sure the itterators are unique...the second For loop can use something like $j (or anothing NOT = $i) Not a fix for your issue, just something that popped out at me. Edited November 11, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
mikell Posted November 11, 2014 Posted November 11, 2014 (edited) Something like this ? For $i = 1 To $onlinevriendraw[0] $onlineuser = StringSplit($onlinevriendraw[$i], ",") ; MsgBox(64, "SplStr Test", $onlineuser[1] & @crlf & $onlineuser[2]) GUICtrlCreateLabel($onlineuser[1], 5, $i*70, 195, 35) GUICtrlCreateLabel($onlineuser[2], 5, $i*70+35, 195, 35) Next Edited November 11, 2014 by mikell
Solution Skorm92 Posted November 16, 2014 Author Solution Posted November 16, 2014 GUICtrlCreateLabel($onlinevriendraw[$i], 5, 28+$i*$defaultfriendsize, 195, 35) Turned out to be the solution, Thank you for the support!
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