Hi guys i need to know how to find the Hard Disk Name automatically and wether it is possible to change the permissions of a file using apple script. this is my script:
tell application "Finder"
activate
make new folder at folder "Public" of folder "admin" of folder "Users" of startup disk with properties {name:"Documents"}
end tell
set httpd_old to alias (("etc:httpd:httpd copy.conf") as Unicode text)
set AppleScript's text item delimiters to ""
set AppleScript's text item delimiters to "/Library/WebServer/Documents"
set text_items_of_httpd_old to text items of (read httpd_old) --A list that contains 2 chunks of text: Everything before the original line, and everything after
set publFolder to (path to "pubb")
set uPath to POSIX path of publFolder
set AppleScript's text item delimiters to uPath
set httpd_new to text_items_of_httpd_old as Unicode text --New text for your new conf file
write httpd_new to alias (("etc:httpd:httpd copy.conf") as Unicode text)
instead of RDServer HD how can i find the automatic path to the Hard Disk name.
And the in httpd.conf folder i need to change it to read and write permission. (I test it manually and i dont have any problem)
Not sure if this is what you’re looking for or not. This would be for the hard drive name
set hd to path to desktop
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set hdName to first text item of (hd as string)
display dialog hdName
set AppleScript's text item delimiters to astid
The other part:
tell application "Finder"
make new folder at desktop with properties {name:"aNewFolder", owner privileges:{read write}}
end tell
I must have been trying that from the finder or something 'cause I tried that and it kept throwing errors.
I knew someone would have the easiest way to do that.
thanks guys…the hard disk name issue worked as you told me.
But for the privliges on a folder. what you pretech wrote is giving read and write permissions to a new created folder as for what i want is to modify the privileges of an already existing folder. I have tried the following but it is not modiying anytthing:
set hd to path to desktop
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set hdname to first text item of (hd as string)
set AppleScript's text item delimiters to astid
tell application "Finder"
set new_file to alias ((hdname & ":private:etc:httpd") as Unicode text)
open new_file with properties {name:"aNewFolder", owner privileges:{read write}}
end tell