• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: on run, Expected a reference
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: on run, Expected a reference (From: Andrew Oliver <email@hidden>)

  • Prev by Date: Re: on run, Expected a reference
  • Next by Date: Calling one script from another/asynchronous operation
  • Previous by thread: Re: on run, Expected a reference
  • Next by thread: Re: on run, Expected a reference
  • Index(es):
    • Date
    • Thread