「AppleScript」の版間の差分

提供: Wikinote
移動: 案内検索
(新しいページ: '== サンプル == * スリープタイマ display dialog "Sleep after input minutes:" default answer "30" set res to result if button returned of res is "OK" then set ...')
 
(サンプル)
 
行7: 行7:
 
     set curdate to current date
 
     set curdate to current date
 
     set time of curdate to (time of curdate) + sec
 
     set time of curdate to (time of curdate) + sec
     display dialog "Sleep at " & time string of curdate buttons {"Cancel"} giving up after sec     tell application "Finder"
+
     display dialog "Sleep at " & time string of curdate buttons {"Cancel"} giving up after sec
 +
    tell application "Finder"
 
         sleep
 
         sleep
 
     end tell
 
     end tell
 
  end if
 
  end if

2009年2月7日 (土) 16:24時点における最新版

サンプル

  • スリープタイマ
display dialog "Sleep after input minutes:" default answer "30"
set res to result
if button returned of res is "OK" then
    set sec to (text returned of res) * 60
    set curdate to current date
    set time of curdate to (time of curdate) + sec
    display dialog "Sleep at " & time string of curdate buttons {"Cancel"} giving up after sec
    tell application "Finder"
        sleep
    end tell
end if