Permalink
Browse files

Fix Merlin script

  • Loading branch information...
1 parent 64289e1 commit b7665c4d33612db56954dddd5b31bb9aff1c9042 @jwiegley committed Aug 13, 2012
Showing with 40 additions and 49 deletions.
  1. +40 −49 init.el
View
@@ -2548,61 +2548,52 @@ FORM => (eval FORM)."
(do-applescript
(format
"
-tell application \"Merlin\"
- activate
-
- set act to 0
-
- set listActivity to every activity of first document
- repeat with oneActivity in listActivity
- if subtitle of oneActivity is \"%s\" then
- set act to oneActivity
- exit repeat
- end if
- end repeat
-
- if act is 0 then
- set myselection to selected object of main window of first document as list
-
- if (count of myselection) is 0 then
- display dialog \"Please select activity to set time for\" buttons {\"OK\"}
- else
- set act to beginning of myselection
- end if
- end if
-
- if act is 0 or (class of act is project) or (is milestone of act is true) then
- display dialog \"Cannot locate activity for %s\" buttons {\"OK\"}
- else
- tell act
- if ((class is not project) and (is milestone is not true)) then
- set actual start date to (date \"%s\")
- set given actual work to {amount:%s, unit:%s, floating:false, ¬
- relative error:0}
- if %s then
+ tell application \"Merlin\"
+ activate
+
+ set act to 0
+
+ set listActivity to every activity of first document
+ repeat with oneActivity in listActivity
+ if subtitle of oneActivity is \"%s\" then
+ set act to oneActivity
+ exit repeat
+ end if
+ end repeat
+
+ if act is 0 then
+ set myselection to selected object of main window of first document as list
+
+ if (count of myselection) is 0 then
+ display dialog \"Please select activity to set time for\" buttons {\"OK\"}
+ else
+ set act to beginning of myselection
+ end if
+ end if
+
+ if act is 0 or (class of act is project) or (is milestone of act is true) then
+ display dialog \"Cannot locate activity for %s\" buttons {\"OK\"}
+ else
+ tell act
+ if ((class is not project) and (is milestone is not true)) then
+ set actual start date to (date \"%s\")
+ if %s then
set actual end date to (date \"%s\")
delete last actuals reporting date
set given remaining work to {amount:0, unit:hours, floating:false, ¬
- relative error:0}
- else
+ relative error:0}
+ else
delete actual end date
set last actuals reporting date to (date \"%s\")
-
- -- set theReturnedItems to (display dialog \"Enter remaining hours for \" ¬
- -- with title \"Given Remaining Work\" with icon stop ¬
- -- default answer \"\" buttons {\"OK\", \"Cancel\"} default button 1)
- -- set theAnswer to the text returned of theReturnedItems
- -- set theButtonName to the button returned of theReturnedItems
- --
- -- set given remaining work to {amount:(theAnswer as number), unit:hours, ¬
- -- floating:false, relative error:0}
- end if
- end if
- end tell
- end if
-end tell" account account start duration commodity (if cleared "true" "false")
- end end))))))
+ end if
+ set given actual work to {amount:%s, unit:%s, floating:false, ¬
+ relative error:0}
+ end if
+ end tell
+ end if
+ end tell" account account start (if cleared "true" "false")
+ end end duration commodity))))))
;;;_ , mudel

0 comments on commit b7665c4

Please sign in to comment.