View Single Post
The problem is that you're reading that number in as a string, not a number. After that is resolved, the rest of the code doesn't work quite right, at least as I understand the goal. I've attached a version that figures out how many whole pomodori are required, plus the minutes of a fractional pomodoro, plus a 5 minute break after each full pomodoro. If it's not what you wanted, well, as my long-ago boss was fond of saying, you know where the sources are...

Code:
(* test values: 0 15 25 26 76 300 301 325 326 *)

property pFullPomodoroMinutes : 25
property pFullPomodoroBreak : 5
property pHour : 60

set requestedMinutes to the clipboard as integer

set numberOfPomodoros to requestedMinutes div pFullPomodoroMinutes
set fractionalPomodoroMinutes to requestedMinutes - (numberOfPomodoros * pFullPomodoroMinutes)

set totalMinutes to numberOfPomodoros * (pFullPomodoroMinutes + pFullPomodoroBreak) + fractionalPomodoroMinutes

set pomodoroHours to totalMinutes div pHour
set pomodoroMinutes to totalMinutes - (pomodoroHours * pHour)

display dialog "Total full pomodoros : " & numberOfPomodoros & " +" & fractionalPomodoroMinutes & " additional minutes" & return & "Total pomodoro time: " & pomodoroHours & " hours " & pomodoroMinutes & " minutes" buttons {"OK"} default button 1