Re: Shortening variable list passed onto subroutines
Re: Shortening variable list passed onto subroutines
- Subject: Re: Shortening variable list passed onto subroutines
- From: Mark Lively <email@hidden>
- Date: Tue, 17 Jan 2006 10:58:12 -0500
On 1/17/06, Michelle Steiner <email@hidden> wrote:
> On Jan 17, 2006, at 2:16 AM, Jay Louvion wrote:
>
> > I've been dabbling seriously for the first time (and think I've got
> > it at
> > last) in subroutines, but I was wondering if there is away of
> > shortening a
> > variable list passed onto it.
>
> > my MakeiCalEvent(targetCal, EventDate, StartTime, EndTime,
> > FullStartDate, FULLEndDate, ToDoNr, ToDoStatus, ToDoAction,
> > ToDoActionDetail, Project, Category, ThePriority, Photographer)
>
> How about this?
>
> Set iCalEventList to {targetCal, EventDate, StartTime, EndTime,
> FullStartDate, FULLEndDate, ToDoNr, ToDoStatus, ToDoAction,
> ToDoActionDetail, Project, Category, ThePriority, Photographer}
>
> my MakeiCalEvent (iCalEventList)
>
> Or possibly making a record out of it and passing the record?
>
> A (The only?) problem with either approach is that you have to
> extract the data from the list or record within the sub routine.
>
> -- Michelle
>
@Blasphemy
Perhaps the subroutine isn't needed. As far as I can see its only a
half dozen lines of code and really boils down to 1 statement.
If Jay *really* wants to use a subortine the following might be better.
-- Use this to set up and then call the Make Event
using terms from application "iCal"
set mydata to {summary:Photographer & space & ToDoNr & space &
ToDoStatus & space & ToDoAction, description:"(priorité:" &
ThePriority & ") " & Category & space & Project & space &
ToDoActionDetail, start date:FullStartDate, end date:FULLEndDate}
end using terms from
makeiCalEvent(mydata)
--This is what it gets changed into.
on makeiCalEvent(mydata)
tell application "iCal"
make new event at the end of events of targetCal with properties mydata
end tell
end makeiCalEvent
-Mark
I may have robbed the cave fish of their sight, but I didn't right he
oscars, much less the golden globes.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden