J'essaie de vérifier les valeurs pour un compte précis, mais j'ai des problèmes avec le processus de progression. Compte tenu de l'extraction de:Incrément à travers des lignes pointillées dans AppleScript?
1-1
2-1
3-1
4-1
5-1
6-1
7-1
7-2
8-1
9-1
9-2
9-3
9-4
10-1
11-1
12-2 ## intentionally left out 12-1 to throw error
13-1
comment puis-je incrémenter correctement à travers la liste et marquer si un est manquant. Quand je lance mon script, il passe par 7-2
mais quand il s'agit de 8-1
il échoue avec:
Un marqueur enfant semble manquer.
le code:
tell application "BBEdit"
activate
set parentCount to 1
set childCount to 1
set theDoc to text document 1
select insertion point before first character of theDoc
set searchOpt to {search mode:grep, wrap around:false}
repeat
set theNumbers to find "^(\\d{1,4})-(\\d{1,4})" searching in text 1 of theDoc options searchOpt with selecting match
if not found of theNumbers then exit repeat
set parentNum to (grep substitution of "\\1") as number
set childNum to (grep substitution of "\\2") as number
if parentNum is equal to parentCount and childNum is equal to childCount then
set parentCount to parentCount + 1
else if parentNum is equal to parentCount and (childNum + 1) is equal to childCount then
set parentCount to parentCount + 1
set childCount to 1
else
display dialog "missing marker"
end if
end repeat
display dialog "completed check"
end tell
En AppleScript comment puis-je augmenter correctement à travers une séquence de nombres?