someweirdsinsomeweirdsin
Participant
    Post count: 2

    Hello, people of Earth.

    I have installed ETS SDK recently and made wrappings in JavaScript(using Jint interpreter) for some Sdk functions.

    https://box.bobalus.tech/cloud/index.php/s/j8Yb23xqtKNQR7C
    md5 hash: 3d8fce6050db844c16c45fd257ccb12d

    Archive contains project source code and compiled binaries, zipped into .etsapp container.

    All of these I developed and compiled in MicroSoft Visual Studio Community edition, which is free to use for physical person.

    As and editor I used AvalonEdit and Ctrl+Space inside text area should show helper with commands.

    I didn’t use it with ETS, but, guessing, it is working (at least source code is ok).

    As a general reminder: always make backups for your own good.

    Simple example:

    setStrictMode(false);
    createGroupAddress("2/3/4", "meoow");

    More complex example(create group addresses and link comm objects for device):

    clear();
    setStrictMode(false);
    
    let device = "1.1.1";
    let range = "1/1"; let i = 0;
    let info = getDeviceInfo(device);
    
    writeln(JSON.stringify(info, null, 2));
    info.communication_objects.forEach(function(co) {
    	let addr = range + i;
    	createGroupAddress(addr, co.text);
    	link(device, co.number, addr);
    });

    Last one:

    
    // now a quick way to swap communication objects -
    // for example you need to swap two push buttons on device
    
    clear();
    
    function swapCo(device, num1, num2) {
    	let info = getDeviceInfo(device);
    	writeln(info, 1);
    	let co1 = null;
    	let co2 = null;
    	
    	info.communication_objects.forEach(function(co) {
    		if (co.number === num1)
    			co1 = co;
    		else if (co.number === num2)
    			co2 = co;
    	});
    	if (co1 === null || co2 === null)
    		return writeln("some of comm objects not found");
    	
    	co1.links.forEach(function(l) {
    		unlink(device, co1.number, l);
    		link(device, co2.number, l);
    	});
    	co2.links.forEach(function(l) {
    		unlink(device, co2.number, l);
    		link(device, co1.number, l);
    	});
    };
    
    swapCo("1.1.42", 17, 122);
    swapCo("1.1.42", 27, 132);
    • This reply was modified 2 years, 10 months ago by someweirdsinsomeweirdsin. Reason: formatting