View Single Post
I cannot seem to figure out how to save an OO file using data I have from the file. Here's what I'd like to do:

grab the contents of a row and make that be the filename
save the file with that name in a certain folder (which is hard-coded).

Hopefully I'm just doing something stupid, but I'd sure appreciate some help here!

My simple code that "should" work:

set thepath to "/Users/wblj/myfolder/" as text
-- go take a look at the front doucment:
set thedoc to document 1
-- go get the user-specified filename from the column title:
set thetitle to title of column 2 of thedoc
-- Set the document to know where to save itself:
set properties of thedoc to {name:(thetitle), path:(thepath)}
-- Save away
save thedoc

What happens is the the file saves itself as a folder / xml file at the root of the drive. Not what I had in mind.

I've tried variations:

set thepath to "/Users/wblj/myfolder/" as text
-- go take a look at the front doucment:
set thedoc to document 1
-- go get the user-specified filename from the column title:
set thetitle to title of column 2 of thedoc

-- Save away
set thenewpath to thepath & thetitle
save thedoc in (thenewpath as string)

This does exactly what I have in mind, except that the file doesn't know where it saved itself, so you cannot do additional saves form the app :-(

Any help would be most appreciated!