Hello,
I will be very grateful if you can help me with this. I am working in a script (copyPaste.js) and i am blocked in one point. I need to simulate a mouse click on anyplace of my document, after copy and paste. It works correctly but i need to say where my object must been paste.
At the moment, my code is the follows:
//Begin.
var action = RGuiAction.getByScriptFile("scripts/Edit/Copy/Copy.js");
if (!isNull(action)) {
action.slotTrigger();
}
var action = RGuiAction.getByScriptFile("scripts/File/NewFile/NewFile.js");
if (!isNull(action)) {
action.slotTrigger();
}
var document = getDocument();
var action = RGuiAction.getByScriptFile("scripts/Edit/Paste/Paste.js");
if (!isNull(action)) {
action.slotTrigger();
}
//MOUSE_CLICK
this.autoZoom();
//End.
I need to put the code on //MOUSE_CLICK zone.
Many thanks!!
Kind regards.
[solved] Paste script mouse click
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Re: Paste script mouse click
This won't work as Paste is an interactive tool requiring the target position as user input as well as other parameters.
FileNew and Copy are not interactive and immediately return control to your script.
To paste the clipboard, you can use a paste operation as follows (where x and y are your target coordinates):
FileNew and Copy are not interactive and immediately return control to your script.
To paste the clipboard, you can use a paste operation as follows (where x and y are your target coordinates):
Code: Select all
var op = new RPasteOperation(RDocument.getClipboard());
op.setOffset(new RVector(x,y));
op.setRotation(0.0);
op.setScale(1.0);
op.setFlipHorizontal(false);
op.setFlipVertical(false);
op.setToCurrentLayer(true);
op.setOverwriteBlocks(true);
op.setCopyEmptyBlocks(true);
var di = getDocumentInterface();
di.applyOperation(op);
Re: Paste script mouse click
It works!!.
Many many thanks.
I'm really grateful
Many many thanks.
I'm really grateful