• 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: Michelle Steiner <email@hidden>
  • Date: Sun, 21 Aug 2005 20:42:59 -0700


On Aug 21, 2005, at 4:36 PM, Andrew Oliver wrote:

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

Alternatively, use this code:

on run
    set droppedItems to choose folder with multiple selections allowed
    main(droppedItems)
end run

"with multiple selections allowed" forces droppedItems to be a list, even if only one item has been selected.

-- Michelle

--
"You don't think he's telling the truth, do you?"

"I wouldn't put anything past him."



_______________________________________________
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: Finder f*ck-ups
  • Next by Date: Re: Finder f*ck-ups
  • Previous by thread: Re: on run, Expected a reference
  • Next by thread: Calling one script from another/asynchronous operation
  • Index(es):
    • Date
    • Thread