WY

Hi,

I have got a request to export EPC as a graphic file like JPEG or some other common format. However, it seems ARIS Script only supports doc/pdf/xls/rtf/txt/html format. I noticed that when exporting EPC as html, a png file would be created. Does any one know how to get the png file directly using ARIS script?

 

Thanks in advance.

 

Regards,

Will

by Eva Klein
Badge for 'Community Team' achievement
Posted on Tue, 02/15/2011 - 14:26

Hi Will,

First, you need to specify which model should be exported. This is done as follows: 

var models = ArisData.getSelectedModels()

Then you need the method “createOutputObejct()”, which returns a new output object with preset name, format, and media size . 

var outputDummy = Context.createOutputObject() 

Getting the graphic of a model can be done by calling the Graphic method of the model object. This method uses three parameters. The first parameter means that the object is always visible on a part of the graphic. The second parameter defines whether the returned graphic should be black & white or contain colors (false = color, true = black and white). The last parameter specifies the language to be returned.

var picture = models[i].Graphic(false, false, Context.getSelectedLanguage()

The method“Save()” saves a picture object as an EMF, PNG, or JPG file. In our example the picture is saved as a png

picture.Save(outputDummy, imageFileName)

Everything else is just iterating over the list of models, etc..

var models = ArisData.getSelectedModels()

var outputDummy = Context.createOutputObject()
for(var i=0; i<models.length; i++)
{
var picture = models[i].Graphic(false, false, Context.getSelectedLanguage() )
var imageFileName = "ModelImage_"+i+1+".png"
picture.Save(outputDummy, imageFileName)
Context.addOutputFileName(imageFileName)
Context.setSelectedFile(imageFileName)
}

Make sure to watch the Reports & Macros group. There you will find additional tutorials which will help you to get started with ARIS scripting.

Regards

Eva

0
by Matus Novotny
Posted on Fri, 08/15/2014 - 18:33

In reply to by Eva Klein

Hello!

I used following code in ARIS 7.2 script and it worked fine.

    var output = Context.createOutputObject();
    var picture = model.Graphic(false, false, Context.getSelectedLanguage());
    var imageFileName = model.Name(g_nLoc)+".png";
    picture.Save(output, imageFileName);

Now I am trying to run the same script in ARIS 9.6 and I am getting an error on calling ‘Save’ function:

Can't find method com.idsscheer.report.output.external.interfaces.impl.APicture.Save(com.idsscheer.report.output.outputobject.asposeapi.AMergeableOutputObject,string)

Does anyone know where could be the problem by running the script in ARIS 9.6?

Thanks

Matus

0
by Rimma Askarova
Posted on Tue, 05/21/2019 - 08:02

In reply to by Eva Klein

Good morning! Please Help me 

I  run script:

var aModel = ArisData.getSelectedModels();

var oOutput = Context.createOutputObject();

var nLoc = Context.getSelectedLanguage();

for(var i = 0; i <aModel.length; i ++){

var picture = aModel[i].Graphic(false, false, nLoc);

var imageFileName = " " + i + 1 + ". png";

picture.Save (oOutput, imageFileName); 

Context.addOutputFileName (ImageFileName);

Context.setSelectedFile (ImageFileName);

}

 

but out error: Unable to greate the model Graphic.

Why?????

0
by Kay Fischbach
Posted on Tue, 05/21/2019 - 08:47

In reply to by RimmaAris

Three things to note here:

  1. There is a space in between your dot and file extension type in your imageFileName variable value. That's what makes the picture.Save(...) method crash.
  2. You should remove either the line with Context.addOutputFileName(...) or the line with Context.setSelectedFile(...), they do almost the same thing and you need only one of them. Which one you choose depends on what you want to do. Is there a normal output file, like a .doc file and you want the .png in addition to that .doc file, use Context.addOutputFile(...). If the .png file is the only file you want, use Context.setSelectedFile(...)
  3. In whichever line remains from my second note, you should change " ImageFileName" to " "imageFileName".
0
by Kay Fischbach
Posted on Tue, 05/28/2019 - 10:01

In reply to by RimmaAris

I apologize for any confusion I may have caused. The simplest working way I could find was the following:

var aModel = ArisData.getSelectedModels();
var oOutput = Context.createOutputObject();
var nLoc = Context.getSelectedLanguage();

for(var i = 0; i <aModel.length; i ++){
    var picture = aModel[i].Graphic(false, false, nLoc);
    var imageFileName = " " + i + 1 + ".png";
    picture.Save (oOutput, imageFileName);
    Context.addOutputFileName (imageFileName);
}
0
by Will Yang Author
Posted on Wed, 02/16/2011 - 06:31

Hi Eva,

I have tried your program and it works! The Save() method is what I am looking for. Thank you so much for reply.

Of course I will watch Reports & Macros group and hope I can help this community.

Thanks again.

Regards,

Will

0
by Esteban Moyao
Posted on Mon, 08/22/2011 - 19:16

reply excelent!!! Eva, thanks, I am hope help too!

0
by Gilad Wilk
Posted on Tue, 01/17/2012 - 09:17

Hello Eva,

I have a question that the Save option might be the answer for,

I am trying to reduce the size of a report that I created. The report summarize some (a lot) models into a word document.

The problem that we encountered was that the file created as RTF and because of this exceeds the 512 MB size allowed (by Microsoft).

I tried to lower the resolution of the pictures and transfer them to black and white, but it only partly helped (the file is smaller but still above the 512 MB).

Is there any chance that the save function could help me reduce the pictures resolution inside the RTF document?

Thank you very much in advance,

Gilad

0
by Gilad Wilk
Posted on Wed, 01/18/2012 - 10:55

In reply to by Sadiq

Hello once again,

does anyone have any answer for me?

I am in a bit of a time shortage and desperate for  a response...

Thanks in advance,

Gilad

0
by Torsten Haase
Posted on Wed, 01/18/2012 - 14:20

Hi Gilad,

Which ARIS version do you use? If it's the latest 7.2, you could try a new feature which will become 'official' soon. If you use output format MS Word ("doc"), not RTF(!), calling the following line of code before creating an output object in your script, will use a new implementation of the output object, which creates much smaller DOC output files:

Context.setProperty("use-new-output", true)

Best regards,



Torsten

0
by Gilad Wilk
Posted on Thu, 01/19/2012 - 08:34

Hi Torsten,

Thank you very much for the replay,

I am using the 7.2 and I even tried to use the Context.setProperty("use-new-output", true).

The problem with that, beside the very good outcome of a smaller size document, it "destroyed" my index and "demolished" my in-text hyperlinks.

Did you ever tried using those 2 (index + hyperlink) with the new feature?

Thank you once again,

Gilad

 

 

0
by Torsten Haase
Posted on Thu, 01/19/2012 - 10:37

Hi Gilad,

I have not heard about such errors yet. Could you provide a small script demonstrating the issues? With this, this can be fixed for the next service release.

BR,

Torsten

0
by Gilad Wilk
Posted on Thu, 01/19/2012 - 12:20

Hi Torsten,

I am ataching the relevant parts from my code,

any help will be highly appreciated,

Thanks again,

Gilad

 

 Code regarding TOC

Constants.C_BLACK, Constants.C_TRANSPARENT,Constants.FMT_BOLD| Constants.FMT_LEFT, 0, 0, 0, 0);

    g_ooutfile.SetTOCFormat(1, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT ,1, 1, 0, 0);

    g_ooutfile.SetTOCFormat(2, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT,  Constants.FMT_LEFT ,2, 2, 0, 0);

    g_ooutfile.SetTOCFormat(3, "Arial", 9, Constants.C_BLACK, Constants.C_TRANSPARENT,Constants.FMT_BOLD|  Constants.FMT_LEFT ,3,10, 0, 0);

 

    var firstLevel = "HEADING 1"

    var secondLevel = "HEADING 2"

    var thirdLevel = "HEADING 3"

    var fourthLevel = "HEADING 4"

