修改短标题脚本但弹窗两次 #412
修改短标题脚本但弹窗两次
#412
-
您好,想写一个脚本使用快捷键弹出窗口进行短标题的修改,遇到一个问题:点击ok或cancel后再次出现输入窗口。如何取消第二次的输入弹窗,请求支援🙏 var zoteroPane = Zotero.getActiveZoteroPane();
var items = zoteroPane.getSelectedItems();
for (let item of items) {
if (item && !item.isNote() && item.isRegularItem()) { // 正常条目,非笔记
var currentShortTitle = item.getField("shortTitle"); // 获取当前短标题
// 弹出对话框,要求用户输入新的短标题,当前短标题作为默认值
var newShortTitle = require('window').prompt("编辑短标题(当前: " + currentShortTitle + ")", currentShortTitle);
// 如果用户点击取消或未输入新短标题,则跳过该条目
if (newShortTitle !== null) {
item.setField("shortTitle", newShortTitle);
await item.saveTx(); // 保存更改
}
}
} 2024-10-24.18.44.27.2024-10-24.18.45.27.mp4 |
Beta Was this translation helpful? Give feedback.
Answered by
windingwind
Oct 25, 2024
Replies: 1 comment
-
https://github.com/windingwind/zotero-actions-tags?tab=readme-ov-file#custom-script
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
pencilheart
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/windingwind/zotero-actions-tags?tab=readme-ov-file#custom-script