• 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: Replacing a character in a filename?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replacing a character in a filename?


  • Subject: Re: Replacing a character in a filename?
  • From: Michael Turner <email@hidden>
  • Date: Fri, 24 Aug 2001 10:13:58 -0400

T.J.

What a coincidence, I was just about to write a similar script.

I see the problem here: you are re-defining the _variable_ "theSpace" to a
new value, not the character in the file name, which would remain unchanged.

I recommend you try a technique involving finding the 'offset' of the
character that matches the variable, then change the character in that
offset position to whatever you wish.

Good luck,

/Michael

> From: "T.J. Mahaffey" <email@hidden>
> Date: Fri, 24 Aug 2001 08:59:58 -0500
> To: <email@hidden>
> Subject: Replacing a character in a filename?
>
> Hi, folks!
>
> I was hoping someone could give me a nudge with this:
>
> on open theFiles
> set theSpace to " " as text
> repeat with thisFile in theFiles
> if name of thisFile contains theSpace then
> set theSpace to "_" as text
> end if
> end repeat
> end open
>
>
> I'd like my script to find spaces in a file name and replace them with
> underscores. Of course, this doesn't work in it's current form. could
> someone give me a hint, but not a complete script? I need to learn here. ;)
>
>
> T.J. Mahaffey
> email@hidden
> _______________________________________________
> applescript-users mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/applescript-users


References: 
 >Replacing a character in a filename? (From: "T.J. Mahaffey" <email@hidden>)

  • Prev by Date: Re: Replacing a character in a filename?
  • Next by Date: Re: Replacing a character in a filename?
  • Previous by thread: Replacing a character in a filename?
  • Next by thread: Re: Replacing a character in a filename?
  • Index(es):
    • Date
    • Thread