–Open this script in a new Script Editor window.
property s_folder : “Macintosh HD:_Arbeit:suedostschweiz:LQ:”
property d_folder : “Macintosh HD:_Arbeit:suedostschweiz:pdf_ok:”
property error_folder : “Macintosh HD:_Arbeit:suedostschweiz:pdf_Error:”
property all_months : {“JANUAR”, “FEBRUAR”, “MAERZ”, “APRIL”, “MAI”, “JUNI”, “JULI”, “AUGUST”, “SEPT”, “OKT”, “NOV”, “DEZ”}
property front_seite : {“Fr”, “FR”, “fr”, “fR”}
property Foegl_Ladin : {“FL”, “fl”, “Fl”, “fL”, “fö”, “fÖ”, “Fö”, “FÖ”}
property gr_lcp : {“GR”, “gr”, “Gr”, “gR”, “ga”, “GA”, “gA”, “Ga”, “Re”, “RE”, “rE”, “re”}
property lapunt : {“la”, “La”, “LA”, “lA”}
property surmeir : {“su”, “SU”, “sU”, “Su”, “vo”, “VO”, “vO”, “Vo”, “sv”, “SV”, “sV”, “Sv”, “LV”, “lv”, “Lv”, “lV”}
property thema : {“Th”, “TH”, “th”, “tH”, “lq”, “LQ”, “Lq”, “lQ”}
property afinz : {“af”, “AF”, “Af”, “aF”, “az”, “AZ”, “aZ”, “Az”, "A “, “a “}
property radiotv : {“ra”, “RA”, “Ra”, “rA”, “tv”, “TV”, “Tv”, “tV”, “rt”, “RT”, “rT”, “Rt”}
property quai : {“qu”, “QU”, “Qu”, “qU”}
property leer : {””}
property leerschlag : {” "}
tell application “Finder”
set year_folder_list to every folder of folder s_folder
repeat with one_year_folder in year_folder_list
set only_year to name of (contents of one_year_folder)
--[i][color=olive] display dialog only_year[/color][/i]
--[i][color=olive]MONAT[/color][/i]
[b][color=blue]set[/color][/b] [color=green]month_folder_list[/color] [b][color=blue]to[/color][/b] [b][color=blue]every[/color][/b] [color=blue]folder[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]only_year[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]s_folder[/color]
[b][color=blue]repeat[/color][/b] [b][color=blue]with[/color][/b] [color=green]one_month_folder[/color] [b][color=blue]in[/color][/b] [color=green]month_folder_list[/color]
[b][color=blue]set[/color][/b] [color=green]current_month_folder[/color] [b][color=blue]to[/color][/b] [color=blue]name[/color] [b][color=blue]of[/color][/b] ([color=blue]contents[/color] [b][color=blue]of[/color][/b] [color=green]one_month_folder[/color])
[b][color=blue]set[/color][/b] [color=blue]AppleScript[/color]'s [color=blue]text item delimiters[/color] [b][color=blue]to[/color][/b] ""
[b][color=blue]set[/color][/b] [color=green]old_date[/color] [b][color=blue]to[/color][/b] [color=green]current_month_folder[/color]
--[i][color=olive] display dialog old_date[/color][/i]
[b][color=blue]repeat[/color][/b] [b][color=blue]with[/color][/b] [color=green]i[/color] [b][color=blue]from[/color][/b] 1 [b][color=blue]to[/color][/b] 12
[b][color=blue]if[/color][/b] [color=green]old_date[/color] = [color=blue]item[/color] [color=green]i[/color] [b][color=blue]of[/color][/b] [color=green]all_months[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]new_date[/color] [b][color=blue]to[/color][/b] [color=blue]text[/color] -2 [b][color=blue]thru[/color][/b] -1 [b][color=blue]of[/color][/b] ("0" & [color=green]i[/color])
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]end[/color][/b] [b][color=blue]repeat[/color][/b]
--[i][color=olive] display dialog new_date[/color][/i]
--[i][color=olive]TAG [/color][/i]
[b][color=blue]set[/color][/b] [color=green]day_folder_list[/color] [b][color=blue]to[/color][/b] [b][color=blue]every[/color][/b] [color=blue]folder[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]current_month_folder[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]only_year[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]s_folder[/color]
[b][color=blue]repeat[/color][/b] [b][color=blue]with[/color][/b] [color=green]one_day_folder[/color] [b][color=blue]in[/color][/b] [color=green]day_folder_list[/color]
[b][color=blue]set[/color][/b] [color=green]only_day_folder[/color] [b][color=blue]to[/color][/b] [color=blue]name[/color] [b][color=blue]of[/color][/b] ([color=blue]contents[/color] [b][color=blue]of[/color][/b] [color=green]one_day_folder[/color])
--[i][color=olive] PDF File[/color][/i]
[b][color=blue]set[/color][/b] [color=green]pdf_file_list[/color] [b][color=blue]to[/color][/b] [b][color=blue]every[/color][/b] [color=blue]file[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]only_day_folder[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]current_month_folder[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]only_year[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]s_folder[/color]
[b][color=blue]repeat[/color][/b] [b][color=blue]with[/color][/b] [color=green]one_pdf_file[/color] [b][color=blue]in[/color][/b] [color=green]pdf_file_list[/color]
[b][color=blue]set[/color][/b] [color=green]current_pdf_file[/color] [b][color=blue]to[/color][/b] [color=blue]name[/color] [b][color=blue]of[/color][/b] ([color=blue]contents[/color] [b][color=blue]of[/color][/b] [color=green]one_pdf_file[/color])
--[i][color=olive] display dialog current_pdf_file as string[/color][/i]
[b][color=blue]set[/color][/b] [color=blue]AppleScript[/color]'s [color=blue]text item delimiters[/color] [b][color=blue]to[/color][/b] ""
[b][color=blue]set[/color][/b] [color=green]one_pdf[/color] [b][color=blue]to[/color][/b] [color=green]current_pdf_file[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
--[i][color=olive] display dialog one_pdf[/color][/i]
[b][color=blue]set[/color][/b] [color=green]zeitung[/color] [b][color=blue]to[/color][/b] "laqu"
--[i][color=olive] display dialog zeitung[/color][/i]
[b][color=blue]set[/color][/b] [color=blue]AppleScript[/color]'s [color=blue]text item delimiters[/color] [b][color=blue]to[/color][/b] "."
[b][color=blue]if[/color][/b] [color=blue]text item[/color] -2 [b][color=blue]of[/color][/b] [color=green]one_pdf[/color] [b][color=blue]contains[/color][/b] "sam" [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]pagina_1[/color] [b][color=blue]to[/color][/b] [color=blue]text item[/color] -3 [b][color=blue]of[/color][/b] [color=green]one_pdf[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]if[/color][/b] ([color=blue]count[/color] [b][color=blue]of[/color][/b] [color=green]pagina_1[/color]) [b][color=blue]is[/color][/b] 2 [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]pagina_1[/color] [b][color=blue]to[/color][/b] [color=blue]items[/color] -2 [b][color=blue]thru[/color][/b] -1 [b][color=blue]of[/color][/b] [color=green]pagina_1[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]set[/color][/b] [color=blue]AppleScript[/color]'s [color=blue]text item delimiters[/color] [b][color=blue]to[/color][/b] ""
[b][color=blue]set[/color][/b] [color=green]pagina_a[/color] [b][color=blue]to[/color][/b] [color=blue]item[/color] 1 [b][color=blue]of[/color][/b] [color=green]pagina_1[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]set[/color][/b] [color=green]pagina_b[/color] [b][color=blue]to[/color][/b] [color=blue]item[/color] 3 [b][color=blue]of[/color][/b] [color=green]pagina_1[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]set[/color][/b] [color=green]pagina_1[/color] [b][color=blue]to[/color][/b] [color=green]pagina_a[/color] & [color=green]pagina_b[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]else[/color][/b]
[b][color=blue]set[/color][/b] [color=green]pagina_1[/color] [b][color=blue]to[/color][/b] "0" & [color=blue]item[/color] -1 [b][color=blue]of[/color][/b] [color=green]pagina_1[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]else[/color][/b]
[b][color=blue]set[/color][/b] [color=green]pagina_1[/color] [b][color=blue]to[/color][/b] [color=blue]items[/color] -6 [b][color=blue]thru[/color][/b] -5 [b][color=blue]of[/color][/b] [color=green]one_pdf[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]set[/color][/b] [color=blue]AppleScript[/color]'s [color=blue]text item delimiters[/color] [b][color=blue]to[/color][/b] ""
[b][color=blue]set[/color][/b] [color=green]pagina_a[/color] [b][color=blue]to[/color][/b] [color=blue]item[/color] 1 [b][color=blue]of[/color][/b] [color=green]pagina_1[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]set[/color][/b] [color=green]pagina_b[/color] [b][color=blue]to[/color][/b] [color=blue]item[/color] 3 [b][color=blue]of[/color][/b] [color=green]pagina_1[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]set[/color][/b] [color=green]pagina_1[/color] [b][color=blue]to[/color][/b] [color=green]pagina_a[/color] & [color=green]pagina_b[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
--[i][color=olive] display dialog pagina_1[/color][/i]
--[i][color=olive] File[/color][/i]
[b][color=blue]set[/color][/b] [color=blue]AppleScript[/color]'s [color=blue]text item delimiters[/color] [b][color=blue]to[/color][/b] "."
[b][color=blue]set[/color][/b] [color=blue]AppleScript[/color]'s [color=blue]text item delimiters[/color] [b][color=blue]to[/color][/b] ""
[b][color=blue]set[/color][/b] [color=green]filedate[/color] [b][color=blue]to[/color][/b] [color=blue]text items[/color] 1 [b][color=blue]thru[/color][/b] 2 [b][color=blue]of[/color][/b] [color=green]only_day_folder[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]set[/color][/b] [color=green]pagina[/color] [b][color=blue]to[/color][/b] [color=blue]items[/color] 1 [b][color=blue]thru[/color][/b] 2 [b][color=blue]of[/color][/b] [color=green]pagina_1[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
--[i][color=olive] set pagina to "0" & items 1 thru 2 of pagina_1 as string[/color][/i]
--[i][color=olive] resort[/color][/i]
[b][color=blue]set[/color][/b] [color=green]stellen[/color] [b][color=blue]to[/color][/b] [color=blue]items[/color] 7 [b][color=blue]thru[/color][/b] 8 [b][color=blue]of[/color][/b] [color=green]one_pdf[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]set[/color][/b] [color=green]eineStelle[/color] [b][color=blue]to[/color][/b] [color=blue]item[/color] 7 [b][color=blue]of[/color][/b] [color=green]one_pdf[/color]
[b][color=blue]if[/color][/b] [color=green]eineStelle[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]leerschlag[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]ddd[/color] [b][color=blue]to[/color][/b] 8
[b][color=blue]set[/color][/b] [color=blue]AppleScript[/color]'s [color=blue]text item delimiters[/color] [b][color=blue]to[/color][/b] "."
[b][color=blue]repeat[/color][/b] [b][color=blue]with[/color][/b] [color=green]x[/color] [b][color=blue]in[/color][/b] [color=blue]text item[/color] 3 [b][color=blue]of[/color][/b] [color=green]one_pdf[/color]
[b][color=blue]if[/color][/b] [color=green]x[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]leerschlag[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=blue]AppleScript[/color]'s [color=blue]text item delimiters[/color] [b][color=blue]to[/color][/b] ""
[b][color=blue]set[/color][/b] [color=green]stellen[/color] [b][color=blue]to[/color][/b] [color=blue]items[/color] [color=green]ddd[/color] [b][color=blue]thru[/color][/b] ([color=green]ddd[/color] + 1) [b][color=blue]of[/color][/b] [color=green]one_pdf[/color] [b][color=blue]as[/color][/b] [color=blue]string[/color]
[b][color=blue]set[/color][/b] [color=green]ddd[/color] [b][color=blue]to[/color][/b] [color=green]ddd[/color] + 1
[b][color=blue]set[/color][/b] [color=blue]AppleScript[/color]'s [color=blue]text item delimiters[/color] [b][color=blue]to[/color][/b] "."
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]end[/color][/b] [b][color=blue]repeat[/color][/b]
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]set[/color][/b] [color=blue]AppleScript[/color]'s [color=blue]text item delimiters[/color] [b][color=blue]to[/color][/b] ""
[b][color=blue]if[/color][/b] [color=green]stellen[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]front_seite[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]resort[/color] [b][color=blue]to[/color][/b] "01"
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]if[/color][/b] [color=green]stellen[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]Foegl_Ladin[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]resort[/color] [b][color=blue]to[/color][/b] "02"
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]if[/color][/b] [color=green]stellen[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]gr_lcp[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]resort[/color] [b][color=blue]to[/color][/b] "03"
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]if[/color][/b] [color=green]stellen[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]lapunt[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]resort[/color] [b][color=blue]to[/color][/b] "04"
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]if[/color][/b] [color=green]stellen[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]surmeir[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]resort[/color] [b][color=blue]to[/color][/b] "05"
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]if[/color][/b] [color=green]stellen[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]thema[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]resort[/color] [b][color=blue]to[/color][/b] "06"
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]if[/color][/b] [color=green]stellen[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]quai[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]resort[/color] [b][color=blue]to[/color][/b] "07"
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]if[/color][/b] [color=green]stellen[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]afinz[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]resort[/color] [b][color=blue]to[/color][/b] "09"
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]if[/color][/b] [color=green]stellen[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]radiotv[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]resort[/color] [b][color=blue]to[/color][/b] "22"
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
[b][color=blue]if[/color][/b] [color=blue]item[/color] 7 [b][color=blue]of[/color][/b] [color=green]one_pdf[/color] [b][color=blue]is[/color][/b] [b][color=blue]in[/color][/b] [color=green]leer[/color] [b][color=blue]then[/color][/b]
[b][color=blue]set[/color][/b] [color=green]resort[/color] [b][color=blue]to[/color][/b] "xx"
[b][color=blue]end[/color][/b] [b][color=blue]if[/color][/b]
--[i][color=olive]display dialog one_pdf as string[/color][/i]
[b][color=blue]set[/color][/b] [color=green]newfilename[/color] [b][color=blue]to[/color][/b] [color=green]pagina[/color] & "_" & [color=green]zeitung[/color] & "_" & [color=green]resort[/color] & "_" & [color=green]only_year[/color] & "-" & [color=green]new_date[/color] & "-" & [color=green]filedate[/color] & ".pdf"
--[i][color=olive] display dialog newfilename[/color][/i]
[b][color=blue]set[/color][/b] [color=blue]name[/color] [b][color=blue]of[/color][/b] [color=blue]file[/color] [color=green]current_pdf_file[/color] ¬
[b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]only_day_folder[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]current_month_folder[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]only_year[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]s_folder[/color] [b][color=blue]to[/color][/b] [color=green]newfilename[/color]
[color=blue]move[/color] [color=blue]file[/color] [color=green]newfilename[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]only_day_folder[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]current_month_folder[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]only_year[/color] [b][color=blue]of[/color][/b] [color=blue]folder[/color] [color=green]s_folder[/color] [color=blue]to[/color] [color=blue]folder[/color] [color=green]d_folder[/color]
--
[b][color=blue]end[/color][/b] [b][color=blue]repeat[/color][/b]
[b][color=blue]end[/color][/b] [b][color=blue]repeat[/color][/b]
[b][color=blue]end[/color][/b] [b][color=blue]repeat[/color][/b]
[b][color=blue]end[/color][/b] [b][color=blue]repeat[/color][/b]
end tell