Re: True Optional Handler Parameters (Positional)
Re: True Optional Handler Parameters (Positional)
- Subject: Re: True Optional Handler Parameters (Positional)
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 22 Feb 2004 18:36:49 -0800
On 2/22/04 6:09 PM, "Michael Terry" <email@hidden> wrote:
>
On Feb 22, 2004, at 5:31 PM, Paul Berkowitz wrote:
>
>
>> Then you might have stumbled across the following, inspiring a sliver
>
>> of hope:
>
>>
>
>> showArgs("jello","brand","gelatin")
>
>> --> j
>
>> --> e
>
>> --> l
>
>> --> l
>
>> --> o
>
>>
>
>> Oops, again, but at least there wasn't an error. How to get the other
>
>> arguments? After beating your head against the wall for a few minutes
>
>> (or hours, if you're like me), you gave up that approach as a loss.
>
>
>
> Why don't you just do:
>
>
>
> on showArgs(args)
>
> repeat with i in args
>
> display dialog i
>
> end repeat
>
> end showArgs
>
>
>
>
>
> showArgs({"jello", "brand", "gelatin"})
>
>
>
>
>
> The 'repeat with i in ...' syntax requires a list. So just give it a
>
> list
>
> and keep it happy.
>
>
>
>
>
No kidding? So that's what I've been doing wrong all this time. And
>
here I thought I was making another point entirely.
>
>
As you can see in the text you quoted, I passed a list[1], but you can
>
access only the first item passed. I could've spent more time
>
explaining exactly what I was getting at, but there's a size limit on
>
messages to the list.
>
>
Now, if you read all the way to the bottom, you may find something more
>
interesting than whether or not I know the difference between a string
>
and a list.
Not a string vs. a list - a variable number of parameters vs. a list of
variable length. If you don't mind, could you spell out for me when you
think your method:
property nil : run script "((ASCII character 0)'s{it,it,it,it}as
text)'s{it,it}"
on nullifyCodes of everyFile without theAidOfThisVariable
if everyFile is {} then set everyFile to choose file
tell application "Finder" to repeat with f in everyFile as item as list
set {f's file type, f's creator type} to nil
end repeat
end nullifyCodes
nullifyCodes()
nullifyCodes(choose file, choose file, choose file)
nullifyCodes(files of item (choose folder) of application "Finder")
would be better than what I suggested:
property nil : run script "((ASCII character 0)'s{it,it,it,it}as
text)'s{it,it}"
on nullifyCodes(everyFile)
if everyFile is {} then set everyFile to choose file
tell application "Finder" to repeat with f in everyFile as item as list
set {f's file type, f's creator type} to nil
end repeat
end nullifyCodes
nullifyCodes({})
nullifyCodes({choose file, choose file, choose file})
nullifyCodes(files of item (choose folder) of application "Finder")
-----------------------------
I'm just not understanding what advantages you might get form your version
over mine, nor when.
>
>
Mike
>
>
>
[1] English list for sure, and sometimes an AppleScript list--read the
>
whole post. Sorry it's so long.
I did, but for the same reason I only quoted half of it when replying. It
didn't mean I hadn't read it all. My alternative version did not depend on
the argument being a string. Sorry if it read that way.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.