Jack023 Posted December 26, 2013 Share Posted December 26, 2013 Hey all, Is it possible to do $label15 like + 1 ? so it will be $label16 after the do loop , so each time +1? expandcollapse popupElse $day = $serverdayfinal Do $statistics = "" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", $statistics, 0) $oHTTP.Send() $txt = $oHTTP.Responsetext $strip1 = _StringStripChars($txt, '{"date "[bnr_clicksimpressionscomplioncrcpmol_nlnc,hquv}:') FileWrite("test1234.txt", $strip1) Local $fileopen = FileOpen("test1234.txt") $date = FileReadLine($fileopen, 4) $banner_clicks = FileReadLine($fileopen, 5) $banner_impressions = FileReadLine($fileopen, 6) $ctr = FileReadLine($fileopen, 8) $ecpm = FileReadLine($fileopen, 9) $totalbalance = FileReadLine($fileopen, 10) $total_clicks = FileReadLine($fileopen, 11) $error_impressions = FileReadLine($fileopen, 12) $totalhits = FileReadLine($fileopen, 13) $totalimpes = FileReadLine($fileopen, 14) $totalreq = FileReadLine($fileopen, 15) $videoclicks = FileReadLine($fileopen, 16) $video_impressions = FileReadLine($fileopen, 17) $video_test1 = FileReadLine($fileopen, 18) $video_test2 = FileReadLine($fileopen, 19) $video_test3 = FileReadLine($fileopen, 20) $video_t1 = StringTrimLeft($video_test1, 1) $video_t2 = StringTrimLeft($video_test2, 1) $video_t3 = StringTrimLeft($video_test3, 1) $date1 = GUICtrlSetData($Label15, $serveryearfinal & "-" & $servermonthfinal & "-" & $serverdayfinal) $req1 = GUICtrlSetData($Label19, $totalreq) $impres1 = GUICtrlSetData($Label23, $totalimpes) $clicks1 = GUICtrlSetData($Label27, $total_clicks) $ctr1 = GUICtrlSetData($Label31, $ctr & "%") $eCpm1 = GUICtrlSetData($Label35, "$" & $ecpm) $Earnings1 = GUICtrlSetData($Label39, "$" & $totalbalance) FileClose($fileopen) FileDelete("test1234.txt") $serverdayfinal -= 1 Until $serverdayfinal = $day - 4 Link to comment Share on other sites More sharing options...
iamtheky Posted December 26, 2013 Share Posted December 26, 2013 (edited) set it first, then use it in the command For $i = 15 to 20 $Label = "$Label" & $i msgbox (0, '' , $Label) next Edited December 26, 2013 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
UEZ Posted December 26, 2013 Share Posted December 26, 2013 What is the purpose to increment variables instead of saving the values to e.g. an array? Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
spudw2k Posted December 26, 2013 Share Posted December 26, 2013 @UEZ I think he's trying to fill text boxes. The for loop should work (or an Array as suggested), but you should look up the Execute function if you want to reference controls by generating a string of the same name. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Jack023 Posted December 26, 2013 Author Share Posted December 26, 2013 Well i think i can fix this tommorow, and at end when whole gui is done I'm going to ask how to improve my code to make it faster , thanks for the reply's! Link to comment Share on other sites More sharing options...
UEZ Posted December 26, 2013 Share Posted December 26, 2013 You have to use Assign and Eval: For $i = 15 To 20 Assign("Label" & $i, Random(0, 99, 1)) Next For $i = 15 To 20 ConsoleWrite(Eval("Label" & $i) & @LF) NextBr,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Jack023 Posted December 27, 2013 Author Share Posted December 27, 2013 (edited) Got it working thanks I made arrays of the $labels so i would easily change it haha ! Thanks for the suggestions and help Edited December 27, 2013 by Jack023 Link to comment Share on other sites More sharing options...
iamtheky Posted December 29, 2013 Share Posted December 29, 2013 but you should look up the Execute function if you want to reference controls by generating a string of the same name @Spud - This single post is all I understand about execute (ensuring the type of the resulting variable in other languages, and simply procedural in AutoIt). If you are feeling kind can you explain its role here? Thank you. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
spudw2k Posted December 31, 2013 Share Posted December 31, 2013 (edited) I think execute could be used almost interchangeably with Eval in the example above, but I could be wrong. AFAIK you can use Execute to refer to a variable no matter what type it is...Object, Array, Control, etc. In this very confusing example I use Execute to perform data extraction from any size array. Local $arr[]=["Never","Gonna","Give","You","Up"] ConsoleWrite(_DynEnumArray($arr) & @CRLF) Local $arr[][]=[["Penn", "Teller"],["Gilbert", "Sullivan"],["Sonny", "Cher"],["Stone", "Parker"],["Fischbacher", "Horn"],["Plant", "Page"]] ConsoleWrite(_DynEnumArray($arr) & @CRLF) Local $arr[][][]=[[["All","Your"],["Base","Are"],["Belong","To Us"]],[["Is","This"],["The","Way"],["Back","Home"]]] ConsoleWrite(_DynEnumArray($arr) & @CRLF) Func _DynEnumArray(ByRef $array) If Not IsArray($array) then Return SetError(1,0,"") ;Make sure parameter IsArray Local $aDims[1][2]=[["ElementIdx","ElementCount"]] ;Create an array to track Source array dimensions and elements Local $sArrayContents = "" ;Create empty result string for Source array contents For $iX = 1 to UBound($array,0) ;Get Source array size and save in tracking array ReDim $aDims[$iX+1][2] $aDims[$iX][0]=0 $aDims[$iX][1]=UBound($array,$iX) Next Do ;Loop through Source array elements $var = "" For $iX = 1 to UBound($aDims)-1 ;Build array dimension string $var &= "[" & $aDims[$iX][0] & "]" Next $sArrayContents &= $var & " " & Execute("$array" & $var) & @CRLF ;Evaluate array dimension string and append contents to result string $aDims[UBound($aDims)-1][0] += 1 ;Increment last dimension element in tracking array For $iY = UBound($aDims)-2 To 1 Step -1 ;Increment dimension element in tracking array If $aDims[$iY+1][0] = $aDims[$iY+1][1] Then $aDims[$iY+1][0]=0 $aDims[$iY][0]+=1 EndIf Next Until $aDims[1][0]=$aDims[1][1] ;Loop until Source array element enumeration is complete Return $sArrayContents EndFunc I first learned about Execute >in this thread when I was dealing with using Object properties. Edited January 6, 2022 by spudw2k updated example for clarity and efficiency iamtheky 1 Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
iamtheky Posted December 31, 2013 Share Posted December 31, 2013 Thank you sir, a fine example. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) 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