Applescript "NSCannotCreateScritpCommandError" OO 2.2.6 and
MacOS 10.3.2
James Lorenzen
lorenzen at tiny.net
Mon Mar 15 13:50:45 PST 2004
On Mar 15, 2004, at 3:32 PM, Andrew Payne wrote:
> what is your script doing?
>
> -ap
>
> On Mar 15, 2004, at 1:04 PM, James Lorenzen wrote:
>
>> I am attempting to write a Applescript to perform horizontal calcs
>> and I receive the error "NSCannotCreateScritpCommandError" when I try
>> to run the script. This is on 2.2.6 and MacOS 10.3.2
>>
>> Is there a work around for this? I did "google" the error and saw
>> info regarding path names (I'm not using) or clipboard usage (also
>> not using).
>>
>> Thanks
>> James
The script is an attempt to provide some horizontal calculations in a
simple outline based on Joel Spolsky and "Painless Software Schedules".
<www.joelonsoftware.com> The outline looks like this:
Column Type
Topic text Description of task
Estimate Duration, Calc'd Original estimate
Current Duration, Calc'd Current (revised) estimate
Elapsed Duration, Calc'd Current elapsed time
Left Duration, Calc'd Time remaining, based on current estimate minus
elapsed time
Done? Check box If done, this is checked.
The script is:
tell application "OmniOutliner"
try
set theDate to current date
set myDate to ((date string of theDate) as text)
(* otherwise, you get both date *and time down to second*, which
screws up your comparison later on *)
set CurrEstIDIndex to 0
set ElapsedIDIndex to 0
set leftIDIndex to 0
set doneIDIndex to 0
set TheDoc to front document
set columnCount to count of columns of TheDoc
repeat with columnIndex from 1 to columnCount
if title of column columnIndex of TheDoc is "Current" then
set CurrEstIDIndex to columnIndex
end if
if title of column columnIndex of TheDoc is "Elapsed" then
set ElapsedIDIndex to columnIndex
end if
if title of column columnIndex of TheDoc is "Left" then
set leftIDIndex to columnIndex
end if
if title of column columnIndex of TheDoc is "Done?" then
set doneIDIndex to columnIndex
end if
end repeat
if CurrEstIDIndex is equal to 0 then
(* when bailing, put things back how you found them *)
display dialog "You need a column named 'Current' to use this
script" buttons "Cancel" default button 1
else if ElapsedIDIndex is equal to 0 then
display dialog "You need a column named 'Elapsed' to use this
script" buttons "Cancel" default button 1
else if leftIDIndex is equal to 0 then
display dialog "You need a column named 'Left' to use this script"
buttons "Cancel" default button 1
else if doneIDIndex is equal to 0 then
display dialog "You need a column named 'Done?' to use this script"
buttons "Cancel" default button 1
end if
set myActCount to 0
set TheList to every row in TheDoc
repeat with myRow in TheList
if ((state of cell doneIDIndex of myRow) is unchecked) then
if myRow of row has subtopics is false then
set (the value of leftIDIndex of myRow) to (the value of
CurrEstIDIndex of myRow) - (the value of ElapsedIDIndex of myRow)
set myActCount to myActCount + 1
end if
end if
end repeat
display dialog "Count of hits: " & myActCount buttons "OK"
on error errormessage number errornumber
display dialog errormessage buttons {"OK"} default button 1
end try
end tell
This is my first attempt at scripting OmniOutliner and I lifted the
idea from one that was downloaded from Omnigroup's site.
TIA
James
More information about the OmniOutliner-Users
mailing list