Notifierのバリエーションwww

昨夜、approverから承認おりましたが、直後に不具合報告が入ってorz.
とりあえずリトラクトしてあります。今しばしお待ちくださいなんですが、昨日の通知センターネタなんですが、バリエーションがございまして、とりあえず並べときますね。(読点多めw)

まずは先日まで利用していたGrowl君をひっぱたくやつ

function sendGrowlNotify(title,discription){
    try{
        var growlNotify =’tell application “GrowlHelperApp”\r’+
            ‘set the allNotificationsList to {“indesign”}\r’+
            ‘set the enabledNotificationsList to {“indesign”}\r’+
            ‘register as application “Indesign Notify” all notifications allNotificationsList ‘+
            ‘default notifications enabledNotificationsList icon of application “Adobe InDesign CC”\r’+
            ‘notify with name “indesign” title “‘+title+
            ‘” description “‘+discription+'” application name “Indesign Notify”\r’+
            ‘end tell’;
        var ntfy = ‘display notification “‘ + discription + ‘” with title “‘ + title + ‘”‘;
        app.doScript(growlNotify , ScriptLanguage.APPLESCRIPT_LANGUAGE);
        }
    catch (e){}
    }

これはKamisetoせんせ直伝の代物ですね。
はい、続いてNotification Scriptingってスクリプトから叩くのを前提としたアプリケーションを利用したものです。

function sendNotify(title,discription){
    try{
        var ntfyr = ‘tell application “Notifications Scripting”\r’
                    + ‘set dict to {theName:”Notifications Scripting”, theVersion:”1.0″, theScript:event handlers script path}\r’
                    + ‘display notification “Title” message “Message Body”\r’
                    + ‘quit\r’
                    + ‘end tell’;
        app.doScript(ntfyr , ScriptLanguage.APPLESCRIPT_LANGUAGE);
        }
    catch (e){}
    }

まあ、華麗にするーして、昨日のを

function sendNotify_(title,discription){
    var ntfyr = ‘display notification “‘ + discription + ‘” with title “‘ + title + ‘”‘;
    app.doScript(ntfyr , ScriptLanguage.APPLESCRIPT_LANGUAGE);
    }

というゴールに辿り着いたのです。しかしながらWinな人にはちっとも面白く無いのでは申し訳ありません。
で、捻りだしたのが以下

function notifyVB(title, msg) {
    var vbs= ‘Dim objShell, intButton\r’
            + ‘set objShell = CreateObject(“Wscript.Shell”)\r’
            + ‘intButton = objShell.Popup(“‘ + msg + ‘”, 3,”‘ + title + ‘”, &H40)’;
    app.doScript(vbs, ScriptLanguage.VISUAL_BASIC);
    }

VBスクリプトを利用します。動くんか?コレ???(テストしてないw)
多分アラートみたいなのが表示されて3秒後に勝手に消えます。(ホントか???)

ten_a

Graphic Designer, Scripter and Coder. Adobe Community Professional.

シェアする

コメントを残す