Hey folks,
Me again, I’m sure driving you nuts by now but I’m curious, I’m try to get this repeat working, I can get it to read through the table, if everything is there it cycles correctly, my issue is coming with erroring it out, essentially the premise of the subroutine is to read through the table confirm whether the info matches/contains the info, if it does to pass over it, if it does not then to error it out and whatever item of the table/list its on (hence why I have the logs in the repot currently for test) to return that to another variable for a further subroutine for updating the info but that’s for another item.
As ever I appreciate the knowledge, the experience and learning that always comes from these questions.
use AppleScript version "2.8" -- Yosemite (10.10) or later
use scripting additions
use framework "Appkit"
on run
set formSheet to "Roster" -- Roster Sheet
set pTable to "People Input" -- People Table
set taskName to ""
set peopleTable to {¬
{name:"Name", value:"Test 1"}, ¬
{name:"ManName", value:"Test 2"}, ¬
{name:"Chat", value:"#Test 3"}, ¬
{name:"E-Mail", value:"Test 4@group.email.com"}, ¬
{name:"Man Chat", value:"#Test 5"}, ¬
{name:"Meeting", value:"Test 6"}, ¬
{name:"Man Meet", value:"Test 7"} ¬
}
set peopleList to {"Name", "ManName", "Chat", "E-Mail", "Man Chat", "Meeting", "Man Meet"}
tell application "Numbers"
launch
activate
tell document 1
delay 0.5
try
tell table pTable of sheet formSheet
repeat with i from 1 to 7
try
if i ≤ length of peopleTable then
set cellValue to value of cell ("A" & i)
log cellValue
set checkVal to item i of peopleList
log checkVal
set checkName to name of item i of peopleTable
log checkName
if cellValue is equal to checkVal then
-- Correct cell contains checkVal, continue loop
else if cellValue is not equal to checkVal then
exit repeat
-- Cell does not contain checkVal and exit loop
end if
end if
on error
set taskName to checkName
log taskName
display dialog "Value mismatch" buttons {"OK"} default button "OK" giving up after 15
exit repeat
end try
end repeat
end tell
end try
end tell
end tell
end run
Screen shot of the table to see what I’m referencing for: