Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Here's how to do it in Applescript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Here's how to do it in Applescript
Authored by: Robert M on Jun 12, '02 01:03:33AM

on open something
tell application "Finder"
activate
set TheFile to a reference to item (something as string)
set TheName to (name of TheFile) as string
set the_Text to TheName
set Replace_string to ""
set OldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to " "
set newText to text items of the_Text
set AppleScript's text item delimiters to Replace_string
set finalText to newText as text
display dialog finalText
set the (name of TheFile) to finalText
end tell
end open

I got major help from http://discussions.info.apple.com
but that's cool , too, how to do it from the Terminal!

--Robert M



[ Reply to This | # ]
Here's how to do it in Applescript
Authored by: osxpounder on May 20, '03 05:02:34PM

That's really cool. It would be even cooler if we could figure out how to make an AppleScript that you could drop multiple files upon, which would change each file's name to one without spaces. Apparently this one won't; it gets confused if I drop a handful of files on it.

---
--
osxpounder



[ Reply to This | # ]
Here's how to do it in Applescript
Authored by: ericgorr on Sep 14, '06 06:53:04AM

If one is just looking to remove spaces, this might be a bit easier:


set newText to oldText's words as string



[ Reply to This | # ]