Re: functions as sort of first class objects
Re: functions as sort of first class objects
- Subject: Re: functions as sort of first class objects
- From: Deivy Petrescu <email@hidden>
- Date: Tue, 24 May 2016 07:42:58 -0400
> Hey Mitchell,
>
> h() does not exist.
>
> h does. It is not a handler but a reference to a handler.
>
> You also need to reference a() & b() properly:
>
> ----------------------------------
> to a()
> display alert "A"
> end a
>
> to b()
> display alert "B"
> end b
>
> repeat with h in {my a(), my b()}
> h
> end repeat
> ----------------------------------
>
> --
> Best Regards,
> Chris
>
Chris, I don’t believe your script does what you thing it does.
The calls for a and be happen at the assignment, that is at the first line of the repeat statement.
To verify this, put a delay in the repeat loop and you will see that it will "not be respected”, that is the two dialogs happens one right after the other.
To get what Mitchell wants you have to do the following:
to a()
display alert "A"
end a
to b()
display alert "B"
end b
repeat with h in {a, b}
run script h
delay 5
end repeat
Deivy Petrescu
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden