Sg2.9
saveAs?
Recent RSS
saveAs?
From:  bigshiny90
Date:  15. December 2007, 06:09

hmmm, Scriptographer is a step up from Adobe scripting... so far in my opinion...

but.... is there a way to invoke saveAs from the scriptographer api? kinda important for my current project? how to get a save dialog with options hmmm?

thanks all, hopefully somebody is reading this forum.

bigshiny

Re: saveAs?
From:  Steve Light
Date:  17. December 2007, 12:53

try next:
var f=activeDocument;
f.write(new File('C:\\temp2008.ai'));

The Adobe Illustrator Package/Document:
write(file[, format[, ask]])
Parameters:
file: File
format: String (SaveOptions?)
ask: Boolean
Returns:
Boolean

Re: saveAs?
From:  bigshiny90
Date:  18. December 2007, 22:01

that's it... for some reason i kept thinking the write function was for other formats (as in Export), and my only try using it didn't work out. but that definitely works...

further question... how does one set saveoptions? like PDF compatibility, illustrator version, save with ICC color profile. etc...

thanks for the reply. awesome... and i never use that word. really.

bigshiny

Re: saveAs?
From:  Steve Light
Date:  19. December 2007, 09:57

I can't find any info about SaveOptions.

new example:
var f=activeDocument;
f.write(new File('C:\\temp2009.pdf'),'PDF File Format',true);
or
f.write(new File('C:\\temp2009.eps'),'Adobe Illustrator EPSF',true);

if you need to use predefined SaveOptions, try Adobe scripting (Illustrator CS2 JavaScript Scripting Reference, page 136).

I'm trying to combine SG and Adobe scripting (execute jsx from SG), but can't find File.execute method (found: canExecute/setExecutable).

Re: saveAs?
Date:  21. December 2007, 16:07

Steve: interesting stuff - let me know if you work it out.. could be a very powerful combination!

Re: saveAs?
From:  bigshiny90
Date:  21. December 2007, 19:47

figured this one out....

i just need to include the boolean true as the third argument... as Steve's example above shows... and the normal saveOptions dialog will come up as part of the save process. (Can't figure out how to preset in code but no worries...)

i do find that the write function can be a wee bit unstable (it crashes illustrator on occasion.) so we've had to drop using scriptographer for this!

unfortunately, that means i've had to move on to programming an actual c++ plugin for illustrator in this instance - which i was trying to avoid. but it turns out to be not so impossible - though i've had to learn c++. Really not as hard as i thought though.

  • bigshiny
Re: saveAs?
From:  Jürg Lehni
Date:  8. April 2008, 02:00

Apologies for only joining this discussion now.

Since you already know how to write plugins in C/C++, would you be interested in becoming a contributor to Scriptographer? The code is open and available, I will write a document with some explanations soon.

The saving of documents is one of the parts of the plugin that still needs work.

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
RandomTools 21.08.08