Sign in to follow this  
Followers 0
PickPocketz

Looping Through Combinations

9 posts in this topic

Hi Guys and Gals,

I'm attempting to write a script that will give me an output of all the possible combinations of a predifined set. For example I have five letters "P, K, R, A, W" that I want to run through and get every last combination from it.

Such as if I had then numbers 0, 1, 2 and a 3 digit combination I would have Twenty Seven different outcomes ranging from 000, 001 - 221, 222.

I wouldn't have a problem if I were ok with having repeated outcomes or writing a long list of code but I do not want repeats and I want to eventually set up a GUI based system to accept Alpha & Alphanumeric characters of any length and do what I am looking for now.

This is the basic layout I have:

#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <StaticConstants.au3>
Const $title = "Combinator"
Global $wX = 300, $wY = 25
Local $array[5] = ["P", "K", "R", "A", "W"]
GUICreate($title, $wX, $wY)
GUICtrlCreateLabel("COMBINATIONS", 5, 5, $wX - 10, $wY - 10, $SS_CENTER)
GUISetState()
While 1

$msg = GUIGetMsg()

Select
case $msg = $GUI_EVENT_CLOSE
  Exit
EndSelect

WEnd
Func _generate()

;Combo Loop

Sleep(5000) ;Allow Time to See Combination

EndFunc

Share this post


Link to post
Share on other sites



I just now realized what this is looking like and I apologize in advance. I am in no means attempting to make some sort of keygen or something along those lines. I was playing a game where a user would constantly have to ask "PKR" or "PKRAW" (P2P, Kik, Rev, Auto, Watch) and thought to myself what word could I come up with using those letters that would look natural in the english language. I then thought "well hell might as well use my love for AutoIt to figure it out for me". I know I have a unique thought process haha.

Share this post


Link to post
Share on other sites

Sorry, but the forum frowns upon game automation discussions. I realise that you are not trying to automate a game, but you are trying to cheat in a game which also, is not to be discussed in a forum. Unfortunately for you, I had almost submitted the answer and then I remembered playing text twist trying to figure out a problem with flash.

Just a hint - if you want to cheat in games, find another forum. Otherwise, dont try and discuss cheating.

Share this post


Link to post
Share on other sites

Sorry, but the forum frowns upon game automation discussions. I realise that you are not trying to automate a game, but you are trying to cheat in a game which also, is not to be discussed in a forum. Unfortunately for you, I had almost submitted the answer and then I remembered playing text twist trying to figure out a problem with flash.

Just a hint - if you want to cheat in games, find another forum. Otherwise, dont try and discuss cheating.

I definatly understand.

I'm not trying to do anything directly with this game which is Habbo Hotel http://www.habbohotel.com. I just became curious with the combination possibilities and have been looking for different ideas to use AutoIt. If I were and I am not saying I am trying use this in some sort of way in this game the most I could do is spam in the chat. In all honesty if I were to work on something to manipulate a game in any way it would be in secret and I would not give anyone the opportunity to become an accessory to this. Again I do apologize for what this looks like but please believe me it is only a personal interest and another way to work on my skills in programming AutoIt.

If you have any doubt my username is Pickpocketz in game and feel free to report me if you believe I am not playing with integrity.

Share this post


Link to post
Share on other sites

I just now realized what this is looking like and I apologize in advance. I am in no means attempting to make some sort of keygen or something along those lines. I was playing a game where a user would constantly have to ask "PKR" or "PKRAW" (P2P, Kik, Rev, Auto, Watch) and thought to myself what word could I come up with using those letters that would look natural in the english language. I then thought "well hell might as well use my love for AutoIt to figure it out for me". I know I have a unique thought process haha.

You're digging a hole for yourself here. Anyway I believe you. The function _ArrayCombinations should do the job.

Share this post


Link to post
Share on other sites

You're digging a hole for yourself here. Anyway I believe you. The function _ArrayCombinations should do the job.

I mean I don't know how to justify myself otherwise... The language has the ability to do so and if that were my interest I wouldn't be so naive as to ask for help on scripting something technically illegal. I don't know what to say except thank you for the help you actually are the only one that gave me advice on my first post (This being the second one.)

Share this post


Link to post
Share on other sites

Your mathematical calculations about how many combinations you would have is incorrect.

Look up Recursive Functions. Might leave a reply later with something I can come up with.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@ PickPocketz You don't have to justify everything. The question you asked is a very general one about something mathematical. Just stick to the question. If there's anything suspicious about a person's post then people will ask what the script is for. As I see it, you have always asked acceptable questions which don't break any forum rules.

Edited by czardas

Share this post


Link to post
Share on other sites

Ok, well then if that is the case and this is about trivial knowledge and not cheating, then that's alright.

