face Posted October 10, 2013 Share Posted October 10, 2013 how can i multiply numbers in a text file 92 by 92 and each time by a different amount eg: 1 2 3 ... 92 multiplied by 2 93 94 95 ... 184 multipiled by 3 on the same list so every time every 92 numbers a different factor multiplies the numbers until line 26000 Link to comment Share on other sites More sharing options...
willichan Posted October 10, 2013 Share Posted October 10, 2013 Using nested For/Next loops? Not clear by what you mean by "multiply numbers in a text file 92 by 92". Can you post what code you have so far? It would make helping you a lot easier. My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator, Enigma, CornedBeef Hash Link to comment Share on other sites More sharing options...
face Posted October 10, 2013 Author Share Posted October 10, 2013 (edited) i have a list for 92 numbers that repeat here's an example with 4 numbers that repeat twice (same order) 22 45 2 91 22 45 2 91 i need to multiply the 4 numbers and everytime they repeat the multiplier goes +1 heres a eg: result, first repeat multiplied by 2 and then by 3 (2+1) and so on 44 90 4 182 66 135 6 273 so basically its the same numbers (22, 45, 2, 91) that repeat but multiply by 2, 3,4 ,5, ... Edited October 10, 2013 by face Link to comment Share on other sites More sharing options...
willichan Posted October 10, 2013 Share Posted October 10, 2013 A little bit clearer. Read up on FileReadLine, While/Wend, and For/Next in the help file. If you get stuck, post the code that you were able to put together, and we can try to get you past your hurdles. My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator, Enigma, CornedBeef Hash Link to comment Share on other sites More sharing options...
Solution jdelaney Posted October 10, 2013 Solution Share Posted October 10, 2013 (edited) #include <File.au3> $file = @DesktopDir & "\temp.txt" Local $array[1] _FileReadToArray($file,$array) $iMultiplier = 2 For $i = 1 To UBound($array)-1 $return = $array[$i] * $iMultiplier ConsoleWrite($return & @CRLF) If IsInt($i/4) Then $iMultiplier+=1 Next oops, misread your second one...you can instead do this....will loop through the records, and multiply by 1 (basically copy the initial 96), then enumerate the multiplier continually (after looping through the file each time), until line 26000 is reached: #include <File.au3> $file = @DesktopDir & "\temp.txt" $file_output = @DesktopDir & "\output.txt" Local $array[1] _FileReadToArray($file,$array) _FileCreate($file_output) $hOutput = FileOpen($file_output,2) $iMultiplier = 1 $iCounter = 1 While True For $i = 1 To UBound($array)-1 If $iCounter > 26000 Then ExitLoop 2 FileWriteLine($hOutput, $array[$i] * $iMultiplier) $iCounter += 1 Next $iMultiplier += 1 WEnd FileClose($hOutput) If you don't need the initial copy to the file (multiply times 1) then set $iMultiplier = 2, instead of 1 Edited October 10, 2013 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. Link to comment Share on other sites More sharing options...
face Posted October 10, 2013 Author Share Posted October 10, 2013 thanks a lot can you make it so i don't modify the $iMultiplier manually, after each 92 numbers it doesn't go +1 by itself Link to comment Share on other sites More sharing options...
jaberwacky Posted October 10, 2013 Share Posted October 10, 2013 Or you could just do everything for him. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
gruntydatsun Posted October 10, 2013 Share Posted October 10, 2013 Another solution #include <File.au3> #include <Array.au3> dim $array _FileReadToArray(@ScriptDir & "\numbers.txt",$array) _ArrayDelete($array,0) _ArrayDisplay($array) ;loop through array to find last unique element in seriesrepeat $index_of_last_unique_element = 0 for $x = 1 to UBound($array)-1 if $array[0] = $array[$x] Then $index_of_last_unique_element = $x-1 ExitLoop EndIf Next $multiplier = 2 for $x = 0 to UBound($array)-1 if $array[$x] * $multiplier <= 2600 Then $array[$x] *= $multiplier Else ExitLoop EndIf if $x <> 0 and mod($x,$index_of_last_unique_element) = 0 then $multiplier += 1 EndIf Next _ArrayDisplay($array,"Finished") Link to comment Share on other sites More sharing options...
jdelaney Posted October 10, 2013 Share Posted October 10, 2013 (edited) Jaberwocky, I already have proven that I 'can'; in fact, I 'will' continue to help. I like to answer those posts that require logical solutions. He may not learn anything, and will post more similar questions, and I will answer those as well. I'm in it for the puzzles, not your affirmations. If you want to enumerate the multiplier every 96 numbers, do this: #include <File.au3> $file = @DesktopDir & "\temp.txt" $file_output = @DesktopDir & "\output.txt" Local $array[1] _FileReadToArray($file,$array) _FileCreate($file_output) $hOutput = FileOpen($file_output,2) $iMultiplier = 1 $iCounter = 1 While True For $i = 1 To 96 FileWriteLine($hOutput, $array[$iCounter] * $iMultiplier) $iCounter += 1 Next $iMultiplier += 1 WEnd FileClose($hOutput) This assumes your file already has the 26000 lines, with repeating integers. Let me know if that's not the case. Edited October 10, 2013 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. Link to comment Share on other sites More sharing options...
face Posted October 10, 2013 Author Share Posted October 10, 2013 (edited) i get and error message thanks again Edited October 10, 2013 by face Link to comment Share on other sites More sharing options...
BrewManNH Posted October 10, 2013 Share Posted October 10, 2013 That's helpful. What is the error message, are we supposed to guess? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
jdelaney Posted October 10, 2013 Share Posted October 10, 2013 (edited) oops, need to put in a check that $iCounter is not over ubound of the array If $iCounter < Ubound($array) Then... If $iCounter is above or equal, then you need to force the scripts exit (exit command) Edited October 10, 2013 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. Link to comment Share on other sites More sharing options...
face Posted October 10, 2013 Author Share Posted October 10, 2013 this what you wrote works #include <File.au3> $file = @DesktopDir & "\temp.txt" $file_output = @DesktopDir & "\output.txt" Local $array[1] _FileReadToArray($file,$array) _FileCreate($file_output) $hOutput = FileOpen($file_output,2) $iMultiplier = 2 $iCounter = 1 While True For $i = 1 To UBound($array)-1 If $iCounter > 92 Then ExitLoop 2 FileWriteLine($hOutput, $array[$i] * $iMultiplier) $iCounter += 1 Next $iMultiplier += 2 WEnd FileClose($hOutput) but i need "$iMultiplier += 2" to go +1 every 92 multiplied numbers Link to comment Share on other sites More sharing options...
BrewManNH Posted October 10, 2013 Share Posted October 10, 2013 Then change it If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
somdcomputerguy Posted October 10, 2013 Share Posted October 10, 2013 C:UsersErvinDesktopmultiplyweapstatsIs this for a game? You might want to read the Forum Rules.http://www.autoitscript.com/forum/index.php?app=forums&module=extras§ion=boardrules - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
iamtheky Posted October 10, 2013 Share Posted October 10, 2013 Unless the game is Math Blaster this is very clearly not game automation. It might be tracking weapon stats or even forecasting future attributes, but a script that multiplies every value in an array by $x should be of no concern, even if he said "i use this for hacking and game automation and circumventing authentication." ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
jaberwacky Posted October 10, 2013 Share Posted October 10, 2013 Actually the rules clearly state that no game automation in any way whatsoever shall be discussed. So if this is indeed for a game then it should be dealt with by a moderator as that moderator sees fit to deal with it. 1. Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects: Malware of any form - trojan, virus, keylogger, spam tool, "joke/spoof" script, etc. Bypassing of security measures - log-in and security dialogs, CAPTCHAs, anti-bot agents, software activation, etc. Automation of software/sites contrary to their EULA (see Reporting bullet below). Launching, automation or script interaction with games or game servers, regardless of the game. Running or injecting any code (in any form) intended to alter the original functionality of another process. Decompilation of AutoIt scripts or details of decompiler software. This list is non-exhaustive - the Moderating team reserve the right to close any thread that they feel is contrary to the ethos of the forum. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jaberwacky Posted October 10, 2013 Share Posted October 10, 2013 (edited) Jaberwocky, I already have proven that I 'can'; in fact, I 'will' continue to help. I like to answer those posts that require logical solutions. He may not learn anything, and will post more similar questions, and I will answer those as well. I'm in it for the puzzles, not your affirmations. No one said you couldn't or should not help. However, what you are providing isn't help. In my short time on these forums I've gathered that the consensus of this forum by people smarter and more experienced than me is that it is pointless to just give outright solutions without the OP doing anything on their part. You're not helping AutoIt in any way. Rather you're only helping only your self. If you need to solve puzzles I'm sure that you can find plenty of your own solve. Unless you can't? Edited October 10, 2013 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 10, 2013 Moderators Share Posted October 10, 2013 Hi,The script in question merely manipulates a text file on the Desktop - as such I see nothing wrong with it. The script itself does not interact with a game - which is the litmus test as set out in the Forum rules.boththose suggested that this thread would be legal: even if he said "i use this for hacking and game automation and circumventing authentication."In fact it would be quite the opposite. If someone openly admits that they are seeking help for something prohibited by the Forum rules then the thread is automatically "out-of-bounds" as we are not prepared to assist anyone to circumvent the rules if that is their stated aim - even if the proximate problem is not specifically game-related. People might like to read my final post in this thread. I hope that is clear. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
iamtheky Posted October 14, 2013 Share Posted October 14, 2013 i said the script would be of no concern (which it really wouldn't)...forum legality of intent notwithstanding. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) 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