Jump to content

EndGame2013

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by EndGame2013

  1. I will check that out now. And yes the array is sorted in lexicographical order (for those who don't know what that means, think alphabetical for numbers) when it comes out of _ArrayCombinations. I actually don't know what SQLite is. I know what MySQL is and have used it with PHP and AU3. Guess that ones "worth a google" too! Thanks for setting me in the (hopefully) the right direction, both of you! I will update with results. Note: I was finally able to load that text file in notepad last night and finally get a look at all 3.8 millionish combinations, albeit after about 5 minutes of "Not Responding" lockup.
  2. Hmm that's weird. The forum popup thing must not of put it in correctly. I fixed the includes and added the functions. Thx for pointing it out. EDIT: I removed the code for those two functions because they are irrelevant. Random Unique just picks unique random numbers , and array 2d insert just puts an empty row at a specific position and pushes everything else down. I apologize for the long post, I essentially need to figure out a way to optimize the search part. EDIT: Darn it... i just did this: #include <Array.au3> #include <RandUnique.au3> #include <Excel.au3> #include <WinAPI.au3> #include <File.au3> Dim $picks[56] for $i = 0 to 55 $picks[$i] = $i + 1 next ConsoleWrite("Creating regular number wheel..."&@lf) Dim $fullwheel = _ArrayCombinations($Picks, 5, ",") _ArrayDelete($fullwheel, 0) ConsoleWrite("Outputting to Excel..."&@lf) _ArrayToXLS($fullwheel, @ScriptDir & 'temp.xls') ConsoleWrite("Done"&@lf) Which took 52 minutes on my cheap laptop before I realized the maximum rows for excel 2010 is 65536... Does this apply to microsoft excels ability to use that many rows, or is that the max that the is actually written to that file? Can openoffice use more maybe Nevermind I just answered my own question... and Excel can only have about 16 million cells too! The same as the array maximum... Well I hope there isn't a maximum on mysql rows! I suppose I could use a text file to store the data, but how long would it take to load the data and split it into an array? Hopefully faster than creating the combinations initially. Edit: After doing some tests and then some math I found out that running the above script and outputting to and excel sheet takes a little over 52 minutes on my machine. Doing the same thing except outputting to a text file should take 16 minutes. So I will also assume that it will be faster to read from a text file than an excel sheet. *Done making the text file.. which is 55.3 MB... now waiting for it to open in notepad....
  3. Open up ImageSearch.au3 to see what it does. It should be in the includes folder of the autoit folder. After looking at your script I think I see your problem. Looks like image search only looks for something on your desktop, not on your screen unless you "load it" into an "Hbitmap" from what I understand. Here is the description for image search: "$HBMP - optional hbitmap to search in. sending 0 will search the desktop." And here is the demo #include #include $fileA = @ScriptDir & "testa.png" _GDIPlus_Startup() $hImageA =_GDIPlus_ImageLoadFromFile($fileA) ;this is the firefox icon use something else if you don't have it. $hBitmapA = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageA) $x = 0 $y = 0 $result = _ImageSearch($hBitmapA, 1, $x, $y, 20, 0) ;Zero will search against your active screen If $result > 0 Then MouseMove($x, $y) EndIf _GDIPlus_ImageDispose($hImageA) _GDIPlus_Shutdown() I would take your image and do this to it: #include <GDIPlus.au3> $fileA = @ScriptDir & "shot.bmp" _GDIPlus_Startup() $hImageA =_GDIPlus_ImageLoadFromFile($fileA) ;this is your screenshot $hBitmapA = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageA) _GDIPlus_ImageDispose($hImageA) _GDIPlus_Shutdown() ;--------- I imagine that will work... EDIT: After downloading what seems to be the newest imagesearch with DLL, and using the demo.. I can't get it to work either. Even the demo doesn't work. Sorry I couldn't help more!
  4. Summary: I need to know the fastest way to search a very large array. Right now I am using a 2D array which may not be the fastest and restricts me to a lower amount of cells than I need. Some ideas I have had, but do not yet know how to implement, include possibly searching a very large excel sheet or mysql database instead. What is the fastest way of doing this. You can skip down to the code if want or read more if you like Back to working on my lottery simulator/analyzer program. This is what I have so far, please ignore whatever sloppy messes you find. If there is a faster way of doing the search please let me know. The script basicaly allows you to simulate playing the megamillions lottery with however many numbers you want, however many times you want, and see the results. You can even simulate playing a set of numbers a hundred thousand times and see what you would have "won". Kind of fun to see how hard it is to win the jackpot, or anything close! So far its just a good tool to visualize playing thousands of draws of the lottery in just a few minutes. The megamillions game will select 5 numbers out of a pool of 56, and one other number out of a different pool of 46. However with this "system" it is possible to play more than 5/1 numbers. For example if you want to you could play buy 5 tickets all with regular numbers 1 through 5 and each one with a different powerball number 1 through 5. I will not bother to explain the advantages/disadvantages to playing the lottery this way, but I will say that no matter what you do you can not increase your odds of winning in any way aside from buying more than one ticket with a different combination, no matter how you choose those combinations your odds will be the same. This type of tool is (or will be) designed to select some combinations of numbers (if say you wanted to buy 50 tickets in a lottery pool for your work group) that make sure to select combinations that will not be redundant. For more information you can read this article (not written by me) http://www.colinfairbrother.com/GoldenLottoPlayingRules.aspx Instructions: At the top you just change the array size to match how many regular(white balls/first 5) numbers you want to cover (up to 56 which is the highest numbered regular ball in the game), you can change the actual picked numbers to whatever you want but I just use numbers in numerical order since the numbers you select don't really mean anything for analyzing the combinations, they are just used as "indexes" for combinations. If that makes no sense don't worry about it just select some numbers making sure you don't select the same number twice! Don't forget to change the size of the powerball numbers array to match how many powerballs you want to cover(up to 46 which is the highest numbered "powerball" in the game). Then change the $rounds variable to match how many times you want to simulate playing the lottery with all possible combinations of those numbers. The more combinations in your "set" the longer it will take for each drawing to complete. This is the part that has do to with my question which I will get to in a moment. The script will then make all combinations of the numbers you picked in sets of 5, then it splits the results to make a 2D array, because I thought it would be easier to check each individual number that way (this may be part of the slowness). Then it tacks on the powerball numbers creating the final array of combinations, which can be very very big if you try and cover a lot of numbers. When its done making this array it will display the number of tickets (combinations) you would have to buy to cover all possible combinations for the amount of regular numbers and powerball numbers you selected, after which it will begin simulating the lottery. This is the part where I need help, in two different ways. First, taking what is there, how can I make this searching process faster? Would it be faster to leave the orginal array unsplit and then disect it in each loop? Or is it faster to just search a 2D array with many more elements, but be looking directly in the specific element with no disecting needed? After running through all the drawings it tallying up your winnings (based on megamillions prizes) and compares it to the cost to buy the tickets each round. And finally you have an option to output it all to an excel sheet where you can look at each combination and see how many times it won each prize. The second part of my question deals with the full set of combinations for the first 5 numbers of the game. Meaning all possible combinations of the numbers 1 through 56 in a set of 5. Which is 3,819,816. The maximum elements in an array is 16 million, and if I split the 3,819,816 five number combinations so I can search through it the way I did before, I would need 19,099,080 elements. Which is over 3 million more than the max for AutoIt. So my problem arises from the need for a faster way to search a massive array... in fact possibly an array that is the near the maximum size. If I do not split the array and do the disecting of each 1D element in each loop (in order to compare each number in the combination) how much will it slow it down? Is there a faster way? What I want to ultimately be able to do after resolving this problem is to be able to look at all possible combinations of those numbers, and remove any of them that have 3 or more numbers that are alike (except one). I am not sure which of the combinations that fit that criteria I would keep, and which to remove quite yet... I would for now just go with keeping the combination it is comparing with and removing any matches it compares against, then move down the array lexicographically and keep going till the end. So here it is... #include <Array.au3> #include <RandUnique.au3> #include <Excel.au3> Dim $picks[7]=[20,9,17,23,50,33,7] Dim $extraball[2]=[14,33] Dim $rounds = 1000 ConsoleWrite("Creating regular number wheel..."&@lf) Dim $fullwheel = _ArrayCombinations($Picks, 5, ",") _ArrayDelete($fullwheel, 0) Dim $splitted[UBound($fullwheel)][7] for $i = 0 to UBound($splitted) - 1 $temp = StringSplit($fullwheel[$i], ",") $splitted[$i][0] = $temp[1] $splitted[$i][1] = $temp[2] $splitted[$i][2] = $temp[3] $splitted[$i][3] = $temp[4] $splitted[$i][4] = $temp[5] next Global $complete[1][15] $k = 0 $j = 0 $i = 0 ConsoleWrite("Creating full wheel with powerballs..."&@lf) do if $i = UBound($complete) then ReDim $complete[$i+1000][15] endif $complete[$i][0] = $splitted[$j][0] $complete[$i][1] = $splitted[$j][1] $complete[$i][2] = $splitted[$j][2] $complete[$i][3] = $splitted[$j][3] $complete[$i][4] = $splitted[$j][4] $complete[$i][5] = $extraball[$k] If $k = UBound($extraball) - 1 Then $j=$j+1 $k=0 Else $k=$k+1 EndIf $i = $i+1 until $j = UBound($splitted) ConsoleWrite("Cleaning array please wait..."&@lf) For $i = UBound($complete) - 1 To UBound($complete)- 1001 Step -1 ;ConsoleWrite(" "&$i) if $complete[$i][0] = "" Then _arraydelete($complete, $i) EndIf next ConsoleWrite("Total combinations using "&UBound($picks)&" regular numbers and "&UBound($extraball)&" power balls : "&UBound($complete)&@lf&"..."&@lf) sleep(3000) $match_5ball = 0 $match_5 = 0 $match_4ball = 0 $match_4 = 0 $match_3ball = 0 $match_3 = 0 $match_2ball = 0 $match_1ball = 0 $match_ball = 0 $done = 0 ConsoleWrite("Starting drawings..."&@lf) sleep(2000) for $k = 0 to $rounds $draw = _RandomUnique(5, 1, 56, 1) $powerball = _RandomUnique(1, 1, 46,1) _arraydelete($draw,0) _arraydelete($powerball,0) ConsoleWrite("Drawing Number : "&$k&@lf&"Numbers Picked : "&$draw[0]&","&$draw[1]&","&$draw[2]&","&$draw[3]&","&$draw[4]&" * "&$powerball[0]&@lf) for $i = 0 to UBound($complete)-1 if $complete[$i][0] = $draw[0] or $complete[$i][1] = $draw[0] or $complete[$i][2] = $draw[0] Or $complete[$i][3] = $draw[0] Or $complete[$i][4] = $draw[0] then $first_draw = 1 Else $first_draw = 0 EndIf if $complete[$i][0] = $draw[1] or $complete[$i][1] = $draw[1] or $complete[$i][2] = $draw[1] or $complete[$i][3] = $draw[1] or $complete[$i][4] = $draw[1] then $second_draw = 1 Else $second_draw = 0 EndIf if $complete[$i][0] = $draw[2] or $complete[$i][1] = $draw[2] or $complete[$i][2] = $draw[2] or $complete[$i][3] = $draw[2] or $complete[$i][4] = $draw[2] then $third_draw = 1 Else $third_draw = 0 EndIf if $complete[$i][0] = $draw[3] or $complete[$i][1] = $draw[3] or $complete[$i][2] = $draw[3] or $complete[$i][3] = $draw[3] or $complete[$i][4] = $draw[3] then $fourth_draw = 1 Else $fourth_draw = 0 EndIf if $complete[$i][0] = $draw[4] or $complete[$i][1] = $draw[4] or $complete[$i][2] = $draw[4] or $complete[$i][3] = $draw[4] or $complete[$i][4] = $draw[4] then $fifth_draw = 1 Else $fifth_draw = 0 EndIf if $complete[$i][5] = $powerball[0] then $power_draw = 1 Else $power_draw = 0 EndIf $regular_matches = $first_draw + $second_draw + $third_draw + $fourth_draw + $fifth_draw Select case $regular_matches = 5 and $power_draw = 1 $match_5ball = $match_5ball + 1 $complete[$i][6] = $complete[$i][6] + 1 $done = 1 case $regular_matches = 5 and $power_draw = 0 $match_5 = $match_5 + 1 $complete[$i][7] = $complete[$i][7] + 1 $done = 1 case $regular_matches = 4 and $power_draw = 1 $match_4ball = $match_4ball + 1 $complete[$i][8] = $complete[$i][8] + 1 case $regular_matches = 4 and $power_draw = 0 $match_4 = $match_4 + 1 $complete[$i][9] = $complete[$i][9] + 1 case $regular_matches = 3 and $power_draw = 1 $match_3ball = $match_3ball + 1 $complete[$i][10] = $complete[$i][10] + 1 case $regular_matches = 3 and $power_draw = 0 $match_3 = $match_3 + 1 $complete[$i][11] = $complete[$i][11] + 1 case $regular_matches = 2 and $power_draw = 1 $match_2ball = $match_2ball + 1 $complete[$i][12] = $complete[$i][12] + 1 case $regular_matches = 1 and $power_draw = 1 $match_1ball = $match_1ball + 1 $complete[$i][13] = $complete[$i][13] + 1 case $regular_matches = 0 and $power_draw = 1 $match_ball = $match_ball + 1 $complete[$i][14] = $complete[$i][14] + 1 EndSelect $first_draw = 0 $second_draw = 0 $third_draw = 0 $fourth_draw =0 $fifth_draw = 0 $power_draw = 0 Next if $done = 1 then ExitLoop EndIf next ConsoleWrite("Match 5+Ball : "&$match_5ball&" -- Match 5 : "&$match_5&" -- Match 4+Ball : "&$match_4ball&" -- Match 4 : "&$match_4&" -- Match 3+Ball : "&$match_3ball&" -- Match 3 : "&$match_3&" -- Match 2+Ball : "&$match_2ball&" -- Match 1+Ball : "&$match_1ball&" -- Match Ball : "&$match_ball&@lf) $c1 = $match_5 * 250000 $c2 = $match_4ball * 10000 $c3 = $match_4 * 150 $c4 = $match_3ball * 150 $c5 = $match_3 * 7 $c6 = $match_2ball * 10 $c7 = $match_1ball * 3 $c8 = $match_ball * 2 $cash_back = $c1+$c2+$c3+$c4+$c5+$c6+$c7+$c8 $total_cash = $cash_back - UBound($complete)*$rounds ConsoleWrite(" ---- Cash Back = "&$cash_back&" Total Cash = "&$total_cash&@lf) ConsoleWrite("Creating Excel Sheet..."&@lf) $make_sheet = MsgBox(4,"Make Excel Sheet?", "Make Excel Sheet?") if $make_sheet = 6 then _arrayinsert2d($complete, 0) $complete[0][0] = "Pick 1" $complete[0][1] = "Pick 2" $complete[0][2] = "Pick 3" $complete[0][3] = "Pick 4" $complete[0][4] = "Pick 5" $complete[0][5] = "PowerBall" $complete[0][6] = "Match 5+Ball" $complete[0][7] = "Match 5" $complete[0][8] = "Match 4+Ball" $complete[0][9] = "Match 4" $complete[0][10] = "Match 3+Ball" $complete[0][11] = "Match 3" $complete[0][12] = "Match 2+Ball" $complete[0][13] = "Match 1+Ball" $complete[0][14] = "Match Ball" $oExcel = _ExcelBookNew(1) $b=$oExcel.transpose($complete) $oExcel.Range("A1").Resize(UBound($complete),15) = $b EndIf ;_arraydisplay($complete) Oh by the way, I haven't really looked at it yet but why is my $done not working? It is supposed to stop the script if you win one of those higher jackpots (to see if your ahead) but it doesn't. Later I would also like to stop it when you have won a certain amount more than you have bet using similar methods. I use random unique for the powerball even tho it only selects one just for the sake of using the same method of picking a random number.
  5. if they pay you for clicks, then it most definately goes against their TOS to automate the clicks.
  6. it really doesn't matter if you can register "legitimate" keystrokes. I'm sure the website has a way of monitoring clicks to prevent this type of abuse.... considering they are paying you for clicks it would be in their best interest to make sure each one was legitimate. It has been a long time since this scam worked. I would suggest trying to generate legitimate traffic instead, or actually complete the surveys, or whatever "task" your trying to "automate"..... "sigh" lol
  7. actually its not contradictory. A column is a space in a row. By saying I want to search all columns in a row I am saying I want to search every space (element) in that row. I think it sounds contradictory to you because you are assuming a column must span across multiple rows. A column is one single space in a row... for example this simple spreadsheet: 1-2-3-4-5 If I was to search for the number 3 in "all columns in one row" I would find it in the third column of the only row. In anycase I figured out how to do what I wanted with a series of if/elseif statements. Not as clean as I would like it to be but this is what I got (ignore the junk boxes). #include <Array.au3> #include <RandUnique.au3> Global $picks[12]=[01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12] Global $extraball[12]=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] Global $fullwheel = _ArrayCombinations($Picks, 5, ",") Global $splitted[792][7] _ArrayDelete($fullwheel, 0) ;_ArrayDisplay($fullwheel, "iSet = " & 5) for $i = 0 to UBound($splitted) - 1 if $i > 788 Then ;ConsoleWrite(" $I equals: " & $i & " COMBO NUMBER " & $i+1) endif $temp = StringSplit($fullwheel[$i], ",") $splitted[$i][0] = $temp[1] $splitted[$i][1] = $temp[2] $splitted[$i][2] = $temp[3] $splitted[$i][3] = $temp[4] $splitted[$i][4] = $temp[5] next _arraydisplay($splitted,"splitted") Global $complete[99999][7] $k = 0 $j = 0 $i = 0 do if $k = 11 then ; ConsoleWrite("COMBO " & $j+1 & " TOTAL " & $i+1 & " POWER " & $k+1 & " --- ") endif $complete[$i][0] = $splitted[$j][0] $complete[$i][1] = $splitted[$j][1] $complete[$i][2] = $splitted[$j][2] $complete[$i][3] = $splitted[$j][3] $complete[$i][4] = $splitted[$j][4] $complete[$i][5] = $extraball[$k] If $k >= 11 Then $j=$j+1 $k=0 Else $k=$k+1 EndIf $i = $i+1 until $j = UBound($splitted) _ArrayDisplay($complete, "Complete Wheel") $matched = 0 $draw = _RandomUnique(3, 1, 12, 1) $powerball = _RandomUnique(1,1,12,1) _arraydelete($draw,0) _arraydelete($powerball,0) _arraydisplay($draw) _arraydisplay($powerball) for $i = 0 to UBound($complete)-1 if $complete[$i][0] = $draw[0] Then $first_draw = 1 ElseIf $complete[$i][1] = $draw[0] then $first_draw = 1 elseif $complete[$i][2] = $draw[0] then $first_draw = 1 elseif $complete[$i][3] = $draw[0] then $first_draw = 1 elseif $complete[$i][4] = $draw[0] then $first_draw = 1 Else ;MsgBox(0,"","No Match for "&$draw[0]&" in first draw.") $first_draw = 0 $second_draw = 0 $third_draw = 0 $power_draw = 0 EndIf if $first_draw = 1 Then ;MsgBox(0,"","Found Match for "&$draw[0]&" in first draw.") if $complete[$i][0] = $draw[1] Then $second_draw = 1 ElseIf $complete[$i][1] = $draw[1] then $second_draw = 1 elseif $complete[$i][2] = $draw[1] then $second_draw = 1 elseif $complete[$i][3] = $draw[1] then $second_draw = 1 elseif $complete[$i][4] = $draw[1] then $second_draw = 1 Else ;MsgBox(0,"","No Match for "&$draw[1]&" in second draw.") $first_draw = 0 $second_draw = 0 $third_draw = 0 $power_draw = 0 EndIf Else $first_draw = 0 $second_draw = 0 $third_draw = 0 $power_draw = 0 EndIf if $first_draw = 1 and $second_draw = 1 Then ;MsgBox(0,"","Found Match for "&$draw[1]&" in second draw.") if $complete[$i][0] = $draw[2] Then $third_draw = 1 ElseIf $complete[$i][1] = $draw[2] then $third_draw = 1 elseif $complete[$i][2] = $draw[2] then $third_draw = 1 elseif $complete[$i][3] = $draw[2] then $third_draw = 1 elseif $complete[$i][4] = $draw[2] then $third_draw = 1 Else ;MsgBox(0,"","No Match for "&$draw[2]&" in third draw.") $first_draw = 0 $second_draw = 0 $third_draw = 0 $power_draw = 0 ;Next EndIf Else $first_draw = 0 $second_draw = 0 $third_draw = 0 $power_draw = 0 ;Next EndIf if $first_draw = 1 and $second_draw = 1 and $third_draw = 1 Then ; MsgBox(0,"","Found Match for "&$draw[2]&" in third draw.") if $complete[$i][5] = $powerball[0] Then $power_draw = 1 ; ConsoleWrite(" Success combo number "&$i+1) $matched = $matched + 1 $complete[$i][6] = $complete[$i][6] + 1 Else ;MsgBox(0,"","No Match for "&$powerball[0]&" in powerball.") $first_draw = 0 $second_draw = 0 $third_draw = 0 $power_draw = 0 EndIf Else $first_draw = 0 $second_draw = 0 $third_draw = 0 $power_draw = 0 ;Next EndIf Next ;_arraydisplay($complete) ConsoleWrite(" ------------------- TOTAL MATCHED : "&$matched&" ------- ") There is still a ton of junk in there, this is just a brute force/rough draft for my project. In case your wondering, this is for creating and analyzing lottery wheels. Amazing fact: If you bought 9504 lottery tickets composing all the combinations of 12 regular numbers and 12 powerball numbers, and if when the drawing occured they drew 3 of the 12 regular numbers you picked plus one of the power ball numbers you picked, you would only get 36 tickets with a match3+powerball. If you where playing megamillions you would "win" $5,400 but you would actually be out $4,104 -------- NOTE this is only including tickets that matched 3+1, you would still have many tickets that would match 2+1 and 1+1, I just havent put it in the script yet, but I assume you would be ahead.
  8. Your code does not search for anything it just displays what is in each column. I need to search a ROW and output a result as to weather it was found in one of the columns of that row. Yes I could visually check each column, but that would require 47,520 message boxes (in this situation, millions in others) and defeats the purpose of this program. I do not want to search with my eyes, I want to program to do the searching and output a result to a variable, and continue on with the rest of the script. There are 9504 rows, each containing 7 cells. The first 5 cells have a number between one and twelve. The sixth cell also has a number between one and twelve but refers to something different. The 7th cell is an empty space waiting to be filled with search results. The program is going to pick 3 random numbers between 1 and 12, and then it will check the first 5 columns of each row to see if all of those 3 numbers are present in that row. If it fails it will move down to the next row and search for the same 3 numbers. When it finds all 3 numbers it will then search the 6th column of that row to find a separate randomly chosen number between one and 12, if the search is successful it will add 1 to the 7th column of that row and then move down to the next row and start over. When it is done searching the last row it will pick a new set of random numbers, 3 normal and 1 extra between one and 12. After which it will start over at the top row and repeat. It will do this millions of times. Then when it is finished it will sort the array by the 7th column.
  9. could be anything. i once made a program for a game that used pixel search primarily to get info about what was going on in the game, before I learned how to read/write addresses. I had made a function that could identify items in your inventory using pixel search. Instead of searching one pixel it searched five. One "center" pixel and 4 pixels to the up left up right down left and down right of the center one. Works great but you have to have a pretty good understanding of how pixelsearch works. Advice to the OP: Start with one function. Help file is more handy and readily available than posting and waiting, to be told to read the help file Do not bite of more than you can chew. Make one thing work and then move onto integrating something else. In fact, make the two things work separately and then try integrating them, then if you have problems it will be a lot easier to figure out. If your new to programming I recommend starting with control structures. Start with the IF and else statements and a message box. Try adding some simple numbers, or checking if a variable contains certain data or not. Then move on to loops, starting with the While loop. Something like: $number = 0 While $number < 10 ; This means the following code will repeat while the variable $number is less than 10 msgbox,0,"My number",$number $number = $number + 1 wend This bit of code will display a message box with the value of $number every time it loops through, adding 1 to number each time, and then it will stop when $number equals 10. Make sure to use scite editor, and make use of ConsoleWrite to keep track of values and error codes for debugging. Good luck
  10. How do I select a random number between a min and a max, and then after picking that number select another random number between the same min/max excluding the first number I picked? Example: I want to select 5 random numbers between 1 and 12, and each selection can not be the same. If I select the number 6 the first time I do not want it to be possible to select the number 6 again. The only way I can see it being done is to compare the later results with the former results and if they are the same, run the random number generator again.. but then is it still truely random? I am no mathmatician so I have no idea... but it does need to be completely random. Does picking an already picked number, tossing it back, and selecting again count as random?
  11. How do I go about searching all columns in one row of a 2d array? For example I want to see if the number 3 is in $array[1], and I only want to search $array[1][0] through $array[1][4]. This is part of the array I am dealing with. It is a large array (9504 elements with 7 sub elements(the last one is currently empty)) that lists all the combinations of the numbers 1 through 12 in a set of five, plus all the combinations of those sets with an extra number between 1 and 12. [0]|1|2|3|4|5|1| [1]|1|2|3|4|5|2| [2]|1|2|3|4|5|3| [3]|1|2|3|4|5|4| [4]|1|2|3|4|5|5| [5]|1|2|3|4|5|6| [6]|1|2|3|4|5|7| [7]|1|2|3|4|5|8| [8]|1|2|3|4|5|9| [9]|1|2|3|4|5|10| [10]|1|2|3|4|5|11| [11]|1|2|3|4|5|12| [12]|1|2|3|4|6|1| [13]|1|2|3|4|6|2| [14]|1|2|3|4|6|3| [15]|1|2|3|4|6|4| [16]|1|2|3|4|6|5| [17]|1|2|3|4|6|6| [18]|1|2|3|4|6|7| [19]|1|2|3|4|6|8| [20]|1|2|3|4|6|9| [21]|1|2|3|4|6|10| [22]|1|2|3|4|6|11| [23]|1|2|3|4|6|12| I have tried array search but I either get an error code 6 (no match) or it says the array variable has incorrect number of subscripts or something. I have tried it these two ways: ($complete is the array) $value = 6 $result = _ArraySearch($complete[1], $value, 0, 4) $err = @error ConsoleWrite($result&" --- "&$err) This results in an error about the array variable having incorrect number of subscripts. $value = 6 $result = _ArraySearch($complete, $value, 0, 4) $err = @error ConsoleWrite($result&" --- "&$err) This results in error code 6, no match. I assumed this wouldn't work because it seems to imply searching the whole array (but then still it SHOULD find something). I thought the first one would work, but it doesn't seem to. While writing this script I have run into the "array variable has incorrect number of subscripts" dozens of times in different places. I havn't used autoit in awhile, I dont remember having to declare the size of an array, or getting this error ever! Has something changed? Side note: Part of my script requires that I do not know how big the array is going to be, and I need to know exactly how many rows there are when the function is done using the array, and not include any empty rows. How do I do this? ReDim every time? What if I need to redim 100 million times (likely)? There has got to be a better way.
  12. Yes but I am making the variable names even longer. Also, I do not know how the obfuscator works. * removed *
  13. There are thousands of variables of which I do not know the name of, I only know they start with $A. This is what I came up with which seems to do the trick: #include <String.au3> $fh = FileOpen(@workingdir &"\obfuscated.au3",0) $file = FileRead($fh) FileClose($fh) $i = 0 $a = 0 while $i < 5000 $found = StringMid($file,StringInStr($file, "$A")+1, 6) $file = StringReplace($file,$found,_StringEncrypt(1,$found,'somekey',1)) $i = $i +1 $a = $a +1 if $a >= 25 then $percent = round(($i/5000)*100,2) ConsoleWrite($percent&@CRLF) $a = 0 EndIf wend $fh = FileOpen(@workingdir&"\crypt_obfu.au3",2) FileWrite($fh,$file) FileClose($fh) ConsoleWrite("DONE!") What it does is search for 5000 strings that start with $A and replaces the 6 characters after $ with an encrypted version of that string. Put a little bit of console write stuff in there to track the progress, save to a new file and done! I wanted this so I could encrypt the variable names of an obfuscated script and still have it function properly. The only reason to do this is to further confuse someone if they get to the source code, and possibly confuse a deobfuscator. EDIT* By the way this is in no way fast if you have thousands of variables, which is likely. Patience is key I suppose
  14. What I need to do: Open a file and read it into a variable Search that variable for any instance of "$A" and replace every "$A" plus 4 characters after that with an encrypted version. The encryption should use the same key every time. For example the file contains: $A1234 = "something" $A2351 = "something" $A0572 = "something" $A2000 = "something" I want to replace all of those variable names with an encrypted version. Including the dollar sign, which when replacing should be appended back on. How do I do this?
  15. Try this: $sData = "Now is the time for all good men to come to the aid of their country." $sKey = "This is my key phrase." $bCrypt = rc4($sKey, $sData) $bDcrypt = rc4($sKey, $bCrypt) $sDcrypt = BinaryToString($bDcrypt) $bData = StringToBinary($sDcrypt) $reCrypt = rc4($sKey, $bData) $srecrypt = BinaryToString(rc4($sKey, $recrypt)) ConsoleWrite($sData&@CRLF&$sKey&@CRLF&$bCrypt&@CRLF&$bDcrypt&@CRLF&$sDcrypt&@CRLF&$bData&@CRLF&$reCrypt&@CRLF&$srecrypt)
×
×
  • Create New...