I am trying to read values from cells of a running Excel 2007 document. I am using the WinAPI extension for Lua. I am currently running on a Windows XP computer (if that matters, but it seems the WinAPI works from XP on.
This is my Excel document:
This is my Lua code:
require 'winapi'
w = winapi.find_window_match('Book1') -- Specify the name of the window
w:show() -- Set the visability
w:set_foreground() -- Bring this window to the foreground
handle = w:get_handle() -- Get window handle
t = {} -- Create a table
w:enum_children(function(w) table.insert(t,w) end) -- Enumerate all children
for k,v in pairs(t) do -- Print out all pairs in the table
print("",k,"=",v)
end
This is my Lua code output:
Does anyone know how I recursively should enumerate in order to find each Cell? Or is there a better way to go about this? The text I want is the "1234". I have not done much Windows programming since I prefer Unix, but it seems like I am on the right track. I just don't know how to progress from here!