• 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 acting like a global
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: List acting like a global


  • Subject: Re: List acting like a global
  • From: JJ <email@hidden>
  • Date: Wed, 05 Dec 2001 19:46:00 +0100

> Hello,
Hello.
>
> What's Happening?
>
So simple

> tell application "Finder"
> set aList to name of every item of desktop
> end tell
-- returns a list of names
> tell me to srListIndexer(aList)
-- returns the same list (numbered)
>
>
> -- sr2ndListItemFromIndexOf1stList
> set vItemWithIndex to "3 Paper Alligator"

-- new variable "vItemWithIndex" , value "3 Paper Alligator"

> -- Capture the current delimiter for AppleScript
> set vTids to the AppleScript's text item delimiters
> set the AppleScript's text item delimiters to " "
>
> set vItemIndex to (item 1 of text items of vItemWithIndex) as number

-- this is integer 3

> -- Reset the delimiter for AppleScript to its previous call state
> set AppleScript's text item delimiters to vTids
>
> item vItemIndex of aList
> --> "3 Paper Alligator"

-- translating, item 3 of aList (remember this is is a list of names)
-- Perhaps you forgot include modificate the line using the handler to:
-- set aList to (my srListIndexer(aList))

-- However, you don't need variable "vItemIndex", because it is always 3
(text item 1 of "3 Paper Alligator" using TIDs)

Expect this helps.

JJ

> -- Should be "Paper Alligator"
> -- What's happening?
>
> on srListIndexer(vAnyList)
>
> -- Capture the current delimiter for AppleScript
> set vTids to the AppleScript's text item delimiters
> set the AppleScript's text item delimiters to ""
>
> repeat with vNth from 1 to count of vAnyList
> set vListItemNth to item vNth of vAnyList
> set item vNth of vAnyList to (vNth & " " & vListItemNth as text)
> end repeat
>
> -- Reset the delimiter for AppleScript to its previous call state
> set AppleScript's text item delimiters to vTids
>
> -- Return needed value
> vAnyList
>
> end srListIndexer


  • Prev by Date: Re: Get List of Certain Desktop Filetypes
  • Next by Date: Re: Dropping a Clipping into Tex-Edit
  • Previous by thread: Re: interesting discovery (trying to get record labels as
  • Next by thread: Re: List acting like a global
  • Index(es):
    • Date
    • Thread