如何提取天气代码?
在下列代码中提取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 编辑 ] $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) 楼上的能不能加上width="70" height="65"这些特征,否则提取出来的gif文件名并不是想要的。 不是只提取出a1吗?~ #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<>1 Then exit(1)
;if $cmdline<>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&"."&$iret&"."&$iret)
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=2 Then
IniWrite($InfoFile,"天气预报","天气图1",IniRead($InfoFile,"基本设置",$Type,""))
IniWrite($InfoFile,"天气预报","天气图2",IniRead($InfoFile,"基本设置",$Type,""))
Else
IniWrite($InfoFile,"天气预报","天气图1",IniRead($InfoFile,"基本设置",$Type,""))
IniWrite($InfoFile,"天气预报","天气图2",IniRead($InfoFile,"基本设置",$Type,""))
EndIf
FileChangeDir(@ScriptDir)
$sn=abs(BitXOR(DriveGetSerial("c:\"),29627317))
ShellExecute("Show.exe",$sn&" "&$l_wallpaper)
Exit
EndFunc 楼上的能不能加上width="70" height="65"这些特征,否则提取出来的gif文件名并不是想要的。
zitoy 发表于 2008-11-11 19:15 http://www.autoitx.com/images/common/back.gif
images/(.*).gif" width="\d+" height="\d+ 不错。。学习了
页:
[1]