-- Calendar 1 Template -- 1 October 96, vs -- Copyright 1996, Adobe Corporation. All rights reserved. -- This script will allow you to create a calendar for -- a month and year which you select in the dialog. -- Script must be run on an opened publication.It will -- use existing margin settings for positioning the calendar. set "Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember" >> m -- weekdays count starting Sunday set "S","M","D","M","D","F","S" >>weekdays.sun -- weekdays count starting Monday set "M","D","M","D","F","S","S" >>weekdays.mon getpmstate >> pmstate if pmstate=1 message "Öffnen Sie eine Satzdatei." message "Die Kalendertabelle wird" message "innerhalb des Begrenzungsrahmens erstellt." rem return endif deselect getobjectlist => nObj,... getplatform => def if def=MACINTOSH dialogbegin -120,-180,140,45,"Kalender" pushbutton 180,15,240,35,"OK" pushbutton 180,50,240,70,"Abbrechen" listbox 10,10,150,154,m listbox 160,90,240,154,"1996","1997","1998","1999","2000","2001","2002" radiobutton 10,172,240,192,"Montag als erster Wochentag",1 radiobutton 10,194,240,214,"Sonntag als erster Wochentag",0 dialogend => ButtonHit,...,...,month,year,w.mon,... elseif def=WINDOWS dialogbegin -50,-72,75,30,"Kalender" pushbutton 70,6,109,18,"OK" pushbutton 70,24,109,36,"Abbrechen" listbox 10,4,60,68,m listbox 70,42,100,68,"1996","1997","1998","1999","2000","2001","2002" radiobutton 4,72,110,82,"Montag als erster Wochentag",1 radiobutton 4,84,110,94,"Sonntag als erster Wochentag",0 dialogend => ButtonHit,...,...,month,year,w.mon,... endif if (ButtonHit="Abbrechen")+empty(ButtonHit) return endif if w.mon weekdays = weekdays.mon else weekdays = weekdays.sun endif getsize => size getalignment => alignment getindents => indents getmeasureunits=>measureunits rem Script works with inches. rem If pub has other measureunits rem this will be restored at the end of the script. measureunits 0,0,-2 set month#m=>month set ~""(year)=>year // calculate day of the week of the 1st of the requested month set year-1900=>w set not (w%4)=>leap set w+1=>w set w+trunc(w/4-0.04)=>w set 0,3,3,6,1,4,6,2,5,0,3,5=>d set w+d(month)=>w if leap*(month<3) set w-1=>w endif w = w-w.mon w= w%7 getcolumnguides => n,... box column,left,column,top,column,n,right,column,bottom getobjectloc lefttop => xL,yT getobjectloc rightbottom => xR,yB clear minisave selectall try clear getpagerect >> ...,...,x,y getpagemargins =>l,t,r,b set xR-xL=>xmargin set yB-yT=>ymargin set xmargin/8=>xbox set ymargin/7=>ybox loop i=1,8 if i # 4,7 line xL+xbox*i,yT,xL+xbox*i,yB-2*ybox else line xL+xbox*i,yT,xL+xbox*i,yB-ybox endif endloop loop i=0,6 line xL+xbox,yT+i*ybox,xL+xbox*8,yT+i*ybox endloop set 31,28+not(year%4),31,30,31,30,31,31,30,31,30,31=>month.len size 3*min(xmargin,ymargin) indents xbox/5,0,0 loop date=1,month.len(month) set w+date-1=>weekday newstorysized xL+xbox+xbox*(weekday%7),yT+ybox*trunc(weekday/7)+ybox/7,xL+2*xbox+xbox*(weekday%7),yT+ybox*trunc(weekday/7)+ybox textenter ""(date) endloop deselect size 5*min(xmargin,ymargin) alignment center typestyle bold loop i=1,7 newstorysized xL+xbox*i,yB-ybox+ybox/7,xL+xbox+xbox*i,yB textenter weekdays(i) endloop deselect size 8*min(xmargin,ymargin) newstory column,left,column,bottom textenter m(month)+" "+""(year) deselect select last,left,last,top resize bottom,y resizepct right,ymargin/xmargin*100 rotate lefttop,90 resize righttop,column,left,column,top -- create little calendar for previous and next month newstorysized xL+xbox*3.125,yT+ybox*5.1,xL+xbox*4.875,yT+ybox*6 size max(4,1*min(xmargin,ymargin)) alignment left spaceoptions -2,-2,-2,180 minitabs = 7 loop i = 0,6 minitabs = minitabs,0,2*xbox*i/7.5," " endloop tabs minitabs indents 0,0,0 month.prev = month-1 year.prev = year if month.prev=0 month.prev = 12 year.prev = year.prev-1 endif textenter m(month.prev) textenter " " w.prev = w + 70 - month.len(month.prev) w.prev = w.prev%7 if w.prev loop i = 1,w.prev textenter " " endloop endif loop i = 1,month.len(month.prev) textenter ""(i)+" " if (w.prev+i)%7=0 textselect -char textenter " " endif endloop deselect select last,left,last,top getobjectloc top >> ...,y1 getobjectloc bottom >> ...,y2 textedit;selectall spaceoptions -2,-2,-2,min(180*0.85*ybox/(y2-y1),200) newstorysized xL+xbox*6.125,yT+ybox*5.1,xL+xbox*7.875,yT+ybox*6 size max(4,1*min(xmargin,ymargin)) alignment left spaceoptions -2,-2,-2,180 minitabs = 7 loop i = 0,6 minitabs = minitabs,0,2*xbox*i/7.5," " endloop tabs minitabs indents 0,0,0 month.next = month+1 year.next = year if month.next=13 month.next = 1 year.next = year.next+1 endif textenter m(month.next) textenter " " w.next = w + month.len(month) w.next = w.next % 7 if w.next loop i = 1,w.next textenter " " endloop endif loop i = 1,month.len(month.next) textenter ""(i)+" " if (w.next+i)%7=0 textselect -char textenter " " endif endloop select last,left,last,top getobjectloc top >> ...,y1 getobjectloc bottom >> ...,y2 textedit;selectall spaceoptions -2,-2,-2,min(180*0.85*ybox/(y2-y1),200) deselect selectall;cut revert minisaved multiplepaste 1,0,0 group deselect size size alignment alignment indents indents measureunits measureunits return