• 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
Can someone explain this?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can someone explain this?


  • Subject: Can someone explain this?
  • From: Michelle Steiner <email@hidden>
  • Date: Sat, 14 Mar 2009 07:21:58 -0700

This works:

set the outputFile to (choose file name with prompt "Choose where to save the file" default name "test.txt" default location (path to desktop))
set myList to {"a", "b", "c", pi as text, "finished"}
set fref to open for access outputFile with write permission
write ((items 2 through end of myList) as text) to fref
close access fref

This doesn't:

set the outputFile to (choose file name with prompt "Choose where to save the file" default name "test.txt" default location (path to desktop))
set myList to {"a", "b", "c", pi as text, "finished"}
set fref to open for access outputFile with write permission
write ((items 2 through the end of myList) as text) to fref
close access fref

--> "Can’t make items 2 thru end of {\"a\", \"b\", \"c\", \"3.14159265359\", \"finished\"} of «script» into type Unicode text."

But this does:

set the outputFile to (choose file name with prompt "Choose where to save the file" default name "test.txt" default location (path to desktop))
set myList to {"a", "b", "c", pi as text, "finished"}
set fref to open for access outputFile with write permission
write ((items 2 through (the end) of myList) as text) to fref
close access fref

I thought that "the" was always optional (except for "the clipboard", but that doesn't apply here).

-- Michelle

-- 
"I'll see that when I believe it"

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Can someone explain this?
      • From: Philip Aker <email@hidden>
  • Prev by Date: Re: Stock Quotes using AppleScript
  • Next by Date: Re: Stock Quotes using AppleScript
  • Previous by thread: Stock Quotes using ApplScript
  • Next by thread: Re: Can someone explain this?
  • Index(es):
    • Date
    • Thread