Re: Design Report for Scripts?
Re: Design Report for Scripts?
- Subject: Re: Design Report for Scripts?
- From: Yvan KOENIG <email@hidden>
- Date: Sat, 21 Nov 2015 12:08:56 +0100
> Le 2015/11/21 à 10:51, S. J. Cunningham <email@hidden> a écrit :
>
>
> On Nov 21, 2015, at 4:15 AM, Yvan KOENIG wrote:
>
>> Honestly, as I don’t see any interest to this kind of variable, [global declarations within a handler]
>
> Normally, I wouldn't either. But I am using a Script Debugger "Library" to simulate an "#Include header" functionality because I have a huge list of common properties that I want to use in every script of the project. That way I can centralize definitions of these terms so I don't have to define them in every script or change them in every script when they change. For example property standardResponse : "Don't do that" in the header allows every script to use standardResponse and I can change it to "Please don't do that" in the header and it is automatically changed in all other scripts.
>
> This occasions two peculiarities I have noticed. First, the "header" loads _after_ all the declarations in the script so their definitions can't refer to properties in the "library" header. Second, properties defined in the "header library" are not visible within the handlers of the main script. I found I can fix this by declaring them as global within the handler. Hence, the indentation which your script misses.
>
> A side benefit of having to explicitly declare as global any properties used in a handler is that it forces me to pay attention to them and not make mistakes such as reusing a property's name as a variable within the handler. For this reason I think I am going to adopt this practice whether I have a header library or not.
>
> Steve
Is the late version behaving correctly on your side ?
I wait your answer before trying to list the properties used in every handler.
Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) samedi 21 novembre 2015 12:08:51
_______________________________________________
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