Copy link to clipboard
Copied
Hello,
I would like to try out the Document.importFile() function introduced in CC2015.
CC2015 | Document.importFile (importFile: File ) |
Adobe Illustrator 19 Type Library | |
Import the file into current Ai document. | |
importFile: Data Type: File | |
The file to import in the current document. |
But I don't know which arguments to pass to the function.
I tried this code:
var doc = app.activeDocument;
var file = File('/Users/outcrash/Desktop/Sketches/CM8319_big.svg');
doc.importFile(file);
But I get "Illegal argument - argument 2"
I tried several variations for the second argument: 1, true, false, null etc...
Looking at the Data Browser in ESTK, the function clearly exists, but there are no arguments shown:
When i print out the function like this:
$.writeln(doc.exportSelectionAsAi);
I only get this in the console:
function importFile() {
[native code]
}
I also tried stepping into the function by setting a breakpoint, but it wouldn't go into the code.
Has anybody tried that function already and know which arguments to pass?
Hi, the full documentation for that is :
Document.importFile (importFile: File , isLinked: Boolean , libraryName: string , itemName: string , elementRef: string , modifiedTime: number , creationTime: number , adobeStockId: string , adobeStockLicense: string )
So it seems only relative to importing file from Creative Cloud Libraries, and the 1st argument should be Path (or the URL) to the library file. But still don't know what that is like. The 2nd argument will be true or false, all the others a
...Copy link to clipboard
Copied
Hi, the full documentation for that is :
Document.importFile (importFile: File , isLinked: Boolean , libraryName: string , itemName: string , elementRef: string , modifiedTime: number , creationTime: number , adobeStockId: string , adobeStockLicense: string )
So it seems only relative to importing file from Creative Cloud Libraries, and the 1st argument should be Path (or the URL) to the library file. But still don't know what that is like. The 2nd argument will be true or false, all the others are optional.
Copy link to clipboard
Copied
As an option, try:
activeDocument.importFile( File('your file path') );
Copy link to clipboard
Copied
Thanks moluapple and Alexander LAdygin
For other people, you can use the Object Model Viewer for looking all functions available.
On Mac go to Help -> Object Model Viewer.
Didn't know about this.
The only thing which has been bugging me for quite a long time now is the Swatch conflict popup.
Even though I'm using:
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
I still get these alerts.
That's why I was trying out the importFile() function, hoping to avoid that popup.