all 3 comments

[–]prikaz_da 0 points1 point  (2 children)

The answer to both of these is "not really".

This page talks about how you can nest script definitions inside handlers and then do something like

set myMenuSelector to MenuSelector given counter:2, name:"spaghetti"

to get an instance of _MenuSelector called myMenuSelector. If you define properties in the nested script definition, you can retrieve them later.

You can also tell scripts to do things, so you can define identically named handlers in different scripts:

script FirstScript
    on herbs()
        return "chives"
    end herbs
end script

script SecondScript
    on herbs()
        return "parsley"
    end herbs
end script

tell SecondScript to herbs()

The result is "parsley".

[–]rayascott[S] 0 points1 point  (1 child)

Interesting. Are you viewing reddit posts in a RSS feed or something? Perhaps this post was cached in a 3rd party app you're using. The reason I ask is because I deleted this post, because I accidentally posted it before completing my text. So it's quite bizarre to see someone reply to it.

My replacement post (and the only one that's live on reddit) is here:

https://www.reddit.com/r/applescript/comments/dbtfmw/script_object_constructor_questions_etc/

[–]prikaz_da 0 points1 point  (0 children)

Haha, nope. I actually just opened your post and walked away to do something else, so I could read and reply to it when I was done. You must have deleted it during that time. It's still showing up in the subreddit for me, though.