Kiti Posted June 16, 2008 Share Posted June 16, 2008 I have a list of 64.000 words (which mostly repeat) on the B column of an Excel file, and 5.000 other words, which are the "esence" of the 64k ones, and shorter in lenght as well. So, here's my script: #include <ExcelCOM_UDF.au3> $oExcel =_ExcelAttach("Microsoft Excel - MyFile","Title") WinActivate("Microsoft Excel - MyFile") For $i = 1 to 5185 $Find = _ExcelReadCell($oExcel, $i, 9) $result = StringStripWS($Find, 3) $Choord = _ExcelFindInRange($oExcel, $result, 1, 2, 63865, 2, 0, 2, False, "") For $k =1 to $Choord[0][0] _ExcelWriteCell($oExcel, $result, $Choord[$k][3], $Choord[$k][2] + 1) Next Next But, when I run it, it makes some 'replacements' for a few minutes, and then stops (it search and write till about the 700th word in the 5k list). What's the problem with it? Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30 Link to comment Share on other sites More sharing options...
cartman380 Posted June 17, 2008 Share Posted June 17, 2008 I ran your script and I didn't run into the same problem that you did, but then again I don't have the same data that you have I just used data I created myself to test it. The only problem that I had was that my CPU spiked to 100% usage while I was running the script, with EXCEL.EXE using on average 85-95% of the CPU at any given time. I added a sleep in the code of 250 ms and the CPU usage went down to 30-50%. Although this way will be slower you might try and see if it's just a timing issue. I also added in a couple console writes to see my progress which can be removed. #include <ExcelCOM_UDF.au3> $oExcel =_ExcelAttach("Microsoft Excel - MyFile.xls","Title") WinActivate("Microsoft Excel - MyFile") For $i = 1 to 5185 ConsoleWrite("i = " & $i & @CRLF) $Find = _ExcelReadCell($oExcel, $i, 9) $result = StringStripWS($Find, 3) $Choord = _ExcelFindInRange($oExcel, $result, 1, 2, 63865, 2, 0, 2, False, "") For $k =1 to $Choord[0][0] _ExcelWriteCell($oExcel, $result, $Choord[$k][3], $Choord[$k][2] + 1) ConsoleWrite("k = " & $k & @CRLF) Next Sleep(250) Next Link to comment Share on other sites More sharing options...
Kiti Posted June 17, 2008 Author Share Posted June 17, 2008 I think it will be VERY slower, because it has to search through 64.000 lines, and repeat this 5.000 times. As it is takes a lot, plus the quarter of the second would be a very long time. But if this solves the exit problem, I think I'll let it work over night. Thanks for replying and for the progress track, it's very useful (I used to watch the left slidebar in Excel to see how much it has till the end). Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30 Link to comment Share on other sites More sharing options...
cartman380 Posted June 17, 2008 Share Posted June 17, 2008 You could always try doing 100 ms or even 50ms, just something to slow it up a little so the CPU doesn't get overburdened. It's just a theory. 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