I pasted a link to a test program which shows what's wrong. It's not the real program but is very similar and works in the same way.
Here is another example
http://daroc.ovh.org/_various/ahk/test2.zip
where I try to use Excel_GetCell()
Code:
#include COM.ahk
#include functions.ahk
#include CoHelper.ahk
; INFORMATION
; Especially look at the Loop below
; Options
input_filename=in.xls
;input_title_pattern=Microsoft Excel - %input_filename%
input_title_pattern=%input_filename%
winactivate_timeout=4
; General
#SingleInstance
#Persistent
;#WinActivateForce
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
; GUI
Menu, Tray, Tip, TestCase
; Menu
Menu, Tray, NoStandard
Menu, Tray, Add, Windows Spy, RunWinSpy
Menu, Tray, Add, Edit
Menu, Tray, Add, Reload
Menu, Tray, Add, Exit
Menu, Tray, Default, Reload
Return
RunWinSpy:
Run, C:\Program Files\AutoHotkey\AU3_Spy.exe
return
Edit:
Edit
Return
Reload:
Reload
Return
Exit:
ExitApp
return
; Predefined functions
ToolTipRemove:
SetTimer, ToolTipRemove2, 3000
return
ToolTipRemove2:
SetTimer, ToolTipRemove2, Off
ToolTip
return
; The Script
#a::
Sleep 500
FileGetSize, tmp, %input_filename%
if ErrorLevel
MsgBox, in files does not exist
else {
ifWinExist %input_title_pattern%
{
WinActivate
}
else {
Run, %input_filename%
}
WinWaitActive, %input_title_pattern%, , %winactivate_timeout%
if ErrorLevel
MsgBox, error2
else {
Sleep 100
Send {Esc}
Send ^{Home}
Sleep 500
Send {Down 2}{Right}
Sleep 50
Send {F2}
Sleep 50
Send {End}
Send +{Home}
Sleep 50
Send ^c
Sleep 50
Send {Esc}
Sleep 50
output_filename=%clipboard%.xls
output_title_pattern=%output_filename%
ifWinExist %output_title_pattern%
WinActivate
else {
FileGetSize, tmp, %output_filename%
if ErrorLevel {
MsgBox, no file - %output_filename%
ExitApp
}
else {
ifWinExist %output_title_pattern%
{
WinActivate
Sleep 50
}
else {
Run, %output_filename%
}
}
}
WinWaitActive, %output_title_pattern%, , %winactivate_timeout%
if ErrorLevel {
MsgBox, couldn't open window
ExitApp
}
else {
Sleep 50
Send ^{Home}
Sleep 50
WinActivate, %input_title_pattern%
Send {Esc}
Sleep 50
Send {Down}{Home}
Sleep 50
Loop, 1 {
A:=Excel_GetCell("A", 3)
MsgBox % A
}
}
}
}
;Progress, Off
return