Re: on run, Expected a reference
Re: on run, Expected a reference
- Subject: Re: on run, Expected a reference
- From: Robert Poland <email@hidden>
- Date: Sun, 21 Aug 2005 17:46:55 -0600
On 8/21/05 4:28 PM, "Robert Poland" <email@hidden> wrote:
Hi,
OS 10.4.2. I thought I was being clever here but I get an error
"Expected a reference". What am I misunderstanding? The "on open
(droppedItems)" part works fine, only the "on run " fails.
Tia,
on run
set droppedItems to choose folder
main(droppedItems)
end run
on open (droppedItems)
main(droppedItems)
end open
[snip]
The issue is that 'on open' receives a list of items dropped on it,
therefore 'main (droppedItems)' in the open handler is passing a list to
main()
In contrast the run handler is calling 'choose folder' which returns an
alias. You then pass this alias to main() and hence main() fails - it is
expecting a list and you can't get 'item 1' of an alias
Simplest solution: pass droppedItems as a list:
on run ()
set droppedItems to (choose folder)
main ( {droppedItems} )
end run
Thanks Andrew,
That did it.
--
Bob Poland - Fort Collins, CO
http://www.ibrb.org/
_______________________________________________
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