Skip to content

Instantly share code, notes, and snippets.

@davidsara
davidsara / BatchPropertyUpdate.ajs
Created September 17, 2020 09:47
#jArchi - Batch creating or updating properties.
// Batch creating or updating properties.
//
// (c) 2020 David Sara
var key = window.prompt("Please enter the property key", "");
var value = window.prompt("Please enter the property value", "");
$(selection).each(function (obj) {
obj.prop(key, value);
});
// Copy the selected elements to another model
//
// https://gist.github.com/eduardobbs/e39b00f45d12f43a55c31823facf0926
// Requires jArchi - https://www.archimatetool.com/plugins/
//
// (c) 2020 Eduardo Cuccolotto Sequinel
var msg = "Which model is the destination one (enter its index)?";
var modelList = $.model.getLoadedModels();
@tkazimie
tkazimie / addPrefix.ajs
Created July 18, 2020 19:42
Set the name prefix + colon for selected elements
/*
* Set the name prefix for selected elements
*
* Requires jArchi - https://www.archimatetool.com
*
* This script adds given text + collon before the object name.
* If prefix with collon already existed it is replace by new one.
* In case of wrong selection effect can be reversed with crt-z (command-z on Mac)
*
* Script will prompt you: for the text
@tkazimie
tkazimie / fromCsv.ajs
Last active June 14, 2022 14:10
#jArchi This scripts exports selected elements to the CSV in fixed structure and import elements to the model and the current view
/*
* Import Elements from CSV
*
* Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
* Requires PapaParse - https://www.papaparse.com/
*
* This script imports CSV containg followin structure:
* * Name
* * Documentation
* * Type (element type)
@jbsarrodie
jbsarrodie / Sync Model from CSV.ajs
Last active April 23, 2025 08:55
#jArchi scripts to sync (some) model concepts from one or more CSV files
// Sync Model from CSV.ajs
//
// Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
//
// This script allows easy integration of data coming from other systems through CSV files.
// Each CSV file is described through a configuration object that you can later load and sync.
// Most of the mapping informations (Id, Name, Documentation, Properties...) can be expressed through
// the name of a column from the CSV file or through a function (which allows more advanced computation).
//
// Dataset used as example comes from https://datahub.io/core/country-codes
@tsanov
tsanov / Compare Names with CSV.ajs
Last active October 25, 2020 09:54
#jArchi Compare Names with CSV
/*
* Verify if the values in the first column of a CSV file are used as names
* in the selection
*
* This work is derived from:
* - smileham/Import from CSV.ajs
* - smileham/Export to CSV.ajs
*
* Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
* Requires PapaParse - https://www.papaparse.com/
@rchevallier
rchevallier / JFaceConfigDialog.ajs
Last active March 17, 2023 18:15
#jarchi Sample to demonstrate how to create a Configuration dialog box for a jArchi .ajs script
//@ts-check
/**
* Test of a dialog box in jarchi, SWT style
*/
/**
* @typedef {any} JavaClass
* @typedef {Object<string, function>} JavaObject
*/
@VinceAxe
VinceAxe / Show duplication.ajs
Last active January 14, 2021 13:57
#jArchi script to report all duplication in a model
/*
* Check the name of all concept and shows only if found more than once
*/
var debug = true;
debug ? console.show():true;
debug ? console.clear():true;
console.log("Show all duplications:");
@jbsarrodie
jbsarrodie / Resize objects in selected view.ajs
Created March 2, 2020 15:52
#jArchi script to resize visual objects in the selected view
// Resize objects in selected view
//
// Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
//
// This script resizes visual objects in the selected view
//
// (c) 2020 Jean-Baptiste Sarrodie
var factor = window.prompt("Resize factor for objects?", 2);
if (!factor) {
@jbsarrodie
jbsarrodie / Merge multiple concepts (and delete others).ajs
Last active September 20, 2024 04:13
#jArchi script to merge multiple concepts (and delete others)
// Merge multiple concepts (and delete others)
//
// Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
//
// This script merges multiple concepts (and delete others)
//
// Version 1.1 (2020/01/20) Add an option to keep only the content of the "target" concept
// Version 1.0 (2019/11/12) First version published
//
// Known limitation: works only on elements, not relationships