function writingFilesEnabled() {
    var errStrings = {
        errLineOne: localize("运行此脚本需要设置首选项。"),
        errLineTwoStart: localize("请转至"),
        errLineTwoEnd: localize("部分,并确保已经勾选了“允许脚本写入文件和访问网络”。"),
        sectionGeneral: localize("应用程序首选项中的“常规”"),
        sectionScripting: localize("“脚本和表达式”")
    }

    var version12Check = (
        parseFloat( app.version ) > 12.0 ||
        ( parseFloat( app.version ) === 12.0 &&
            app.buildNumber >= 264 ) ||
        app.version.substring( 0, 5 ) !== "12.0x" );

    var mainSectionStr = ( version12Check ) ? "Main Pref Section v2" : "Main Pref Section";

    var version16Check = ( parseFloat( app.version ) > 16.0 );

    var securitySetting = app.preferences.getPrefAsLong( mainSectionStr, "Pref_SCRIPTING_FILE_NETWORK_SECURITY" );

    var errSecuritySetting = [
        errStrings.errLineOne,
        [ errStrings.errLineTwoStart, ( version16Check ) ? errStrings.sectionScripting : errStrings.sectionGeneral, errStrings.errLineTwoEnd ].join( " " )
    ].join( "\n" )

    if ( securitySetting === 0 ) {
        alert( errSecuritySetting );
        ( version16Check ) ? app.executeCommand( 3131 ): app.executeCommand( 2359 );
    }

    return ( securitySetting === 1 );
}

 

您的电子邮箱地址不会被公开。 必填项已用*标注