<commit_before>@import './utilities.js';

function exportAllPages(context) {
	var sketch = context.api();
	var application = sketch.Application();
	var doc = context.document;
	var pages = doc.pages();
	var fileFolder = doc.fileURL().path().split(doc.displayName())[0];

	var rootFolder = fileFolder + "Pages to Folders/";

	Utilities.deleteAndCreateFolder(rootFolder);

	var pageCounter = 1;

	for (var i = 0; i < pages.count(); i++) {
		var currentPage = pages[i];

		if (pages[i].name() != "Symbols") {
			var pageFolderPath = rootFolder + pageCounter.toString() + " \u2013 " + pages[i].name() + "/";
			Utilities.createFolder(pageFolderPath);

			doc.setCurrentPage(currentPage);

			var artboards = doc.currentPage().artboards();

			for (var j = 0; j < artboards.count(); j++) {
				var artboard = artboards[j];
				var artboardNameWithDashesInsteadOfSlashes = Utilities.cleanArtboardName(String(artboard.name()));

				// TODO Try and get the exportable options for each artboard,
				// and export it that way. If there are no export options,
				// export the file as a @1x .png file.
				doc.saveArtboardOrSlice_toFile_(artboard, pageFolderPath + artboardNameWithDashesInsteadOfSlashes + ".png");
			}

			pageCounter = pageCounter + 1;
		}
	}

	application.alert("This plugin is still under active development and does not work fully. Your export can be found in a new folder right next to the file you wanted to export.", "Warning");
};<commit_msg>Added a message upon successfull export.<commit_after>@import './utilities.js';

function exportAllPages(context) {
	var sketch = context.api();
	var application = sketch.Application();
	var doc = context.document;
	var pages = doc.pages();
	var fileFolder = doc.fileURL().path().split(doc.displayName())[0];

	var rootFolder = fileFolder + "Pages to Folders/";

	Utilities.deleteAndCreateFolder(rootFolder);

	var pageCounter = 1;

	for (var i = 0; i < pages.count(); i++) {
		var currentPage = pages[i];

		if (pages[i].name() != "Symbols") {
			var pageFolderPath = rootFolder + pageCounter.toString() + " \u2013 " + pages[i].name() + "/";
			Utilities.createFolder(pageFolderPath);

			doc.setCurrentPage(currentPage);

			var artboards = doc.currentPage().artboards();

			for (var j = 0; j < artboards.count(); j++) {
				var artboard = artboards[j];
				var artboardNameWithDashesInsteadOfSlashes = Utilities.cleanArtboardName(String(artboard.name()));

				// TODO Try and get the exportable options for each artboard,
				// and export it that way. If there are no export options,
				// export the file as a @1x .png file.
				doc.saveArtboardOrSlice_toFile_(artboard, pageFolderPath + artboardNameWithDashesInsteadOfSlashes + ".png");
			}

			pageCounter = pageCounter + 1;
		}
	}

	application.alert("You can find the exported files in a folder next to your original file.", "Export Successful!");
};
{'fraction_non_alphanumeric': 0.13261399234249913, 'fraction_numerical': 0.006961364427427776, 'mean_word_length': 4.104795737122558, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6435006', 'n_tokens_mistral': 971, 'n_tokens_neox': 867, 'n_words': 256}