Kiti Posted June 14, 2008 Posted June 14, 2008 (edited) This script will increment any ("Step" & a number) found on the A column, if it has an "x" next to it, on the B column. It's pretty simple, and it's one of my first scripts I ever wroted in AutoIt. I was pretty unsure about how to use 2D arrays, and this make me understood them a lot better. I hope you like it! Tell me what you think! expandcollapse popup#include <ExcelCOM_UDF.au3> #include <GUIConstantsEx.au3> Local $YesID, $ExitID, $msg Local $oExcel = _ExcelBookNew(1) $gui = GUICreate("Custom Msgbox", 210, 80) GUICtrlCreateLabel("Please click a button!", 10, 10) $YesID = GUICtrlCreateButton("Validate!", 25, 40, 100, 30) $ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20) GUISetState(@SW_SHOW); display the GUI $Note_win = WinGetHandle("Custom Msgbox", "") WinMove($Note_win, "", 700, 10) WinSetOnTop("Custom Msgbox", "", 1) For $K = 1 To 25 _ExcelWriteCell($oExcel, "Step 1", $K, 1) Next While 1 $msg = GUIGetMsg() Switch $msg Case $YesID WinActivate("[CLASS:XLMAIN]", "") Send("{DOWN}"); fixes a bug: if you write "x" on a cell, and you don't select another cell, the GUI exits. $Cell = _ExcelFindInRange($oExcel, 'x', 1, 2, 25, 2, 0, 2, False, False) For $i = 1 To $Cell[0][0] $Step = _ExcelReadCell($oExcel, $Cell[$i][3], $Cell[$i][2] - 1) $level = StringTrimLeft($Step, 5) $nextlevel = $level + 1 _ExcelWriteCell($oExcel, "Step " & $nextlevel, $Cell[$i][3], $Cell[$i][2] - 1) Next _ExcelReplaceInRange($oExcel, "x", "", 1, 2, 25, 2, 2, False, "", False) Case $ExitID _ExcelBookClose($oExcel) Exit Case $GUI_EVENT_CLOSE _ExcelBookClose($oExcel) Exit EndSwitch WEnd Edited June 14, 2008 by Kiti 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
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