iCal:Arbeitszeiterfassung die 3.

15/09/2011
Sodele ich habe das Skript nun etwas umgeschrieben.
  • das Skript hat nun eine reine Update-Funktion für die Statistik (zur Zeit auf 8 Wochen eingestellt, um bei großen Kalendern die Bearbeitungszeit zur verkürzen)
  • Bei der Statistik werden nun alle nicht-allday-Events berücksichtigt, die eine Dauer größer 1min haben, d.h. Aufgaben werde nun auf die Minute genau erfasst und nicht auf 5min gerundet
  • Die Statstitik wird nun nicht nur für die aktuelle Woche/Monat aktualisiert, sondern für alle Wochen und Monate, die aktuelle Event andauert
  • Das Skript erkennt nun Events an die wie bisher ein Open in der Beschreibung haben, die als Allday-Event angelegt wurden und keine Statistik-Events sind und Events die die gleiche Anfangs- wie Endzeit haben
  • Wählt man ein AllDay-Event zum Abschließen aus, fragt das Skript nach der Anfangs-Uhrzeit des Events.
DOWNLOAD
iCal_Time_Recording_2011_09_15 v.1.3
192.7 kB (113 hits)

@macupdate
@YouTube
2 Comments

iCal: Arbeitszeiterfassung die 2.

12/08/2011

Marko hat mich gebeten das Zeiterfassungs-Skript, dass ich mal vor einiger Zeit geschrieben habe, etwas zu erweitern, so dass auch einen Statistik für den gesamten Monat ausgegeben wird. Zudem ist in diese Version auch ein Growl-Status-Anzeige eingebaut, so dass das Skript nicht kommentarlos den Kalender befüllt. Ich habe das Skript mit 10.7 getestet, ich denke es sollte aber auch problemlos noch unter den letzten beiden System funktionieren (Die App müsste eine reine Intel App sein, da 10.7 nicht anderes mehr auszugeben versteht. Auf einem PPC müsste der AppleScript-Editor aber damit zurande kommen, also in dem Fall einfach neu als App speichern und man hat wieder eine CarbonApp) =)DOWNLOAD
iCal_Time-Recording v.1.2
191.69 kB (98 hits)

7 Comments

iCal: Liste der heutigen Events

11/03/2011
Gibt eine Liste der Events aus, die am heutigen Tag beginnen und auch enden...

getThisDaysEvents_List("Hubi")


on getThisDaysEvents_List(calendarname)

tell application "iCal"

set startdate to (current date) - ((minutes of (current date)) * 60) - ((hours of (current date)) * 60 * 60) - (seconds of (current date))

set enddate to startdate + (3600 * 24)

tell calendar calendarname

set eventnames to summary of every event whose start date > startdate and end date < enddate

set event_starts to start date of every event whose start date > startdate and end date < enddate

end tell

set myoutput to ""

repeat with i from 1 to count of eventnames

set myoutput to myoutput & "" & (characters 1 through -4 of (time string of item i of event_starts)) & "  " & item i of eventnames & return

end repeat

set myoutput to my BubbleSort(every paragraph of myoutput)

set AppleScript's text item delimiters to return

set myoutput to myoutput as text

set AppleScript's text item delimiters to ""

return "Events @ " & date string of (current date) & ":" & return & myoutput

end tell

end getThisDaysEvents_List

on BubbleSort(theList)

if class of theList is list then

set theSize to length of theList

repeat with i from 1 to theSize

repeat with j from 2 to (theSize - i + 1)

if ((item (j - 1) of theList) > (item j of theList)) then

set temp to (item (j - 1) of theList)

set (item (j - 1) of theList) to (item j of theList)

set (item j of theList) to temp

end if

end repeat

end repeat

return theList

else

return false

end if

end BubbleSort

No Comments

iCal: Importiere abonnierten Kalender in Lokalen…

7/11/2010
Code zum markieren einmal anklicken Code im Skript-Editor öffnen

tell application "iCal"

activate

##wähle eine Kalender aus und ermittle seine UID

## dies ist auch der Ordnername im ~/Library/Calendars in dem die plist mit

## der URL des Kalenders liegt

set callist to (name of every calendar whose writable is false)

set callist2 to (name of every calendar whose writable is true)

set callToExport to (choose from list callist default items (item 1 of callist) with prompt "Exportiere…:")

set callToImport to (choose from list callist2 default items (item 1 of callist2) with prompt "Importiere in…:")

if callToExport is not false and callToImport is not false then

set callUID to uid of calendar (callToExport as text)

##nun die URL des Kalenders auslesen

