Re: Count lines in a textfile
Re: Count lines in a textfile
- Subject: Re: Count lines in a textfile
- From: Jon Pugh <email@hidden>
- Date: Thu, 16 Sep 2004 19:50:32 -0700
At 9:15 PM -0500 9/16/04, Joseph Weaks wrote:
>I am really quite amazed it doesn't error. Since each parameter of choose file has a keyword, it is ignoring any value given.
>choose file {}
>choose file {"Foobar"}
>choose file "Foobar" with prompt "bar"
>set foo to "bar"
>choose file foo
>
>All of these ignore the unneeded value. I don't understand WHY it compiles.
The direct parameter is being set to an empty list, which is AppleScript's preferred null object (originally specified in unnecessary parentheses which were removed by AppleScript). Since the direct parameter isn't used in these scripting additions, no one complains.
The Apple Event Manager actually has a way to handle this, and it appears that these osaxen aren't using it. The technique is to ask for each parameter and then ask for the "did I miss any parameters" attribute, keyMissedKeywordAttr (there's a dynamic attribute for you, has!) which returns errAEDescNotFound if you got all the parameters and noErr if you have missed any required parameters.
http://developer.apple.com/documentation/mac/IAC/IAC-122.html
This is the only way optional versus required parameters are used in AppleEvents. AppleScript has entirely different notions of optional in application dictionaries.
Jon
_______________________________________________
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