找回密码
 加入
搜索
查看: 1856|回复: 6

如何提取天气代码?

[复制链接]
发表于 2008-11-10 17:47:48 | 显示全部楼层 |阅读模式
在下列代码中提取a1      
    <td width="70" valign="top"><img src="../images/a1.gif" width="70" height="65"></td>
自己参考论坛编写为:
$array0 = StringRegExp($sHTML, "<(?i)img src=../images/(.*?).gif width=70 height=65></(?i)td>", 1)
For $i = 0 To UBound($array0) - 1
        $tqtemp0 = $array0[$i]
Next
$tqtemp0数值为空,该如何编写?

[ 本帖最后由 zitoy 于 2008-11-11 20:21 编辑 ]
发表于 2008-11-10 17:51:16 | 显示全部楼层
$var = '<td width="70" valign="top"><img src="../images/a1.gif" width="70" height="65"></td>'
$str = StringRegExp ($var, "(?<=images/).*(?=\.gif)",1)
Msgbox (0, "", $str[0])
 楼主| 发表于 2008-11-11 19:15:04 | 显示全部楼层
楼上的能不能加上width="70" height="65"这些特征,否则提取出来的gif文件名并不是想要的。
发表于 2008-11-11 20:44:23 | 显示全部楼层
不是只提取出a1吗?~
发表于 2008-11-11 23:58:16 | 显示全部楼层
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=pack\ico.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Description=Myself
#AutoIt3Wrapper_Res_Fileversion=1.1.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Myself
#AutoIt3Wrapper_Res_Language=2052
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;判断调用程序的合法性
;if $cmdline[0]<>1 Then exit(1)
;if $cmdline[1]<>abs(BitXOR(DriveGetSerial("c:\"),29627317)) then exit(2)
;只允许一个程序运行
;#include "..\..\..\..\include\myrunone.au3"
;dim Const $ver="Myself公告组件1.2.0.0"
;if MyRunOne($ver)=-1 then Exit

MyShowWallpaper()
Func MyShowWallpaper()
local $FileHandle,$Mytype,$MyPay1,$MyPay2,$MyPay3,$MyPay4
local $r_wallpaper="\updateserver\tools$\桌面系统\"&@DesktopWidth&"x"&@DesktopHeight&".jpg"
local Const $r_Note ="\updateserver\tools$\桌面系统\网吧公告.txt"
Local Const $r_Price ="\updateserver\tools$\桌面系统\价格表.ini"
Local Const $r_Info ="\updateserver\tools$\桌面系统\天气预报.ini"
local Const $l_wallpaper=@SystemDir&"\Wallpaper.jpg"
local Const $l_Note =@ScriptDir&"\网吧公告.txt"
Local Const $l_Price =@ScriptDir&"\价格表.ini"
Local Const $InfoFile =@ScriptDir&"\info.ini"

;同步壁纸
If not FileExists($r_wallpaper) Then $r_wallpaper="\updateserver\tools$\公告系统\back.jpg"
If FileExists($r_wallpaper) And (FileGetTime($r_wallpaper,0,1)<>FileGetTime($l_wallpaper,0,1)) Then FileCopy($r_wallpaper,$l_wallpaper,1+8)
;同步配置文件
FileCopy($r_Note,$l_Note,1+8)
FileCopy($r_Price,$l_Price,1+8)
FileCopy($r_Info,$InfoFile,1+8)

;写入公告信息
If IniRead($InfoFile,"基本设置","网吧名称","") ="" Then IniWrite($InfoFile,"基本设置","网吧名称","驰成网维")
$iret=FileGetTime ($l_Note,0,0)
If Not @error Then
IniWrite($InfoFile,"基本设置","公告日期",$iret[0]&"."&$iret[1]&"."&$iret[2])
EndIf

;写入本机信息
$Type=IniRead($l_Price,"config",StringUpper(@ComputerName),"   ")
IniWrite($InfoFile,"基本信息","编号",StringUpper(@ComputerName))
IniWrite($InfoFile,"基本信息","区域",$Type)
IniWrite($InfoFile,"基本信息","普通价格",IniRead($l_Price,$type,"普通价格","见店堂公告"))
IniWrite($InfoFile,"基本信息","会员价格",IniRead($l_Price,$type,"会员价格","见店堂公告"))
IniWrite($InfoFile,"基本信息","包时价格",IniRead($l_Price,$type,"包时价格","见店堂公告"))
IniWrite($InfoFile,"基本信息","包时时段",IniRead($l_Price,$type,"包时时段","见店堂公告"))
;写入日期
IniWrite($InfoFile,"天气预报","日期",@YEAR&"-"&@MON&"-"&@MDAY)
Select
Case @WDAY=1
IniWrite($InfoFile,"天气预报","星期","星期一")
Case @WDAY=2
IniWrite($InfoFile,"天气预报","星期","星期二")
Case @WDAY=3
IniWrite($InfoFile,"天气预报","星期","星期三")
Case @WDAY=4
IniWrite($InfoFile,"天气预报","星期","星期四")
Case @WDAY=5
IniWrite($InfoFile,"天气预报","星期","星期五")
Case @WDAY=6
IniWrite($InfoFile,"天气预报","星期","星期六")
Case @WDAY=7
IniWrite($InfoFile,"天气预报","星期","星期日")
EndSelect
$Type=StringSplit(IniRead($InfoFile,"天气预报","天气",""),"转")
If $Type[0]=2 Then
IniWrite($InfoFile,"天气预报","天气图1",IniRead($InfoFile,"基本设置",$Type[1],""))
IniWrite($InfoFile,"天气预报","天气图2",IniRead($InfoFile,"基本设置",$Type[2],""))
Else
IniWrite($InfoFile,"天气预报","天气图1",IniRead($InfoFile,"基本设置",$Type[1],""))
IniWrite($InfoFile,"天气预报","天气图2",IniRead($InfoFile,"基本设置",$Type[1],""))
EndIf




FileChangeDir(@ScriptDir)
$sn=abs(BitXOR(DriveGetSerial("c:\"),29627317))
ShellExecute("Show.exe",$sn&" "&$l_wallpaper)
Exit
EndFunc
发表于 2009-7-24 22:23:09 | 显示全部楼层
楼上的能不能加上width="70" height="65"这些特征,否则提取出来的gif文件名并不是想要的。
zitoy 发表于 2008-11-11 19:15


images/(.*).gif" width="\d+" height="\d+
发表于 2011-7-28 11:08:56 | 显示全部楼层
不错。。学习了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-1 21:40 , Processed in 0.089100 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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