トップ    編集凍結 差分バックアップ添付複製名前変更リロードPages that link to here   新規一覧単語検索最終更新
   最終更新のRSS

スクリプト例

システム音を順番に再生するスクリプト

require 'osx/cocoa'

snd_files =`ls /System/Library/Sounds/*.aiff`.split
snd_files.each do |path|
  snd = OSX::NSSound.alloc.initWithContentsOfFile_byReference (path, true)
  snd.play
  sleep 0.5
end

InterfaceBuilder で作成した nib ファイル内のクラスと関連づけられたクラス定義のサンプル

class AppController < OSX::NSObject

  ib_outlets :monthField, :dayField, :mulField

  def awakeFromNib
    @monthField.setIntValue Time.now.month
    @dayField.setIntValue Time.now.day
    convert
  end

  def convert(sender = nil)
    val = @monthField.intValue * @dayField.intValue
    @mulField.setIntValue(val)
    @monthField.selectText(self)
  end

  def windowShouldClose(sender = nil)
    OSX.NSApp.stop(self)
    true
  end
end

原著者: 藤本尚邦, <hisa at fobj.com>

                                                                                                                                                                                                                                                                                                                               
トップ    編集凍結 差分バックアップ添付複製名前変更リロードPages that link to here   新規一覧単語検索最終更新
   最終更新のRSS
Last-modified: 2010-03-25 (木) 03:16:34 (165d)