找回密码  加入

AUTOIT CN

搜索
查看: 9195|回复: 45

异形窗口—时间

[复制链接]
发表于 2008-9-6 14:21:08 | 显示全部楼层 |阅读模式
有整点报时功能
#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 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?加入

x

评分

1

查看全部评分

发表于 2008-9-6 15:43:54 | 显示全部楼层
楼主的想法不错呀
是那个广播电台?
 楼主| 发表于 2008-9-6 16:53:08 | 显示全部楼层

回复 2# redapple2008 的帖子

呵呵..................................中国之声
发表于 2008-9-6 17:21:58 | 显示全部楼层
wow,nice one!
发表于 2008-9-8 12:40:23 | 显示全部楼层
支持一下!做得不错!
发表于 2008-12-3 18:11:53 | 显示全部楼层
我对于网络收音机的兴趣比报时表更有兴趣。
发表于 2008-12-7 11:06:43 | 显示全部楼层
guiwnd???
发表于 2008-12-9 00:49:04 | 显示全部楼层
代码不完整,没有包含库文件
发表于 2008-12-9 18:00:27 | 显示全部楼层
太有才了!!!哈哈
发表于 2008-12-16 12:25:03 | 显示全部楼层
代码不完全。。。
发表于 2008-12-16 18:58:11 | 显示全部楼层
多谢楼主,收下了。
发表于 2008-12-23 21:12:13 | 显示全部楼层
少了guiwnd()函数?
发表于 2009-1-1 19:41:02 | 显示全部楼层
很好
发表于 2009-1-14 12:06:35 | 显示全部楼层
学习研究下
发表于 2009-3-2 00:09:30 | 显示全部楼层
guiwnd ??这是什么
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|小黑屋|手机版|AUTOIT CN ( 鲁ICP备15028933号-3 )谷歌 百度

GMT+8, 2018-12-17 00:25 , Processed in 0.097660 second(s), 17 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表