Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting a string to a filename



If what you're trying to do is getting those strings from your resulted list, then you should use e.g.:
set x to item 1 of myList
set y to item 2 of myList
-- etc...


Regards,
Jasper.


On Apr 26, 2005, at 5:20 PM, Adam Wuellner wrote:

On 4/26/05, bazmail <email@hidden> wrote:
Hi,

I have an script within Applescript studio at removes the last word
of a filename and put the result in a string. The problem is that the
string I get is {"wordone","wordtwo","etc"}

That's a list, not a string. You can explicitly coerce it to a string,
{"one", "two", "ten"} as string --> "onetwoten"

How can I get this string back into a format that I can use to make
a filename. The script works fine if it is a single word.

I will also need to put the spaces back in.

Applescript will insert its text item delimiters in between each
element of the list when coercing it to a string. By default, those
delimiters are {""}, that is, nothing. You can set them to spaces, if
that's what you want:
set AppleScript's text item delimiters to {" "}
{"one", "two", "ten"} as string --> "one two ten"

Be aware that the text item delimiters are global in scope.

Any help would be most helpful.

HTH,

Adam

Best wishes

Michael
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden

References: 
 >Converting a string to a filename (From: bazmail <email@hidden>)
 >Re: Converting a string to a filename (From: Adam Wuellner <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.