• 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: Joining things to form a variable name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Joining things to form a variable name


  • Subject: Re: Joining things to form a variable name
  • From: Greg Strange <email@hidden>
  • Date: Mon, 30 Oct 2000 02:26:08 -0600

on 10/29/00 10:12 PM, Stephen Fitchett at email@hidden wrote:

> set setLetter to "a"
> repeat with i from 1 to 26
> set letterQuestion to display dialog {"What character would " & setLetter &
> " decode to?"} default answer {"letter" & setLetter} --trying to combine
> things to form the name of a property for the default answer- this doesn't
> work of course
> set {"letter" & setLetter} to text returned of letterQuestion --sets the
> property, again I can't join them
> configureLetter(setLetter) --specifies which letter is being set and puts
> it as setLetter
> end repeat

This is because you are trying to set something which is being returned to
you. try:

set newSetLetter to "letter" & setLetter
configure(newSetLetter)


This worked for me.

>
> on configureLetter(setLetter)
> if setLetter = "a" then
> set setLetter to "b"
> else if setLetter = "b" then
> set setLetter to "c"
> else if setLetter = "c" then
> set setLetter to "d"
> else if setLetter = "d" then
> set setLetter to "e"
> --and so on
> end if
> end configureLetter

I got this (in modified form) from Arthur Knapp for another project.

set startLetter to "g"
set charArray to "abcdefghijklmnopqrstuvwxyz"
set charOffset to the offset of startLetter in charArray
set setLetter to character (charOffset + 1) of charArray


Hope this helps.

Greg Strange
--
...[Zeus] has led us on to know,
that Helmsman lays it down as law
that we must suffer, suffer into truth.
-Aeschylus, Agamemnon


References: 
 >Joining things to form a variable name (From: Stephen Fitchett <email@hidden>)

  • Prev by Date: Re: Localization - what language is the host OS using?
  • Next by Date: Can not read dictionaries...any of them
  • Previous by thread: Joining things to form a variable name
  • Next by thread: Can not read dictionaries...any of them
  • Index(es):
    • Date
    • Thread