I would expect it would be just a basic for loop inside a for loop, hopefully.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • Patryk
      By Patryk
      Dear Colleagues,
      I have no idea how to refer to style.display in my loop. There is a button like: 
      <input name="ctl00$bodyPlaceholder$btnFecharProcessamento" class="button" id="bodyPlaceholder_btnFecharProcessamento" style="display: none;" onclick="FecharJanelaProcessamento();return false;" type="submit" value="Fechar"> I want it to be clicked as soon as button's style change from style="display: none;" to  style= ="display: inline-block;" 
      This is what I got, but it's not working...
      Func GetButtons() $oButtons = _IEGetObjByName($oForm,"ctl00$bodyPlaceholder$btnFecharProcessamento",-1) $i = 0 While $i <> 1 For $oBtn In $oButtons If _IEFormElementGetValue($oBtn) = "Fechar" And $oBtn.document.style.display = "display: inline-block;" Then $i = 1 _IEAction($oBtn, "focus") _IEAction($oBtn, "click") ExitLoop EndIf Next WEnd EndFunc  
      I will really appreciate if you could help me with these loop!
    • Nareshm
      By Nareshm
      How to repeat my script when my control class does not match ?
       
      My Script : winActivate ( " PS :: Version - 2.2.0.0  - [PS Bill]")                   ControlClick ( "PS :: Version - 2.2.0.0  - [PS Bill]", "", "[NAME:btnSavebyFP]")                   ControlSend(" PS :: Version - 2.2.0.0  - [PS Bill]", "", "[NAME:btnSavebyFP]", "{enter}")                   WinActive ("Verification Number Entry ::")                   ControlClick("Next >", "","[NAME:btnNext]") ;if   >>>> Control <<<<  does not match repeat my script, ;if match exit script  

      Class:    WindowsForm734a
      Instance:    15
      ClassnameNN:    WindowsForm34a15
      Name:    BillPrint
      Advanced (Class):    [NAME:BillPrint]
      ID:    7875
      Text:    
      Position:    39, 310
      Size:    1221, 306
      ControlClick Coords:    745, 20
      Style:    0x56010000
      ExStyle:    0x00000000
      Handle:    0x00000000000C0468
    • SkysLastChance
      By SkysLastChance
      I am not sure why I am getting the this error on my second pass of the code.
      1 - $oWorkbook is not an object or not a workbook object
      Any help or advice on my code appreciated. 
      #include <Excel.au3> #include <Array.au3> #include <MsgBoxConstants.au3> Global $sExcelFile1 = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "(*.xlsm)") Global $sExcelFile2 = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "Excel Sheet (*.xlsx;*.xls)|All (*.*)") Global $vRow = 2 If FileExists($sExcelFile2) Then Global $oExcel2 = _Excel_Open () $oExcel2 = _Excel_BookOpen($oExcel2,$sExcelFile2) EndIF If FileExists($sExcelFile1) Then Global $oExcel1 = _Excel_Open () $oExcel1 = _Excel_BookOpen($oExcel1,$sExcelFile1,Default,Default,"2007") EndIF $oRead = _Excel_RangeRead ($oExcel2,"Untitled","A2",3) $oFind = _Excel_RangeFind ($oExcel1,$oRead,"E4:FD92",Default,$xlWhole) $Clip = _ArrayToClip($oFind,"",0,0,"",2,2) Send("{ScrollLock Off}") $hWnd = WinWait("[CLASS:XLMAIN]") ControlSend($hWnd, "", "", ("^g")) WinWait("[CLASS:bosa_sdm_XL9]") ; Go To ControlSend($hWnd, "", "", ("^v")) ControlSend($hWnd, "", "", ("{Enter}")) ControlSend($hWnD, "", "", "{Down " & $vRow & "}") Do $oTime = _Excel_RangeRead ($oExcel2,"Untitled","B2",3) If @error Then Exit MsgBox(0, "Error", "Error" & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox(0,"Test",$oTime) IF $oTime = "7:10:00 AM" Then $oCalls1 = _Excel_RangeRead ($oExcel2,Default,"C" & $vRow,3) $oCalls2 = _Excel_RangeRead ($oExcel2,Default,"D" & $vRow,3) ControlSend($hWnd, "", "", $oCalls1) ControlSend($hWnd, "", "", ("{RIGHT}")) ControlSend($hWnd, "", "", $oCalls2) $vRow = $vRow + 1 ContinueLoop Else $vRow = $vRow + 1 EndIf Until $vRow = 4 1.xlsm
      2.xlsx
    • IamKJ
      By IamKJ
      So I have a lot of different functions in the little program I'm making.  Most of them use the Do statement, such as finding images, clicking buttons, etc.
       
      The question I have is how would I be able to both
      1) Create a hotkey to pause whatever I am doing at the moment.  If I have to put something into every function in the program, I don't mind.
      2) Create a hotkey to exit whatever I am doing and stop all loops or commands and bring back the main GUI?
    • chacoya121
      By chacoya121
      HotKeySet("{Esc}", "_exit") Run("notepad.exe") WinWaitActive("") Sleep(500) $Letter = StringSplit("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9", ",") Combi("", 5) Func Combi($Str, $MaxLen) Dim $i if StringLen($Str) = $MaxLen Then Send("Combination = " & $Str & @CRLF) ; Sleep(50) Return EndIf For $i = 1 to $Letter[0] Combi($Str & $Letter[$i], $MaxLen) Next EndFunc Func _exit() Exit EndFunc  
      can someone help add code to this script to make generate combination
      3 letters with 2 numbers
      instead of
      AAAAA
      AAAAB
      AAAAC
       
      start at
      AAA01
      AAA02
      AAA03
      skiping the 2 letters