有整点报时功能#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Version=1.0.0.0
#AutoIt3Wrapper_icon=时钟.ico
#AutoIt3Wrapper_outfile=时间.exe
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include
#include
#include
#NoTrayIcon
FileInstall("时间背景.png",@TempDir&"\时间背景.png")
FileInstall("时钟.gif",@TempDir&"\时钟.gif")
Dim $isplay=1,$auto=True
$win=guiwnd("时间",@TempDir&"\时间背景.png",0,0,@DesktopWidth-170,@DesktopHeight-120)
$radio=ObjCreate("wmplayer.ocx")
$radio.settings.autostart=True
$radio.url="mms://211.89.225.101/live1"
$time=GUICtrlCreateLabel("",40,10,150,12)
GUICtrlSetBkColor(-1,0xffffff)
$dates=GUICtrlCreateLabel("",50,25,100,12)
GUICtrlSetBkColor(-1,0xffffff)
$menu=GUICtrlCreateContextMenu($time)
$live1=GUICtrlCreateMenuItem("广播(开/关)",$menu)
$exit=GUICtrlCreateMenuItem("退出",$menu)
While 1
$msg=GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $exit
Exit
Case $live1
$auto=False
if $isplay=0 Then
$radio.controls.play()
$isplay=1
Else
$radio.controls.stop()
$isplay=0
EndIf
Case 0
GUICtrlSetData($time,_Now())
GUICtrlSetData($dates,FormatLunarYr(@YEAR)&" "&weekday())
baoshi(@ScriptDir&"\正常整点报时",_NowTime())
Sleep(1000)
EndSwitch
WEnd
;==========================================函数声明区域==============================================
;干支年
Func FormatLunarYr($year,$sx=1)
Local $TianGan[10] = ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"]
Local $DiZhi[12] = ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]
;Local $ShengXiao[12] = ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"]
$year -= 4
;if $sx=1 Then
;Return $TianGan[Mod($year, 10) ] & $DiZhi[Mod($year, 12) ] & $ShengXiao[Mod($year, 12) ] & "年"
;Else
Return $TianGan[Mod($year, 10) ] & $DiZhi[Mod($year, 12) ] & "年"
;EndIf
EndFunc
;星期
Func weekday()
Local $week[7]=["星期天","星期一","星期二","星期三","星期四","星期五","星期六"]
Return $week[@WDAY-1]
EndFunc
;报时
Func baoshi($path,$nowTime)
Local $ZhenDian[24]=["0:00:00","1:00:00","2:00:00","3:00:00","4:00:00","5:00:00","6:00:00","7:00:00","8:00:00","9:00:00","10:00:00","11:00:00","12:00:00","13:00:00","14:00:00","15:00:00","16:00:00","17:00:00","18:00:00","19:00:00","20:00:00","21:00:00","22:00:00","23:00:00"]
Local $Sound[24]=["00.mp3","01.mp3","02.mp3","03.mp3","04.mp3","05.mp3","06.mp3","07.mp3","08.mp3","09.mp3","10.mp3","11.mp3","12.mp3","13.mp3","14.mp3","15.mp3","16.mp3","17.mp3","18.mp3","19.mp3","20.mp3","21.mp3","22.mp3","23.mp3"]
Switch $nowTime
Case ""
EndSwitch
If $nowTime=$ZhenDian[Number(@HOUR)] Then
if $auto=False Then
$radio.controls.stop()
$snd=_SoundOpen($path&"\"&$Sound[Number(@HOUR)])
_SoundPlay($snd,1)
if $nowTime="0:00:00" Then
$close=guiwnd("","closeSystem.png")
Sleep(5000)
GUIDelete($close[0])
Shutdown(13)
EndIf
$radio.controls.play()
Else
$snd=_SoundOpen($path&"\"&$Sound[Number(@HOUR)])
_SoundPlay($snd,1)
if $nowTime="0:00:00" Then
$close=guiwnd("","closeSystem.png")
Sleep(5000)
GUIDelete($close[0])
Shutdown(13)
EndIf
EndIf
EndIf
EndFunc
;===================================结束===================================================
[ 本帖最后由 xkbin 于 2008-9-9 23:02 编辑 ] |