YD

Hello Community,

I would like to write a macro which can create a file and record the changes on the models. However, I can't create a file with the method Context.createOutputObject since it's a report function.

I would like to ask is there any method to create a file within the macro?

Thanks in advance!

by Kay Fischbach
Posted on Mon, 03/11/2019 - 10:13

Hi there,

as far as I can tell ArisScript itself does not offer any methods to create a file on the client.

However you are not restricted to only using ArisScript - you could use standard Java instead. Granted, I only managed to create a .txt file and write a single word into it - most likely you can find a more impressive way to do things.

var file = new java.io.File(Context.getSelectedOutputPath() + "\\" + Context.getSelectedOutputFile());

var writer = new java.io.FileWriter(file);
writer.write("test");
writer.close();

Context.executeFile(file.toPath()) //executeFile is the ArisScrip way to display files you created

Just don't forget to write the entire class path of a Java class whenever you're using one (so instead of "import java.io.File;" + "File(...);" just write "java.io.File(...);").

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

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