I know I’m missing something obvious here, but when I look up Textedit’s dictionary, I see the Save command as have a parameter of “in alias” (also “as unicode text”, but I don’t need that). The problem is, when I use that, it expects the file to already exist! How can I get it to save a new file without going through all the UI scripting? (as an aside, this was easy in BBEdit, but I want to make the script more accessible with the built-in applications)
For tons of extra credit, if anyone can point me towards an OS X executable that converts text files to Palm Pilot format, it would make my life a ton easier. Right now I’m using MakeDoc, but it’s OS 9 only, and I’ve found a couple of SourceForge projects on the subject, but they only have source code to download, and I don’t have enough time on my home computer right now to figure out how to turn that into an executable. :rolleyes: (yes, sad I know). Of course, an Applescript that does the conversion would be even better, but I don’t imagine that exists… :lol:
Strange… when I did something extremely similar, it quit with an error that said “[path to file] doesn’t exist”, where [path to file] was the actual path. Here’s the code I used, where fullPathWithoutPRC is a string path that I know is correct from previous testing:
save document 1 in (fullPathWithoutPRC as alias)
Maybe it’s because of the “as alias”?
Nope, hadn’t found that, and it looks perfect! Thanks!!!
P.S. I also forgot to mention as a side note that I’m not specifying for the moment the extension on the file to be saved - that shouldn’t matter AFAIK, though.
Definitely, for something to be an alias, it MUST exist. So, jonn’s example was to just specify a path, and use that. Many applications that claim (in their dictionary) to require a file, alias, or file specification will accept plain string paths. I find this pretty annoying, but that’s the way it is. I would hope there is never an application that actually requires an alias, because, as you noted, that is very annoying when saving a NEW document. If there was, though, a do shell script "touch " & quoted form of myPath command would create a new empty file for you.