Applescript for creating a new folder

Scott Rossi scott at tactilemedia.com
Wed Jul 9 14:44:00 EDT 2003


Recently, "Yves COPPE"  wrote:

> I've answered : if the path contains diacriticals chars it won't work :
> 
> It doesn't work if in your path you have an existing folder wtih
> diacriticals 
> 
> f. ex. 
> myPath is     /users/<myName>/xxx/yyy/éééé
> 
> then 
> add your code 
> 
>> create folder (myPath & "/newuserfolder") >rename folder (myPath &
>> "/newuserfolder") to (myPath & "/éîøüå") >it won't work !!!!


I've answered as well.  The following worked for me in all cases.  Did you
even try it?

on mouseUp
  # START WITH FOLDER NAME
  put "éîøüå" into tName
  
  # ESTABLISH THE BASE PATH
  set itemDel to "/"
  put item 1 to -2 of the filename of this stack into mypath
  set the directory to mypath
  
  # OPTION 1 - CREATE FOLDER IN CURRENT DIRECTORY
  create folder "newuserfolder"
  rename folder "newuserfolder" to tName
  
  # OPTION 2 - CREATE NEW FOLDER ONE FOLDER UP IN HIERARCHY
  set the directory to "../"
  create folder "newuserfolder"
  rename folder "newuserfolder" to tName
  
  # OPTION 3 - CREATE FOLDER TWO FOLDERS UP IN HIERARCHY
  set the directory to "../"
  create folder "newuserfolder"
  rename folder "newuserfolder" to tName
end mouseUp

If I use relative paths, even when the paths include diacriticals, I can
create a folder and then rename it to whatever name is desired.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com




More information about the use-livecode mailing list