Script for moving components around on the pcb

i try to move a component (i know this is not at all elegant) - but seems like it should work - whenever I try this, i get ‘your design is not being saved. 4 actions are pending to sync’ ‘attempting to reconnect to server’ ‘connected to server’ - over and over again. if i am doing this wrong, please tell me how to do it correctly. I know where each component is supposed to go (i have a very long list, created mathematically for a keyboard) - and so i want to put the key switches and LEDs in the right place.

var point = new up.common.Point(100,100); for(var i=0;i<api.components.length;i++) { if (api.components[i].refDes.startsWith("SW")) { print(api.components[i].refDes); api.components[i].setAttribute('footprint_position', point); } }