Open AndrewMore1 opened 7 years ago
The scripting Place command is actually not quite the same as your UI Place command in Adobe Illustrator. What it does is have is a special behavior which handles some files in a different way than 'regular files' such as .png or .pdf files. For example, with AutoCad and SVG files, same thing will occur. I believe this is because when done via UI, the place command has the same steps as opening a file, but the user is spared the visuals when this is done. The same is happening with .rtf files, but as I have just tested out, Document.importFile(fileObj, false) function will have the effect of importing an .rtf file - so you may use this as an alternative. However, I'm not sure how to make this happen without the dialog box, which always pops up.
That's very helpful, thank you. As it turns out you can usually suppress user interactivity.
Snippet: var interactionLevel = app.userInteractionLevel; app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
// Do the thing
app.userInteractionLevel = interactionLevel;
You know what, I tried that, but I was in a hurry and had a syntax error which led me to believe the import dialog was not being suppressed. But you're exactly right, once I fixed it, it imports without issue.
Attempting to place a rich text file in Illustrator. I can get it to work correctly if I do it manually using File->Place, at which point it prompts me, then displays the text. However I get an error message "The file "x" is in a format which cannot be placed." if I attempt to do it programmatically.
Here's a code snippet: var doc = app.activeDocument;