Page 1 of 1

stepWeek

PostPosted: Mon Mar 16, 2009 2:59 pm
by ernestkoe
Okay, I don't know why we didn't think to add a stepweek action but here's how you'd hack the script to do this. It's pretty simple and safe but please make sure you backup your original NinjaCal file :).

1) Edit the NinjaCal ( action ; params ) script.
2) Find the section for stepMonth
3) duplicate the entire section and make the following changes

#---------------------
#stepWeek ( n )
#---------------------
If [ $action = "stepWeek" ]
Set Variable [ $n; Value:GetValue ( Get(ScriptParameter) ; 2 ) ]
Set Variable [ $lasterror; Value:If ( GetAsBoolean ( $n ) ; 0 ; 1201 ) ]
If [ $lasterror = 0 ]
Set Variable [ $$__NinjaCalBaseDate; Value:Date ( Month ($$__NinjaCalBaseDate ) ; Day($$__NinjaCalBaseDate ) +
($n*7) ; Year ($$__NinjaCalBaseDate )) ]
End If
Refresh Window
[ Flush cached join results ]
Exit Script [ Result: $lasterror ]
End If


that's it. you should now have a 'stepweek' action. Make sure you pass the action and and number of weeks to step in your script calls; e,g. perform script NinjaCal ( action; params ) with params: "stepWeek¶1"[/img]