Я создал скрипт Applescript, в котором я использую цикл повторения, чтобы он продолжался.Цикл сделан таким образом, что я могу использовать ESC или кнопку «Отмена» для перемещения назад, когда он показывает диалоговое окно или список выбора.
Однако !!!Часть «перемещение назад» работает безупречно, когда я запускаю скрипт из редактора, но когда я запускаю его как приложение, он работает только на половине пути назад.Как только я доберусь до определенной точки, приложение просто закроется.Это не дает мне никакого отчета о сбое или чего-либо еще, оно просто закрывается.
Цикл / повтор выглядит следующим образом:
set theAction to "choose type"
set breakRepeat to false
repeat while breakRepeat is false
if theAction is "choose type" then
set myType to (choose from list {"Børnehaver", "Skoler"} with title "VÆLG TYPE")
if myType is "Børnehaver" then
set myType to "BORNEHAVER"
else if myType is "Skoler" then
set myType to "SKOLER"
else if myType is false then
try
set myExit to (button returned of (display dialog "Vil du afslutte?" with title "Afslut?" buttons {"Annullér", "Afslut"} cancel button "Annullér" default button "Afslut"))
on error
set myExit to "choose type"
end try
if myExit is "Afslut" then
set breakRepeat to true
end if
else
set theAction to "choose year"
end if
else if theAction is "choose year" then
set theYears to getfolders(alias ((myType & ":") as string), "theYears")
set chosenYear to choosefromlist(theYears, "alias", false, -2, "VÆLG" & space & myType & "-år", "Vælg skoleår:")
if chosenYear is false then
set theAction to "choose type"
else
set theAction to "choose school"
end if
else if theAction is "choose school" then
set theSchools to getfolders(chosenYear, "theSchools")
set chosenSchool to choosefromlist(theSchools, "alias", false, -2, "VÆLG SKOLE:", "Vælg skole:")
if chosenSchool is false then
set theAction to "choose year"
else
set theAction to "choose UID"
end if
else if theAction is "choose UID" then
try
set chosenUID to searchjpgs(chosenSchool)
set chosenUIDfiles to choosefromlist(chosenUID, "alias", false, -1, "VÆLG FIL:", "Vælg fil:")
if chosenUIDfiles is false then
set theAction to "choose school"
else
set theAction to "info for file"
end if
on error
set theAction to "choose school"
end try
else if theAction is "info for file" then
set theAction to fileinfo(chosenUIDfiles)
else if theAction is "build package" then
set chosenPackages to buildpackage(mypackages, chosenUIDfiles)
if chosenPackages is false then
set theAction to "choose UID"
else
makeprintfiles(chosenUIDfiles, chosenPackages)
set theAction to "choose UID"
end if
end if
end repeat