ChrisL Posted May 15, 2009 Share Posted May 15, 2009 I want to make an array 10000 elements long it needs to go aa ab ac ad etc etc then aaa aba aca ada etc etc aab abb acb adb etc etc I can't get my head around what I need to do... any ideas? #include <Array.au3> $alphabet = "abcdefghijklmnopqrstuvwxyz" $aLeters = StringSplit($alphabet,"") Local $aStrings[10001]=[0] $iLoop = 0 $iLoopCnt = 0 For $l = 1 to 10000 For $i = 1 to $aLeters[0] For $iT = 1 to $aLeters[0] $aStrings[0] +=1 If $aStrings[0] > 10000 then Exitloop(3) $aStrings[$aStrings[0]] = $aLeters[$i] & StringRight($aLeters[$iT],1) Next $aLeters[$i] &= StringRight($aLeters[$i],1) Next Next _ArraySort($aStrings) _ArrayDisplay($aStrings) [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
martin Posted May 15, 2009 Share Posted May 15, 2009 (edited) I want to make an array 10000 elements long it needs to go aa ab ac ad etc etc then aaa aba aca ada etc etc aab abb acb adb etc etc I can't get my head around what I need to do... any ideas? #include <Array.au3> $alphabet = "abcdefghijklmnopqrstuvwxyz" $aLeters = StringSplit($alphabet,"") Local $aStrings[10001]=[0] $iLoop = 0 $iLoopCnt = 0 For $l = 1 to 10000 For $i = 1 to $aLeters[0] For $iT = 1 to $aLeters[0] $aStrings[0] +=1 If $aStrings[0] > 10000 then Exitloop(3) $aStrings[$aStrings[0]] = $aLeters[$i] & StringRight($aLeters[$iT],1) Next $aLeters[$i] &= StringRight($aLeters[$i],1) Next Next _ArraySort($aStrings) _ArrayDisplay($aStrings) Does this work? #include <Array.au3> $alphabet = "abcdefghijklmnopqrstuvwxyz" $aLeters = StringSplit($alphabet,"") Local $aStrings[10001] $aStrings[0] = 0 $iLoop = 0 $iLoopCnt = 0 For $l = 1 to 10000/25 For $iT = 1 to $aLeters[0] $aStrings[0] +=1 If $aStrings[0] > 10000 then Exitloop(2) if $aStrings[0] > 26 Then $aStrings[$aStrings[0]] = $aStrings[($aStrings[0]-1)/26 ] & $aLeters[$iT] Else $aStrings[$aStrings[0]] = $aLeters[$iT] EndIf Next Next ;_ArraySort($aStrings) _ArrayDisplay($aStrings) EDIT: Sorry ChrisL, I see it doesn't, I was aiming for the wrong thing. I'll look again. EDIT2: Maybe it is if its like this #include <Array.au3> $alphabet = "abcdefghijklmnopqrstuvwxyz" $aLeters = StringSplit($alphabet,"") Local $aStrings[10001] $aStrings[0] = 0 $iLoop = 0 $iLoopCnt = 0 For $l = 1 to 10000/25 For $iT = 1 to $aLeters[0] $aStrings[0] +=1 If $aStrings[0] > 10000 then Exitloop(2) if $aStrings[0] > 26 Then $aStrings[$aStrings[0]] = $aStrings[($aStrings[0]-1)/26 ] & $aLeters[$iT] Else $aStrings[$aStrings[0]] = "a" & $aLeters[$iT] EndIf Next Next ;_ArraySort($aStrings) _ArrayDisplay($aStrings) Edited May 15, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ChrisL Posted May 15, 2009 Author Share Posted May 15, 2009 Thanks Martin!! I'm trying to get round a bug in another application which can't count so I'm replacing numbers by unique alphabetical strings (just in case you were wondering!) [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire 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