set myurl to (do shell script "defaults read ~/Library/Calendars/" & callUID & ".calendar/Info SubscriptionURL")

if myurl starts with "webcal" then

set myurl to "http" & (characters 7 through -1 of myurl) as text

end if

##sollte ein kennwort für den Download notwendig sein:

## set myusername to "username"

## set mypassword to "geheim"

## set myurl to "http://" & myusername & ":" & mypassword & "@" & (characters 8 through -1 of myurl) as text

#####

do shell script "cd /tmp;curl " & myurl & " > " & quoted form of (callToExport as text) & ".ics;open " & quoted form of (callToExport as text) & ".ics"

delay 1

activate application "iCal"

tell application "System Events"

tell process "iCal"

click pop up button 1 of window "Ereignisse hinzufügen"

keystroke (callToImport as text)

delay 0.25

keystroke return

delay 0.25

keystroke return

end tell

end tell

end if

end tell


No Comments

iCal: Kalenderwochen als Wochenereignis

24/10/2010
Damit werden die Kalenderwochen in einen ausgewählten Kalender eingetragen und zwar als Ganztags-Ereignisse, die die gesamte Woche Andauern:

Update

Nach ein paar Bugs die von Skeeve gefunden wurden und motiviert durch die Antwort von Epocs, habe ich bei Wikipedia mal die Definition von Kalenderwochen per DIN 1355 / ISO 8601 studiert. Ich denke das Skript sollte sich wohl nun an das korrekte Regelwerk halten und lückenlos Kalenderwochen erstellen, auch wenn mal ein Jahres-Wechsel in der Woche liegen sollte.
Code zum markieren einmal anklicken Code im Skript-Editor öffnen

-- hubionmac.com 24.10.2010 TESTED USING Mac OS 10.6.4

-- Erstellt Kalenderwochen als Ganztagsergeinis/Wochenereignis in iCal

-- das ganze per Zählweise nach DIN 1355 / ISO 8601 ;-)

-- d.h. Jeden Montag und nur montags beginnt eine neue Kalenderwoche.

-- und Die erste Kalenderwoche ist diejenige, die mindestens 4 Tage des neuen Jahres enthält.

set myyear to my getyear()

tell application "iCal" to set icals to name of every calendar whose writable is true

set mycal to choose from list icals

if myyear is not 0 and mycal is not false then

set erste_kw_tag to get_years_first_thursday(myyear) - (3 * days)

tell application "iCal"

tell calendar (mycal as text)

set kwcounter to 0

set kwstart to erste_kw_tag

set kwstop to kwstart + 7 * days

repeat until year of kwstop is (myyear + 1)

set kwcounter to kwcounter + 1

set last_kw to make new event at end of events with properties {summary:"KW " & kwcounter, start date:kwstart, end date:kwstop, allday event:true}

set kwstart to kwstart + 7 * days

set kwstop to kwstart + 7 * days

end repeat

set lastthuesday to kwstop - 4 * days

if year of lastthuesday is myyear then

set last_kw to make new event at end of events with properties {summary:"KW " & kwcounter + 1, start date:kwstart, end date:kwstop, allday event:true}

end if

end tell

end tell

end if

on get_years_first_thursday(theyear)

set c to my theyeardate(theyear)

set i to 0

repeat until weekday of c is Thursday

set i to i + 1

set day of c to (day of c) + 1

end repeat

return c

end get_years_first_thursday

on theyeardate(theyear)

set c to current date

set year of c to theyear

set day of c to 1

set month of c to 1

--Since ical acts a bit strange on dates before 10.6

if (characters 1 through 4 of (do shell script "sw_vers -productVersion") as text) is in {"10.3", "10.4", "10.5"} then

set hours of c to 12

else

set hours of c to 0

end if

set minutes of c to 0

set seconds of c to 0

return c

end theyeardate

on getyear()

set myyear to year of (current date)

set myyears to {}

repeat with i from 1 to 10

set myyears to myyears & (myyear - 5 + i)

end repeat

return (choose from list myyears default items myyear) as integer

end getyear

Und hier die KWs als in eine iCal .ics Datei von 2010-2015
1 Comment

AppleScript: Etwas eigenartige Datumsliste

25/02/2010
Es ging darum, eine Liste von Terminen zu bauen und zwar auf Grundlage von etwas eigenwillig formatierten Strings... wem auch immer das helfen mag =)
Code zum markieren einmal anklicken Code im Skript-Editor öffnen

--1/29

--2/22, 24, 26 (to return three different dates)

--2/22-25 (return four different dates)

--2/23-25, 27-28, 3/30 (return six different dates)

--2/21, 23, 25-27 (return five different dates)

