We will now use an Excel SpreadSheet from AutoIt macros, so we replace Visual Basic for applications (VBA) as it is buggy switching macros between different Office versions.
You must have MS Excel and AutoIt.
Open the SciTE code editor and start writing the Excel automation code (called macros).
Follow these steps to automate Excel:
$oExcel = ObjCreate("Excel.Application") ; Create an Excel Object $oExcel .Visible = 1 With $oExcel ; Let Excel show itself .WorkBooks.Add ; Add a new workbook .Worksheets(1).ScrollArea = "A50" ; got to A50 .Activewindow.ScrollColumn = 50 ; Go to column .Activewindow.ScrollRow = 50 ;Go to row .cells(50,1).value=44 ; writting values EndWith
You can use Office objects this way to automate Word, Excel, and others same as given in the previous recipe about AutoIt and batch files replacement; you can replace Visual Basic for Applications (VBA) using AutoIt macros. You can even use a Microsoft object for these macros. Further information about Excel automation and VBA can be found at http://www.autoitscript.com/forum/topic/144031-update-the-excel-udf-that-comes-with-autoit/.
There is another approach. It is by simulating keyboard strokes (send())
and mouse clicks (MouseClick())
for very simple macros. You simulate a human user by repeating the same keystrokes and mouse movements he would do when sitting in front of his/her computer.
Of course, these macros are not human beings; they do not think yet, but you can use some if...then clauses to identify possible or typical problems that may arise when you computers are working, and solve these forks with new macros, or by reusing previous ones. So, you will make your macro a little more intelligent than the typical word processor computer.