• 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: Contains?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Contains?


  • Subject: Re: Contains?
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 11 Sep 2008 14:43:05 -0400

property invalid_files: { ".m4a", ".m4p", ".aac" }
set c_ring_tone_file to "/Users/slack/Music/iTunes/amber.m4p"
repeat with suffix in invalid_files
    if c_ring_tone_file ends with suffix then
       display dialog "oops"
       exit repeat
   end if
end repeat

or

property invalid_files: { "m4a", "m4p", "aac" } -- NOTE: NO PERIODS
if name extension of (get info for posix file c_ring_tone_file) in
invalid_files then
    display dialog "oops"
end if

On Thu, Sep 11, 2008 at 2:29 PM, J. Todd Slack
<email@hidden> wrote:
> Hi Michelle.
> c_ring_tone_file actually contains a path like:
> /Users/slack/Music/iTunes/amber.mp3
> -Jason
> On Sep 11, 2008, at 11:21 AM, Michelle Steiner wrote:
>
> On Sep 11, 2008, at 11:09 AM, J. Todd Slack wrote:
>
> OK, that is good to know. I am actually trying to do a contains based upon
> an array. Is that allowed? I wanted to make sure I had the right syntax (and
> I had a typo :()
> property invalid_files : {".m4a", ".m4p", ".aac"}
> if c_ring_tone_file contains invalid_files then
> display dialog "opps"
> end if
> Is something like this allowed?
>
> How do you define c_ring_tone_file? It would have to be a list for your
> script to work.  If it's a string (e.g., ".m4a"), then your code won't work.
>  you would need something like this:
> set c_ring_tone_file to ".m4a"
> property invalid_files : {".m4a", ".m4p", ".aac"}
> if c_ring_tone_file is in invalid_files then
> display dialog "opps"
> end if
> Alternatively:
> set c_ring_tone_file to ".m4a"
> property invalid_files : {".m4a", ".m4p", ".aac"}
> if invalid_files contains c_ring_tone_file then
> display dialog "opps"
> end if
> -- Michelle
> --
> Please contribute to the Leukemia and Lymphoma Society, and help me meet my
> fund raising goal for my marathon training.
> <http://www.active.com/donate/tntdms/tntdmsMSteine>
>
>
>
> _______________________________________________
> 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
>
>  _______________________________________________
> 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
>



--
Mark J. Reed <email@hidden>
 _______________________________________________
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

References: 
 >Contains? (From: "J. Todd Slack" <email@hidden>)
 >Re: Contains? (From: Michelle Steiner <email@hidden>)
 >Re: Contains? (From: "J. Todd Slack" <email@hidden>)
 >Re: Contains? (From: Michelle Steiner <email@hidden>)
 >Re: Contains? (From: "J. Todd Slack" <email@hidden>)

  • Prev by Date: Re: Contains?
  • Next by Date: Re: Contains?
  • Previous by thread: Re: Contains?
  • Next by thread: Launching Default Mail Client Questions
  • Index(es):
    • Date
    • Thread