The document " " could not be saved?

I’m trying to create an installer i guess you could say and for some reason i can save it maybe once. As soon as i get to open it again and change something to try and resave i get an error saying the document could not be saved and i have no idea why. It basically is just taking items I’ve put into the bundle contents and duplicating them to a specific location. Im very new to this but I’ve been doing A LOT of research. HELP.

PS anything i edit will cause the document to not save. including just the icns file

set doc_cont to POSIX path of (path to me as string) & "Contents/Resources/Server/"


-- Duplicate iC files to proper directories
do shell script "cp " & "-R " & doc_cont & "*" & " /Library/WebServer/Documents"


-- Create alias to resources
tell application "Finder"
	make new alias to folder "Documents" of folder "WebServer" of folder "Library" at startup disk with properties {name:"iC Resources"}
end tell

Browser: Safari 534.48.3
Operating System: Mac OS X (10.6)

Hi, NeLLyMerC. Welcome to MacScripter.

I don’t know why that particular error’s occurring. But it’s a good idea to use the ‘quoted form’ of POSIX paths with ‘do shell script’, so that any spaces in the names don’t cause problems.

set doc_cont to quoted form of ((POSIX path of (path to me)) & "Contents/Resources/Server/")

Your Finder code is definitely wrong.

Firstly, in AppleScript, an 'alias is a way of referring to a file or folder in a script. If you’re talking about what a user might understand by the term (ie. a kind of file which acts as a proxy to a another file or folder), this is called an ‘alias file’ in Finder scripting. (I notice that ‘make new alias’ works on my Snow Leopard machine, but it’s still wrong.)

Secondly, your ‘make’ command has an incomplete reference to the item for which to make the reference (folder “Documents” of folder “WebServer” of folder “Library”) and an ‘at’ parameter specifying that the alias is to be created in the root folder of the startup disk. You probably meant this:

tell application "Finder"
	make new alias file to folder "WebServer" of folder "Library" of startup disk with properties {name:"iC Resources"}
end tell

This creates an alias to the destination folder referred to in your shell script and, in the absence of an ‘at’ parameter, places it on the desktop.

Edit: It occurs to me that the “cp” command in your shell script may need a -f option to force it to overwrite items copied over previously.

Thank you Nigel for your warm welcome. Im glad to now be a part of a community where i can grow my knowledge by interacting with people rather then staring at a book.

So I’m trying to understand why my original line of the script would cause problems with do shell script but ill take your word for it and figure it out lol. Thank you. The only difference i see between them is the single quote it adds to the path. Not sure the difference.

Great call out on the alias file rather then just alias. I tested out each script while putting it together and they all work just fine like you pointed out but I always want to know the proper way to do something. As for the Documents file I’m referencing I can see how your way might be better for the user if they were on the actual computer or screen sharing but this is a mini server that is usually connected via AFP in which the user usually just connects to grab or edit files. So when they authenticate the first thing they see is share points which happen to be the root. Rather then them digging through folders they shouldn’t be i thought i would put an alias file where they start off.

I guess i could just make it a share point but either way, I greatly appreciate your help. So could it be anything in my bundle that is making it not save?

Hi Nigel,

-f is not needed. /bin/mv and /bin/cp overwrite files by default. Adding the -n switch does not overwrite existing files

New discovery!

So this maybe newbish, but does the bundle contents HAVE to have the scripts folder? i deleted it because i was not using it. I was only using a folder named Server. I made a new script and copied the contents into a new folder named Server and left the scripts folder alone. Was i causing my own trouble? and still looking for some clarification on my first line of script where it was suggested to use the quoted form. Thanks everyone!

It would depend on whether the path returned by (path to me) contained any spaces. If it did, the bits either side of the space(s) would look like separate parameters in the shell script. Puting the path in single quotes is one way of avoiding this.

I wouldn’t have thought so. But I’m not an expert on bundles or share points on servers.

Thanks for the information, Stefan. :slight_smile: I did have a quick look with “man cp” to try and find out what the default was, but didn’t see it mentioned.

I dont know if im done adding things i would like to make this script do, but the problems i was having were solved with all of your help. Thank you! Hopefully one day i can return the favor. And in case anyone else asks, Im guessing the saving problems is because of deleting the Scripts folder inside the bundle. JUST LEAVE IT. thanks again.