export to text in specific format #2901
-
Hi. I've been pulling my hair on this one: I'm trying to create the following: "Shortcut1" copies the text in a tab called "notes", in an item that has the tag "title". This item is emptied before copying something new. Anything that points me in the right direction helps. I read MOST documentation and script examples and I still can't pull this one. Please help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I hope the following command help (here is how to add the command to CopyQ): [Command]
Command="
copyq:
tab('notes');
// Remove \"title\" tagged item
const sel = ItemSelection().select(/title/, plugins.itemtags.mimeTags);
sel.removeAll();
// Send Ctrl+C to the active window to copy
copy();
const text = clipboard();
let newItem = {};
newItem[mimeText] = text;
newItem[plugins.itemtags.mimeTags] = 'title';
add(newItem);"
Icon=
IsGlobalShortcut=true
Name=Shortcut 1
You can write to a file with the following code: // NOTE: Use / as file separator in paths.
let file = File(filePath);
if (!f.openWriteOnly()) {
throw 'Failed to open the file: ' + f.errorString();
}
if (f.write(dataToWrite) == -1) {
throw 'Failed to save the file: ' + f.errorString();
} |
Beta Was this translation helpful? Give feedback.
I hope the following command help (here is how to add the command to CopyQ):