Hi
I have the below code that first pulls the required data from Excel. Then using ImageRectangle the coordinates where the text Label was found is added together with the coordinates of TextBoxOffset to find the location to click so I can enter the required data.
to handle TextBox FileName, SheetName, CellValue1, CellValue2, TextBoxOffset:[200,-2,0,7]
Set myExcelFile to Workbook(ResourcePath(FileName))
Set SheetName to MyExcelFile.Worksheet(SheetName)
Put Cell(SheetName, CellValue1) into Label
Put Cell(SheetName, CellValue2) into Input
put imageRectangle(text:Label)+ TextBoxOffset into OptionArea
Click center of OptionArea
Wait 0.5
TypeText Input, escapeKey
Wait 0.3
end TextBox
With the above example TextboxOffset values are hard coded and I’m looking to pull these values from Excel along with all the other data. I’ve amended the code as below,
to handle TextBox2 FileName, SheetName, CellValue1, CellValue2, CellValue3
Set myExcelFile to Workbook(ResourcePath(FileName))
Set SheetName to MyExcelFile.Worksheet(SheetName)
Put Cell(SheetName, CellValue1) into Label
Put Cell(SheetName, CellValue2) into Input
Put Cell(SheetName, CellValue3) into TextBoxOffset
put imageRectangle(text:Label)+ TextBoxOffset into OptionArea
Click center of OptionArea
Wait 0.5
TypeText Input, escapeKey
Wait 0.3
end TextBox2
But this is failing with the following error. Any idea why this fails when pulling the TextBoxOffset coordinates from Excel please?
SenseTalk Runtime Exception:
Invalid operands for addition: expected numbers, dates and/or lists; got ‘[200,-2,0,7]’ and ‘[391,889,457,902]’