• 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: List from text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: List from text


  • Subject: Re: List from text
  • From: Gary Lists <email@hidden>
  • Date: Fri, 04 Jul 2003 10:09:51 -0400

On or about 7/4/03 9:14 AM, John Clark wrote:

> Can I create a list from a text string generated in Filemaker 4 ?
>
> Tell app "filemaker"
>
> Set x to cell "text"
> --returns "zzz.jpgaaa.jpgwww.jpgqqq.jpg"
> End tell
>
> What I need to return is {zzz.jpg, aaa.jpg, www.jpg, qqq.jpg}
>
> Thanks
> John Clark

Hi John.

Yes, you can.

It matters, however, what kind of field you are getting values from: a
repeating field or a non-repeating field with multiple values.

I will send you directly (off list) a test file with several tests in it
(not all related to this). One of these is exactly this issue. I show, in
that file, how to produce AS lists successfully and how to do it
unsuccessfully (which you already know :).

For the sake of other, and future, readers, I've included the scripts here
too. These are copied from within a Perform AppleScript script step, so you
don't see any "tell FileMaker" stuff here. You don't need that unless you
are running your scripts externally, as a stand-alone script/applet/from
your editor/osa menu/etc.

To demonstrate that we indeed do have a list, I like to use the 'choose from
list' command.


-- REPEATING FIELD
-- easiest method, as you can see no more is needed
-- TEST 0
set repValues to cell "repeatFLD" of current record
set dResult to choose from list repValues



-- NON-REPEATING FIELD, but with multiple Value List items
-- multiple values in a non-rep field are return separated in FM

-- get the data from the field
-- I will use the variable 'norep' in the remaining examples

set norep to cell "norepFLD" of current record


-- TEST 1
-- test to see if we can present the data in a dialog
display dialog "Just showing the items in a dialog..." & return & return &
norep with icon note
-- includes returns, displays okay
-- SUCCESS of sorts, for display, but not a list


-- TEST 2
-- your condition looks like this one:
-- a non-repeating field, multiple values, no list here
set dResult to choose from list norep with prompt "This will not work
without having AppleScript deal with the returns, because the 'choose from
list' command requires a list..."
-- one big chunk, not a list...AS makes a list with 1 item to display in
choose box
-- FAILURE


TEST 3
-- test with a delimiter in encoded form
set text item delimiters to "\r"
set norepList to text items of norepFLD
set dResult to choose from list norepList with prompt "Pick an item from a
field if you break the items into return-separated parts (with \\r)..."
-- works, now its a list
-- SUCCESS


TEST 4
-- test with 'return' as delimiter
set text item delimiters to return
set norepListReturn to text items of norepFLD
set dResult to choose from list norepListReturn with prompt "Pick an item
from a field if you break the items into return-separated parts (with
'return')..."
-- works, now its a list
-- SUCCESS


HTH,
--
Gary

MacOS 9.1 / "9 is Fine"
OMM: osa:AS 183 / osa:JS 103 / FM 55 / BB 612 / Smile 188
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Rules of the Scripts Folders in OS X
      • From: Jason Bourque <email@hidden>
References: 
 >List from text (From: John Clark <email@hidden>)

  • Prev by Date: re: Hypercard (was Re: Calling OSX AppleScript from Classic Apps)
  • Next by Date: Re: List from text
  • Previous by thread: List from text
  • Next by thread: Rules of the Scripts Folders in OS X
  • Index(es):
    • Date
    • Thread