List acting like a global
List acting like a global
- Subject: List acting like a global
- From: Jason Bourque <email@hidden>
- Date: Wed, 05 Dec 2001 09:56:44 -0500
Hello,
What's Happening?
tell application "Finder"
set aList to name of every item of desktop
end tell
tell me to srListIndexer(aList)
-- sr2ndListItemFromIndexOf1stList
set vItemWithIndex to "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
-- 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"
-- 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