AutoHotKey not creating expected MsgBox Output.

beatified
beatified used Ask the Experts™
So I am creating an AHK Script in Windows XP with Excel 2010 and am having problems using the script in that environment.

The Excel file was originally created with Excel 2016. I'm not sure what I'm doing right but in the end all I get is my yes no and cancel buttons not the %Output%.

I don't know if maybe I am running into some compatibility issues between version or what?

Here's the code...
#Warn,UseUnsetLocal
#NoEnv
#SingleInstance Force
SetBatchLines,-1

SourceFile:="C:\Documents and Settings\Administrator\Desktop\Deposit Form.xlsx"
InputBox, DepNum, Deposit Number, Enter the Deposit Number you would like to process
NumberColumns:=9
NumberRows:=29

Output:=""
ColumnLetters:=["A","B","C","D","E","F","G","H","I"]
oWorkbook:=ComObjGet(SourceFile)
oExcel.Sheets(DepNum).Select
ExcelCells:=Object()
Loop,%NumberRows%
{
  If (A_Index=1)
    Continue ; ignore first row
  CurrentRow:=A_Index
  Loop,%NumberColumns%
  {
    If (A_Index=1 or A_Index=8)
      Continue ; ignore columns A and H
    If (A_Index=6)
      SetFormat,Float,6.2
    If (A_Index=7 or A_Index=9)
      SetFormat,Float,6.0
    CurrentColumn:=ColumnLetters[A_Index]
    CurrentCell:=CurrentColumn . CurrentRow
    ExcelCells[CurrentColumn,CurrentRow]:=oWorkbook.Worksheets(1).Range(CurrentCell).Value
    If (A_Index=2)
      Output:=Output . "10" . ExcelCells[CurrentColumn,CurrentRow] . "-"
    Else
      Output:=Output . ExcelCells[CurrentColumn,CurrentRow] . " - "
    If (A_Index=9)
      StringTrimRight,Output,Output,3
  }
  Output:=Output . "`n"
}
MsgBox, 3, Correct?, Is this the information You would like to process? (press Yes or No or Cancel to quit), %Output%
IfMsgBox Yes
    MsgBox You pressed Yes.
IfMsgBox No
	MsgBox You pressed No.
else
    MsgBox You pressed Cancel.
ExitApp

Open in new window

Attached are pictures of what happens. From what I understand it should be displaying %Output%.
I'm sure this is an easy one but I'm totally missing it.

Thanks, Stuart
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018
Hi Stuart,
Attachments missing. Regards, Joe
Oops...
PathtoC.bmp
Developer
Fellow 2017
Most Valuable Expert 2018
Hi Stuart,
I don't need the attachments. The bug is the last comma in your MsgBox,3 command...that makes AutoHotkey think that %Output% is the Timeout parameter. This will fix it:

MsgBox, 3, Correct?, Is this the information You would like to process? (press Yes or No or Cancel to quit)`n%Output%

Open in new window

Regards, Joe
That explains why it was closing the MsgBox on its own. :)
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018
Yep! :) The last param is the Timeout in seconds...should be a number...I have no idea what it does with a value like what's in your Output variable, but based on your comment, sounds as if it assigns some value to it...and closes the box accordingly.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial