Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi there,
the default behavior of windchill is, that if somethings goes wrong during checkin process, the checkin comment is lost.
So I tweaked <Windchill-installation>\codebase\templates\uwgm\cadx\checkin\checkintables.js a little to make a copy of the comment to a new window like:
var comment_window = window.open();
comment_window.document.writeln(comment);
(I intentionally left all code out, which "prettifies" the new window)
works great!
Now I want to copy the comment directly to the clipboard.
But when I try this
// copy comment to clipboard
navigator.clipboard.writeText(comment)
.then(() => {
alert("successfully copied: " + comment);
})
.catch(() => {
alert("something went wrong");
});
I get the error under Creo 8.0.6.0, "checkintables.js Uncaught TypeError: Cannot read properties of undefined (reading 'then')"
What am I doing wrong?
Solved! Go to Solution.
Ok, I think I found the solution
There is an article at w3docs.com about that.
The third and last method works within Creo's embedded browser.
...
copyTextToClipboard(comment);
...
}
async function copyTextToClipboard(text) {
try {
await navigator.clipboard.writeText(text);
console.log("Text copied to clipboard " + text);
} catch(err) {
console.log('Error in copying text: ', err);
}
}
Ok, I think I found the solution
There is an article at w3docs.com about that.
The third and last method works within Creo's embedded browser.
...
copyTextToClipboard(comment);
...
}
async function copyTextToClipboard(text) {
try {
await navigator.clipboard.writeText(text);
console.log("Text copied to clipboard " + text);
} catch(err) {
console.log('Error in copying text: ', err);
}
}