javascript JXA Dialogs

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript JXA Dialogs相关的知识,希望对你有一定的参考价值。



function dialogDisplay(textToDisplay, options={}) {

    var textToDisplay = textToDisplay || "The text to display in the dialog box!";
    var defaultAnswer = options.defaultAnswer || "The default editable text.";
	var hiddenAnswer = options.hiddenAnswer || false;
    var buttons = options.buttons || ['one', 'two', 'three'];
    var defaultButton = options.defaultButton || "three";
    var cancelButton = options.cancelButton || "two";
    var withTitle = options.withTitle || "This is the Dialog Box Title";
    var withIcon = options.withIcon || 'caution' // ["stop"/‌"note"/‌"caution"]
    var givingUpAfter = options.givingUpAfter || 5;

    var app = Application('System Events')
    app.includeStandardAdditions = true;
	
    var dialog = app.displayDialog(textToDisplay,
        {
            defaultAnswer: defaultAnswer,
			hiddenAnswer: hiddenAnswer,
            buttons: buttons,
            defaultButton: defaultButton,
            cancelButton: cancelButton,
            withTitle: withTitle,
            withIcon: withIcon,
            givingUpAfter: givingUpAfter
        })

    return dialog;
}


dialogDisplay("hello!");

以上是关于javascript JXA Dialogs的主要内容,如果未能解决你的问题,请参考以下文章

javascript 使用节点中的jxa测试抓取到期任务

20160220 - JavaScript for OS X Automation 调试技巧

未安装错误模块“QtQuick.Dialogs”

pyqt:无法导入 QtQuick.Dialogs

Application.dialogs()

如何使用cordova-plugin-dialogs?