Constants.C_BLACK, Constants.C_TRANSPARENT,  Constants.FMT_BOLD|Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY0, 0, 0, 0, 0, 0, 1);

    g_ooutfile.DefineF(secondLevel, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY1 , 4, 0, 0, 0, 0, 1);

    g_ooutfile.DefineF(thirdLevel, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT,  Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY2 , 8, 0, 0, 0, 0, 1);

g_ooutfile.DefineF(fourthLevel, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY3, 12, 0, 0, 0, 0, 1);

 

function outputTOC(  ){

    g_ooutfile.BeginSection(true, Constants.SECTION_INDEX);

    g_ooutfile.OutputLnF("Table Of Contents", "Ariel18BoldCenter" );

    g_ooutfile.OutputLnF("","Ariel18BoldCenter" );

    g_ooutfile.SetAutoTOCNumbering(true)

 

    g_ooutfile.BeginParagraph(Constants.FMT_LEFT, 5, 5, 5, 5, 0, 2, 10);

    g_ooutfile.OutputField( Constants.FIELD_TOC, "Arial", 10,Constants.C_BLACK, Constants.C_TRANSPARENT,  Constants.FMT_LEFT);

    g_ooutfile.EndParagraph();

    //g_ooutfile.EndParagraph();

    g_ooutfile.EndSection();

}//END::outputTOC()

 

g_ooutfile.OutputLnF("Executive Summary", firstLevel);

 

Code regarding Hyperlink -

Constants.C_BLACK, Constants.C_TRANSPARENT,  Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP  | Constants.FMT_LINKTARGET | Constants.FMT_TOCENTRY1, 4, 0, 0, 0, 0, 1);

g_ooutfile.DefineF("insteadOfHeading2", "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT,  Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP  | Constants.FMT_LINKTARGET | Constants.FMT_TOCENTRY2, 8, 0, 0, 0, 0, 1);

 

g_ooutfile.OutputLinkF(ScreenViewAppName,ScreenViewAppName,"Ariel10LeftLink");

 

g_ooutfile.OutputLnF(ScreenViewAppName, "insteadOfHeading");

"

 

 

0

Featured achievement

Question Solver
Share your expertise and have your answer accepted as best reply.
Recent Unlocks
  • CP
  • BZ
  • Profile picture for user TEF_Bernd
  • ПЦ
  • CR
  • PacMan

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock