• 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: Changing a list to path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing a list to path


  • Subject: Re: Changing a list to path
  • From: kai <email@hidden>
  • Date: Mon, 30 Jan 2006 22:16:29 +0000


On 30 Jan 2006, at 21:24, Steven Valenti wrote:

Is there a command that will insert the ":" between the items in your list or is the only way to make a repeat loop?

set PathToFolder to "Macintosh HD:Users:username:Desktop:JobsToDo:TestJob"
set AppleScript's text item delimiters to ":"
set ListPath to text items of PathToFolder
set NewPathToFolder to (items 1 thru 4 of ListPath) & "JobsDone" & (item 6 of ListPath)


set PathToFolder to ""
repeat with i in NewPathToFolder
	set PathToFolder to PathToFolder & i & ":"
end repeat


AppleScript's text item delimiters can be used both to parse text to a list of text items and to join a list of text.

Your routine could also be adapted to work at different levels of a file hierarchy by using negative indexing, perhaps something like this:

----------------

set PathToFolder to "Macintosh HD:Users:username:Desktop:JobsToDo:TestJob"
set AppleScript's text item delimiters to ":"
tell PathToFolder to set NewPathToFolder to text from beginning to text item -3 & ({""} & "JobsDone" & text item -1)
--> "Macintosh HD:Users:username:Desktop:JobsDone:TestJob"


----------------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Changing a list to path (From: Steven Valenti <email@hidden>)

  • Prev by Date: Re: Changing a list to path
  • Next by Date: Re: Force quit filemaker and reopen a file
  • Previous by thread: Re: Changing a list to path
  • Next by thread: getting selection in Safari
  • Index(es):
    • Date
    • Thread