--12/22-25, 1/1-2 works too =)

-- and even 1/25-2/1

set mydates to my makeDateList("1/25-2/1")

repeat with mydate in mydates

my addToiCal("MyDate2StringCalendar", mydate, mydate, "blaBla", "mydesc")

end repeat


------------------------------

on makeDateList(datestring)

set myoutput to {}

set AppleScript's text item delimiters to ","

set mydates to every text item of datestring

set AppleScript's text item delimiters to ","

set cd to (current date) - (time of (current date))

set day of cd to 1

set month of cd to 1

repeat with mydate_string in mydates

set mydate_string to delete_space(mydate_string as text)

if mydate_string contains "-" then

set AppleScript's text item delimiters to "-"

set StartDate to text item 1 of mydate_string

set EndDate to text item 2 of mydate_string

set AppleScript's text item delimiters to ""

copy string2date(StartDate, cd) to StartDate

copy string2date(EndDate, cd) to EndDate

copy {StartDate} to tempDateList

if StartDate < EndDate then

repeat until StartDate = EndDate

set StartDate to StartDate + 60 * 60 * 24

set tempDateList to tempDateList & StartDate

copy StartDate to cd

end repeat

set myoutput to myoutput & tempDateList

else

error "StartDate is not < EndDate!!"

end if

else

copy string2date(mydate_string, cd) to currentDate

set myoutput to myoutput & currentDate

end if

end repeat

return myoutput

end makeDateList


on delete_space(thestring)

repeat with i from 1 to count of characters of thestring

if last character of thestring = " " then

set thestring to (((characters 1 through -2 of thestring) as text) as text)

set is_modified to true

else

exit repeat

end if

end repeat

repeat with i from 1 to count of characters of thestring

if first character of thestring = " " then

set thestring to (((characters 2 through -1 of thestring) as text) as text)

set is_modified to true

else

exit repeat

end if

end repeat

return thestring

end delete_space


on string2date(thestring, datedummy)

--works with 23 or 1/12 (so day only or month/day)

copy datedummy to whereIStarted

if thestring contains "/" then

set AppleScript's text item delimiters to "/"

set theday to (text item 2 of thestring) as integer

set themonth to (text item 1 of thestring) as integer

set AppleScript's text item delimiters to ""

set month of datedummy to themonth

set day of datedummy to theday

-- if we started last year and should end up in next year... so what

if datedummy < whereIStarted then

set year of datedummy to (year of datedummy) + 1

end if

else

set theday to thestring as integer

set day of datedummy to theday

end if

return datedummy

end string2date


on addToiCal(CalendarTitle, StartDate, EndDate, mySummary, mydescription)

tell application "iCal"

if calendar CalendarTitle exists then

else

make new calendar with properties {name:CalendarTitle}

end if

tell calendar CalendarTitle

make new event at end of events with properties {start date:StartDate, end date:EndDate, summary:mySummary, description:mydescription, allday event:true}

end tell

end tell

end addToiCal


Kleines Update des Codes, da war noch ein Bug drin, der zu einem Endlos-Loop führen konnte...
Zudem ist das jetzt mal ein RealLive-Beispiel, mit Eintragung in iCal =)

No Comments

(Arbeits-)Zeiterfassung mit iCal

17/08/2008

Ich kann mich erinnern, dass ich als Azubi noch von Hand mein Berichtsheft mit iCal erfasst habe. So hatte ich zudem noch ein Überblick über meine Überstunden.Das ganze dann ansehnlich auszudrucken war eine andere Geschichte =) Nun war die Idee aber diese Form der Zeiterfassung (15min die Aufgabe, 6 Stunden die andere...) etwas einfacher von der Erfassung zu machen, so dass man das mit einem Programm-Aufruf ,am besten komplett ohne die Maus zu benutzten, die Einträge erledigen kann. So ist dieses Skript (iCal_Time-Recording) entstanden.

Funktionen:

  • Erstellt iCal Ereignisse in einem bestimmen Kalender bzw. setzt deren Entpunkt zum jeweiligen zum momentanen Zeitpunkt (rundet die Zeit auf 5 min genau auf oder ab)
  • Alle abgeschlossenen Ereignisse (Notiz -> closed) werden in einer Statistic aufgeführt. Diese Statistik wird in der Beschreibung eines Ganz-Tags-Events am Sonntag der jeweiligen Woche gespeichert.

Hier ein kleiner Film, der das Programm in Aktion zeigt:

iCal Time Recording

Und natürlich der Download des Applescript-Programmes:

DOWNLOAD
iCal_Time-Recording app v.1.0
180.67 KB (357 hits)
6 Comments