吉吉于

free

AppleScript 杂七杂八

今天花了几个小时看了一下AppleScript,胡写了一些,便于以后用到的时候有的看。

 

 

 

(* 
	2012 LAZYNIGHT 
	AppleScript 杂七杂八

display dialog "Lazynight Flowerowl" buttons {"Hello world", "HTTP://LAZYNIGHT.ME"} default button "Hello world" with icon stop

set num to 100
set num2 to 50
set a to num + num2
get a
set |代码变量1| to 1000.0
get |代码变量1|
set i to 1
set abc to result + 1 --输出2
--if (abc) is equal to 2 then
--	display dialog "abc equal 2
--end if 
log "Put this int the log."
log "And then put this in as well"
log 100
log 100 * pi
set x to 100
log x
set mystring to "HAHA,LAZYNIGHT"
display dialog mystring

set bool to true
log bool
set bool to not bool
set a to "http://lazynight.me"
set b to 25
log class of a
log class in b
set r to 124.23424
set int to 333
set str to "www.baidu.com"
log class of r
log class of int
set r to r as integer
log class of r
set int to 123
display dialog (int as string)
round 1.5
round 1.2 rounding up
round 1.42 rounding down
round 1.25 rounding toward zero
round 1.5 rounding to nearest
round 1.5 rounding as taught in school
set a to current date

log year of a
log month of a
log day of a
log weekday of a
log time of a
log date string of a
log time string of a
log short date string of a
log (time of (current date)) div hours 

display dialog "Applescript 中文教程是哪里发布的?" default answer "Http://lazynight.me"

set dialogResult to result
log dialogResult
set dialogText to text returned of dialogResult
log dialogText
set dialogButton to button returned of dialogResult
log dialogButton

display dialog "你多大了~?" default answer "0"
set age to text returned of result as number
if age ≤ 18 then
	display dialog "你好,小童鞋。" buttons {"OK"}
else
	display dialog "HELLO, MAN." buttons {"ok"}
end if

set now to time of (current date)
set now to (now div hours)
if (now ≥ 6 and now ≤ 10) then
	display dialog "早上好~!"
else if (now < 16) then
	display dialog "中午好~!"
else if (now ≤ 22) then
	display dialog "晚上好~!"
else
	display dialog "快去睡觉吧~"
end if

*)

 

转载请注明:于哲的博客 » AppleScript 杂七杂八