The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniPlan > OmniPlan General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Applescript problems Thread Tools Search this Thread Display Modes
Hi guys,

As an architect I got a lot of projects for omniplan :)

It includes of course classic project planning.

But I plan to implement some right click linking of 3D model parts directly from maya.

AND

I want to create a little script to RECORD the task I am doing on my computer.

Example: Foundation works: start at 8.00 today ended at 11.30

I am planning to do that through applescripts.

Actually I succeed in creating a task from a script, change it's name or duration.

But I failed in effectively changing it's "starting date"

The actual start seems to be modified in the task information panel but it do not update the calendar view.
And the modification is buggy, as soon as I want to go to the ressource panel i got the following alert:*** -[NSCFDate dayOfCommonEra]: selector not recognized [self = 0x52539c0] wich appear and appear again in such a way i got to force quit.

here the applescript I wrote:

property ATime : date
property BTime : date
property CDuration : 4
property ADur : 4
property BDur : 4

tell application "OmniPlan"
activate
set CTime to (current date)
set myDoc to front document
tell front document
-- set Myself to make new resource with properties {kind:person, efficiency:2, name:"Tom", cost per hour:200.0}
--set MyTask to make new task with properties {name:"Cure Cancer", starting date:CTime, duration:CDuration}
--assign MyTask to Myself
set ADur to duration of task "Cure Mat"
set duration of task "Cure Mat" to 12
set BDur to duration of task "Cure Mat"
set ATime to starting date of task "Cure Mat"
set BTime to current date
set starting date of task "Cure Mat" to BTime
set BTime to starting date of task "Cure Mat"
display dialog ADur & " " & BDur & return & ATime & return & BTime as string
end tell
end tell


Any clue?

PS: please ask if you want some more details on my goal. I am trying to do something like "timelog" do.
 
I got this part of answer on an other thread:

Quote:
Originally Posted by Len Case
Well, I don't know how to solve it, but the problem is that "current date" returns the wrong kind of date. (NSDate vs. NSCalendarDate)
I am actually working on it
 
It appears that OS X doesn't map NSDate objects to AppleScript dates.

As far as I can see I will need to use some Cocoa Method
 
Actually I switched to Xcode to get some cocoa code easily
 
Quote:
Originally Posted by mattao
It appears that OS X doesn't map NSDate objects to AppleScript dates.
Yes, or, rather the default coercions don't map back and forth from AppleScript dates, which come to the app as NSDate, and NSCalendarDate, which we use in our object model. We have to add, oh, two lines of code, if we can only figure out which two.

-Tom
 
Quote:
Originally Posted by Tom Bunch
Yes, or, rather the default coercions don't map back and forth from AppleScript dates, which come to the app as NSDate, and NSCalendarDate, which we use in our object model. We have to add, oh, two lines of code, if we can only figure out which two.

-Tom
Thank for your answer.

Do you think I should wait for you to fix this "two lines of code" or should I write in cocoa?
 
We'll write it. Your script should work as is, we just need to fix the bug on our end.
 
thanks.

please warn me as soon as the update is done in order to give me the ability to go on my development...

:D
 
Hi,

Should I expect something new in the next update?
 
Not beta 6, maybe in beta 7 (but no guarantees). We've been a little side-tracked by WWDC.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sync problems? Mondraymond Syncing via Omni Sync Server 2 2012-09-17 09:30 AM
Applescript - 2 problems in linking two shapes with a line RobTrew OmniGraffle General 4 2011-06-09 10:38 AM
Problems since upgrading milkywater OmniFocus 1 for Mac 1 2008-03-26 10:54 AM
Last.fm problems asiufy OmniWeb Bug Reports 0 2006-04-28 12:19 PM


All times are GMT -8. The time now is 05:57 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.