How to export selection in AI CC 2015.3?


hi

 

i have developed plugin ai cc 2015.3 both win , mac.

there scenario in plugin have export selected objects inside loop.

 

i couldn't find direct method in api it.

so, here have done,

i copy selection, create new document, paste there, export whole document png, close it, , repeat process next group.

aicommandid copycommand; error = saicommandmanager->getcommandidfromname(kcopycommandstr, &copycommand); error = saimenu->invokemenuaction(copycommand);  aicommandid cutcommand; aierr error = saicommandmanager->getcommandidfromname(kcutcommandstr, &cutcommand); error = saimenu->invokemenuaction(cutcommand);  aicommandid undocommand; error = saicommandmanager->getcommandidfromname(kundocommandstr, &undocommand); error = saimenu->invokemenuaction(undocommand);  aidocumenthandle dochandle; ainewdocumentpreset p; ai::unicodestring preset;  ai::unicodestring pres("print"); error = saidoclist->getpresetsettings(pres, &p); error = saidoclist->new(preset, &p, kdialognone, &dochandle);  aicommandid pastecommand; error = saicommandmanager->getcommandidfromname(kpasteinplacecommandstr, &pastecommand); error = saimenu->invokemenuaction(pastecommand);  error = exportpieces(note); //error = saidoclist->close(dochandle);  aicommandid closecommand; error = saicommandmanager->getcommandidfromname(kclosecommandstr, &closecommand); error = saimenu->invokemenuaction(closecommand);  aicommandid deselectcommand; error = saicommandmanager->getcommandidfromname(kdeselectallcommandstr, &deselectcommand); 

 

the above happens inside loop.

 

here export method,

 

aierr manageexport::exportpieces(std::string notename) {     aierr result = knoerr;     aiactionparamvalueref valueparameterblock = null;     actiondialogstatus dialogstatus = kdialognone;          try     {         result = saiactionmanager->ainewactionparamvalue(&valueparameterblock);                  if (valueparameterblock)         {             std::string pathname; #ifndef unicode             pathname = myplugin::mypath;             pathname.append("/export/"); #else             std::wstring wstr = myplugin::mypath;             pathname = std::string(wstr.begin(), wstr.end());             pathname.append("\\export\\"); #endif                          pathname.append(notename);             pathname.append(".png");             result = saiactionmanager->aiactionsetstring(valueparameterblock, 'name', pathname.c_str());             result = saiactionmanager->aiactionsetstring(valueparameterblock, 'frmt', "adobe png format");             result = saiactionmanager->aiactionsetstring(valueparameterblock, 'extn', "png");             result = saiactionmanager->playactionevent(kaiexportdocumentaction, dialogstatus, valueparameterblock);                          result = saiactionmanager->aideleteactionparamvalue(valueparameterblock);         }     }     catch (ai::error& ex)     {         result = ex;     }          return result; } 

 

however, when execute it, exports latest selection.

what doing wrong?

can guide me please?

are changing filename? don't see "note" being set.



More discussions in Illustrator SDK


adobe

Comments

Popular posts from this blog

Why is os_ViewContainer running?

ai Files

Illustrator CS6 Ocurrío un error E/S en el archivo.