标题: [问题求助] [已解决]求修改PowerShell条件过滤 [打印本页]
作者: smss 时间: 2019-6-13 12:50 标题: [已解决]求修改PowerShell条件过滤
本帖最后由 smss 于 2019-6-16 22:29 编辑
- PowerShell "$str=[IO.File]::ReadAllText('manifest.xml', [Text.Encoding]::Default) -replace '(?m)^\s+|\s*(?:\n|$)' -replace '<!--(?:(?!-->).)*-->' -replace '.webp' -replace '.png' -replace '.jpg';[IO.File]::WriteAllText('1.xml', $str, [Text.Encoding]::UTF8)"
复制代码
在删除字符前加个过滤
如果src与srcid同时出现 则不修改
如下例子
<Image x="#icon_x[#__i]" y="#icon_y[#__i]" src="Ai/icons/icon.webp" srcid="#__i" touchable="true" scale="#icon_scale_ani[#__i]"/>
当节点为<Time 则不修改
如下例子
<Time name="tms01" x="#tms00.bmp_width" y="0" src="Ai/timing/number/number.webp" space="2" formatExp="#time_minute1+#time_minute2+':'+#time_second1+#time_second2" />
当节点为<ImageNumber 则不修改
如下例子
<ImageNumber name="g3in2" src="g3/in2.png" alignV="center" number="#g1v8" x="#g1v141" y="#g1v142"/>
作者: WHY 时间: 2019-6-14 12:59
顶楼脚本删除的是回车换行符、行前行后的空格字符、以及 .webp .png .jpg 字符
那么,“在删除字符前加个过滤”指的是删除哪个字符前增加过滤?
作者: WHY 时间: 2019-6-14 13:07
假设先删除回车换行符、行前行后的空白字符,然后增加过滤条件,再删除 .webp .png .jpg- @echo off
- PowerShell "$str=[IO.File]::ReadAllText('a.xml',[Text.Encoding]::Default) -replace '(?m)^\s+|\s*(?:\n|$)' -replace '<!--(?:(?!-->).)*-->'; $str=[regex]::Replace($str, '<(?!Time\s|ImageNumber\s)[^<>]*>', {param($m);$s=$m.Value;if(($s -split '\ssrc=|\ssrcid=').Count -gt 2){$s}else{$s -replace '\.(png|jpg|webp)'}}); [IO.File]::WriteAllText('b.xml', $str, [Text.Encoding]::UTF8)"
- pause
复制代码
作者: smss 时间: 2019-6-14 14:38
本帖最后由 smss 于 2019-6-14 16:19 编辑
回复 3# WHY
唉 我太菜了 技术大牛信手拈来
另外2个帖子 空的时候能看看吗?还有如果删除.png' 应该怎样写呢 多了一个单引号
还有把<Image x="236" y="270" alignV="center" srcExp="'best_'+@language+'.webp"/>
只保留节点后空格 删除其它空格变成<Image x="236"y="270"alignV="center"srcExp="'best_'+@language+'.webp"/>可以吗
http://www.bathome.net/thread-53058-1-1.html
http://www.bathome.net/thread-52856-1-1.html
作者: WHY 时间: 2019-6-14 19:36
本帖最后由 WHY 于 2019-6-14 19:40 编辑
回复 4# smss
单引号对 包含单引号时,用两个单引号,相当于单引号转义。
-replace '\.(png''?|jpg|webp)' 删除 .png' 或者 .png 或 .jpg 或 .webp
[IO.File]::ReadAllText('a.xml', [Text.Encoding]::default) -replace '(?<!<\S+)\s+' 删除所有空白字符,包括回车换行符,但保留每个节点后的空格。
作者: smss 时间: 2019-6-15 09:20
本帖最后由 smss 于 2019-6-15 10:39 编辑
回复 5# WHY
目前这个不够完美能帮忙修改下吗- PowerShell "$str=[IO.File]::ReadAllText('manifest1.xml',[Text.Encoding]::Default) -replace '(?m)^\s+|\s*(?:\n|$)' -replace '<!--(?:(?!-->).)*-->' -replace '(?<!<\S+)\s+'; $str=[regex]::Replace($str, '<(?!Time\s|ImageNumber\s)[^<>]*>', {param($m);$s=$m.Value;if(($s -split '\ssrc=|\ssrcid=').Count -gt 2){$s}else{$s -replace '\.(png|jpg|webp)'}}); [IO.File]::WriteAllText('1.xml', $str, [Text.Encoding]::UTF8)"
- cd %1\lockscreen\advance\
- setlocal enabledelayedexpansion
- set k=*.jpg *.webp *.png
- for /f "delims=" %%i in ('dir /b /a-d /s .\%k%') do (set "file=%%~nxi"
- if "!file:~-6!" neq ".9.png" (if "!file:~0,5!" neq "time_" (if "!file:~0,5!" neq "Time_" (ren "%%i" "%%~ni")
- )))
复制代码
把PowerShell条件过滤掉的图片后缀 不修改
如下例子
<ImageNumber src="g3/in2.png" number="#g1v8"/> in2_ 设为下条命令的过滤条件
<Image src="Ai/icons/icon.webp" srcid="#__i"/> icon_设为下条命令的过滤条件
<Time src="Ai/timing/number/number.webp" formatExp="#time_minute1+#time_minute2+':'+#time_second1+#time_second2" /> number_设为下条命令的过滤条件
即 命令1中过滤掉的图片 命令2同步过滤掉
作者: WHY 时间: 2019-6-16 11:51
回复 6# smss
1.这些问题与本主题无关,你不会开新帖?
2.我没有时间、也没有义务回答你所有问题;
3.我看不懂你在说什么,不明白你想干什么。
作者: smss 时间: 2019-6-16 16:53
本帖最后由 smss 于 2019-6-16 16:54 编辑
回复 7# WHY
抱歉了 没说清
想通过PowerShell "$str=[IO.File]::ReadAllText('manifest1.xml',[Text.Encoding]:efault) -replace '(?m)^\s+|\s*(?:\n|$)' -replace '<!--(??!-->).)*-->' -replace '(?<!<\S+)\s+'; $str=[regex]::Replace($str, '<(?!Time\s|ImageNumber\s)[^<>]*>', {param($m);$s=$m.Value;if(($s -split '\ssrc=|\ssrcid=').Count -gt 2){$s}else{$s -replace '\.(png|jpg|webp)'}}); [IO.File]::WriteAllText('1.xml', $str, [Text.Encoding]::UTF8)"
删除manifest1.xml中的png|jpg|webp 等 同时删除cd %1\lockscreen\advance\下的图片后缀但这些图片并不能全删除后缀 因为前面用了过滤 因此 需要准确过滤那些不需要删除后缀的图片
如<Time src="Ai/timing/number/number.webp" formatExp="#time_minute1+#time_minute2+':'+#time_second1+#time_second2" /> number_将设为删除图片后缀前的过滤条件
图片的命名不固定 所以只能这样
作者: WHY 时间: 2019-6-16 19:22
本帖最后由 WHY 于 2019-6-17 15:14 编辑
- $file1 = '1.xml'; #修改前的 xml 文件
- $file2 = '2.xml'; #修改后的 xml 文件
- $path = 'E:\Test'; #存放图片的文件夹
-
- $str = [IO.File]::ReadAllText($file1, [Text.Encoding]::Default);
- $str = $str -replace '(?<!<[^<>\s]+)\s+' -replace '<!--(?:(?!-->).)*-->';
-
- $arr = $str -split '(?<=<[^<>]*>)'; #以元素节点为单元分割数组
- [Collections.ArrayList]$List = @();
-
- for ( $i=0; $i -lt $arr.Count; $i++ ){
- $m = $arr[$i] -cmatch '<Time\s|<ImageNumber\s|\bsrc=.*\bsrcid=|\bsrcid=.*\bsrc='; #增加过滤条件
- if ($m) {
- forEach ( $a In [regex]::Matches($arr[$i], '(?<=["/])[^"/]+(?=\.(?i:png|jpg|webp))') ){
- $key = $a.Value.ToLower() + '_*';
- if ( !$List.Contains($key) ){
- [void]$List.Add($key);
- }
- }
- } else {
- $arr[$i] = $arr[$i] -replace '\.(?:png|jpg|webp)';
- }
- }
-
- [IO.File]::WriteAllText($file2, $arr -join '', [Text.Encoding]::UTF8);
- dir $path -Include *.png, *.jpg, *.webp -Exclude $List -Recurse | ren -NewName{$_.BaseName}
-
- echo 'Done';
- [Console]::ReadKey();
复制代码
作者: smss 时间: 2019-6-16 21:13
本帖最后由 smss 于 2019-6-16 21:40 编辑
回复 9# WHY - $file1 = 'manifest.xml'; #修改前的 xml 文件
- $file2 = 'manifest1.xml'; #修改后的 xml 文件
- $path = '123\lockscreen\advance'; #存放图片的文件夹
-
- $str = [IO.File]::ReadAllText($file1, [Text.Encoding]::UTF8);
- $str = $str -replace '(?<!<\S+)\s+' -replace '<!--(?:(?!-->).)*-->';
-
- $arr = $str -split '(?<=<[^<>]*>)'; #以节点为单元分割数组
- [Collections.ArrayList]$List = @();
-
- for ( $i=0; $i -lt $arr.Count; $i++ ){
- $m = $arr[$i] -cmatch '\bsrcExp=.*\bsrcid=|\bsrcid=.*\bsrcExp=|\bsrc=.*\bsrcid=|\bsrcid=.*\bsrc=|<Time\s|<ImageNumber\s'; #增加过滤条件
- if ($m) {
- forEach ( $a In [regex]::Matches($arr[$i], '(?<=/)[^/]+(?=\.(?i:png|jpg|webp))') ){
- $key = $a.Value.ToLower() + '_*';
- if ( !$List.Contains($key) ){
- [void]$List.Add($key);
- }
- }
- } else {
- $arr[$i] = $arr[$i] -replace '\.(?:png|jpg|webp)';
- }
- }
-
- [IO.File]::WriteAllText($file2, $arr -join '', [Text.Encoding]::UTF8);
- dir $path -Include *.png, *.jpg, *.webp -Exclude $List -Recurse | ren -NewName {$_.BaseName}
-
- echo 'Done';
- [Console]::ReadKey();
复制代码
添加了一个过滤条件\bsrcExp=.*\bsrcid=|\bsrcid=.*\bsrcExp=| 完全是照大师的葫芦画瓢 不知道有多余不
目前 就图片删除后缀那没过滤掉 结果存放图片的文件夹下图片全删除了后缀 没过滤到
图片特点如下
过滤图片名的特点就是src或srcExp的值去除路径(这路径不同于电脑这是反斜杠/)路径/到后缀之前的词加_
如srcExp="'weather/weather.png'" 路径weather/下的以 weather_开头的图片不能删除后缀 (如果删除将无法显示)
如
<Time x="#screen_width/2" y="490+#bgmove" align="center" alignV="center" space="0" src="time.png" format="HH:mm" xfermode="dst_out" alpha="180"/>
根目录下的以 time_开头的图片不能删除后缀 (如果删除将无法显示)系统设定使然
如weather_ 、time_、Number_ 那些支持高级表达式的支持删除后缀 所以不用担心
作者: WHY 时间: 2019-6-16 21:57
回复 10# smss
src="time.png" 这个 time 前面没有斜杠字符
第 14 行:- forEach ( $a In [regex]::Matches($arr[$i], '(?<=["/])[^"/]+(?=\.(?i:png|jpg|webp))') ){
复制代码
作者: smss 时间: 2019-6-16 22:19
本帖最后由 smss 于 2019-6-16 22:34 编辑
回复 11# WHY
还有一个小问题是怎样把这个拖拽获得路径 %1\lockscreen\advance\传递给 powershell.exe -command "&{%~dp00.ps1}"中的path
如果可以传递便不用把%1\lockscreen\advance\ 复制到一个固定路径让0.ps1 处理
还有我把manifest.xml中的内容全都 挤成了一行
发现比对时不方便 怎样 把>替换为 >加换行符(WPS中是>^l)
即
<?xml version="1.0" encoding="utf-8"?><?xml version="1.0" encoding="utf-8"?><?xml version="1.0" encoding="utf-8"?>
变成
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
作者: WHY 时间: 2019-6-17 11:06
回复 12# smss
Test.ps1 的前三行这样改:- param([string]$path);
- $file1 = '1.xml'; #修改前的 xml 文件
- $file2 = '2.xml'; #修改后的 xml 文件
复制代码
Test.bat 这样写:- @echo off
- cd /d "%~dp0"
- PowerShell -exec ByPass "&'%~dp0Test.ps1'" "%~f1"
- pause
复制代码
但强烈不建议拖拽,你如果遇到路径中包含特殊字符,肯定会头疼得厉害
> 字符后增加换行:
[IO.File]::ReadAllText... -Replace '>', ">`r`n"
作者: smss 时间: 2019-6-17 13:42
本帖最后由 smss 于 2019-6-17 13:51 编辑
回复 13# WHY 图1为转换前
图2为转换后
没有像之前一样生成一行
以下为测试文本- <?xml version="1.0" encoding="utf-8"?>
- <Clock frameRate="30" scaleByDensity="false" screenWidth="720" type="awesome" useVariableUpdater="DateTime.Minute" version="1">
- <ExternalCommands/>
- <VariableBinders>
- <ContentProviderBinder name="weather" uri="content://weather/weather" columns="city_id">
- <Variable name="city_id" type="string" column="city_id"/>
- </ContentProviderBinder>
- <ContentProviderBinder dependency="weather" uriFormat="content://weather/daily_weather/%s" uriParas="@city_id" columns="city_name,publish_time,temperature,temperature_range,description,wind,humidity,weather_type" countName="hasweather">
- <Variable name="weather_id" type="int" column="weather_type"/>
- <Variable name="weather_location" type="string" column="city_name"/>
- <Variable name="weather_temperature" type="int" column="temperature"/>
- <Variable name="weather_temperature_str" type="string" column="temperature"/>
- <Variable name="weather_temperature_range" type="string" column="temperature_range"/>
- <Variable name="weather_description" type="string" column="description"/>
- </ContentProviderBinder>
- <ContentProviderBinder name="weather_aqi" dependency="weather" uriFormat="content://weatherinfo/aqi/%s" uriParas="@city_id" columns="aqi" countName="hasweatherinfo">
- <Variable name="aqi" type="int" column="aqi"/>
- </ContentProviderBinder>
- </VariableBinders>
- <Var name="Kqzl" expression="ifelse(ge(#aqi,0)*lt(#aqi,0),@aqi_pure,ge(#aqi,1)*lt(#aqi,50),@aqi_good,ge(#aqi,50)*lt(#aqi,100),@aqi_moderate,ge(#aqi,100)*lt(#aqi,150),@aqi_pollution,ge(#aqi,150)*lt(#aqi,200),@aqi_unhealthy,ge(#aqi,200)*lt(#aqi,300),@aqi_dangerous,ge(#aqi,300)*le(#aqi,500),@aqi_hazardous,@aqi_break)" type="string"/>
- <!--提醒-->
- <VarArray type="string">
- <Vars>
- <Var name="Remind" index="#weather_id"/>
- </Vars>
- <Items>
- <Item value="今天阳光明媚,祝你也有个好心情!"/>
- <Item value="今天多云,愿你的心情依然撒满阳光!"/>
- <Item value="今天阴天,大家可以不用怕晒黑啦!"/>
- <Item value="今天有雾,开车的朋友请注意安全!"/>
- <Item value="今天有特大暴雨,我们一起玩LOL吧!"/>
- <Item value="今天有大暴雨,宅在家里会不会很惬意呢?"/>
- <Item value="今天有暴雨,还在外边的同学,还是快点回家吧!"/>
- <Item value="今天有雷阵雨,爱那啥的同学建议不要在郊外活动!"/>
- <Item value="今天有阵雨,也许能看到雨后彩虹欧!"/>
- <Item value="大雨倾盆,你有淋雨一直走的勇气吗?"/>
- <Item value="细雨纷纷,外出的话建议带上伞噢!"/>
- <Item value="在这样细雨连绵的天气里你会想起谁呢?"/>
- <Item value="雨夹雪,出门记得带伞。"/>
- <Item value="今天将有暴雪,还是宅在家里,45度角仰望窗外吧!"/>
- <Item value="阵雪的天气将点缀着美好的一天"/>
- <Item value="今天大雪可以期待堆个雪人玩啦"/>
- <Item value="今天有中雪哦!期待一下迷人的雪景吧。"/>
- <Item value="今天有小雪哦!放心出门,享受一下吧。"/>
- <Item value="今天有强沙天气袭来!宅着吧同学。"/>
- <Item value="今天有沙尘暴,出门务必带口罩"/>
- <Item value="今天室外将有沙尘,请注意防护!"/>
- <Item value="今天室外的扬沙,是否打消了你外出的念头呢?"/>
- <Item value="今天有冰雹,请把你的爱车放于地下停车库"/>
- <Item value="想想北京阴霾天气,还有什么不开心的?"/>
- </Items>
- </VarArray>
- <Var name="night" expression="eq(#weather_id,0)+eq(#weather_id,1)+eq(#weather_id,2)+eq(#weather_id,3)+eq(#weather_id,7)+eq(#weather_id,8)+eq(#weather_id,9)+eq(#weather_id,11)"/>
- <Var name="Day_night" expression="ifelse(#night,'_'+not(ge(#hour24,6)*le(#hour24,17)),'')" type="string" />
- <Group w="#view_width" h="#view_height" layered="true">
- <Image x="#view_width/2" y="#view_height/2" w="610" h="610/640*341" align="center" alignV="center" src="bg.webp"/>
- <Image x="#view_width/2" y="#view_height/2" w="610" h="610/640*341" align="center" alignV="center" srcExp="'weather_'+#weather_id+@Day_night+'.webp'"/>
- <Image x="#view_width/2" y="#view_height/2" w="610" h="610/640*341" align="center" alignV="center" src="Mask.webp" xfermode="dst_in"/>
- </Group>
- <Time x="#view_width/2-276" y="#view_height/2-82" alignV="center" src="Time.webp"/>
- <Text x="#view_width/2-276" y="#view_height/2+90" alignV="center" color="#DEFFFFFF" size="28" text="@Remind" w="600-#KQZL.text_width" marqueeSpeed="30"/>
- <DateTime x="#view_width/2-276" y="#view_height/2+117" format="M月d日 N月e E" color="#DEFFFFFF" size="28"/>
- <Text name="KQZL" x="#view_width/2+276" y="#view_height/2+90" size="28" color="#DEFFFFFF" align="right" alignV="center" textExp="@Kqzl"/>
- <Text x="#view_width/2+276" y="#view_height/2-88" size="70" color="#9E000000" align="right" alignV="center" format="%s" paras="@weather_location"/>
- <Text x="#view_width/2+276" y="#view_height/2-92" size="70" color="#DEFFFFFF" align="right" alignV="center" format="%s" paras="@weather_location"/>
- <Text x="#view_width/2+266" y="#view_height/2+12" size="54" color="#9E000000" align="right" alignV="center" format="%s" paras="@weather_description"/>
- <Text x="#view_width/2+266" y="#view_height/2+10" size="54" color="#DEFFFFFF" align="right" alignV="center" format="%s" paras="@weather_description"/>
- <Text x="#view_width/2+276" y="#view_height/2+117" size="28" color="#DEFFFFFF" align="right" format="%s" paras="@weather_temperature_range"/>
- <!--温度-->
- <Image name="Fu" x="#view_width/2-266" y="#view_height/2+25" alignV="center" src="fu.webp" visibility="lt(#weather_temperature,0)"/>
- <ImageNumber name="Wd" x="#view_width/2-266+#Fu.bmp_width" y="#view_height/2" number="abs(#weather_temperature)" src="du.webp"/>
- <Image x="#view_width/2-266+#Fu.bmp_width+#Wd.bmp_width" y="#view_height/2" src="du.webp"/>
- <Button name="clock_button"/>
- <!--天气播报-->
- <Var name="air_quality" expression="ifelse(ge(#aqi,0)*lt(#aqi,50),0,ge(#aqi,50)*lt(#aqi,100),1,ge(#aqi,100)*lt(#aqi,150),2,ge(#aqi,150)*lt(#aqi,200),3,ge(#aqi,200)*lt(#aqi,300),4,ge(#aqi,300)*le(#aqi,500),5,6)" type="int" const="false"/>
- <Var name="temperature_level" expression="ifelse(lt(#weather_temperature,0),0,ge(#weather_temperature,0)*lt(#weather_temperature,10),1,ge(#weather_temperature,10)*lt(#weather_temperature,20),2,ge(#weather_temperature,20)*lt(#weather_temperature,30),3,4)" type="int"/>
- <Button x="320" y="170" w="320" h="170">
- <Triggers>
- <Trigger action="up">
- <VariableCommand name="click_count" expression="#click_count%3+1" type="int" const="false"/>
- <SoundCommand sound="weather_0.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,0)"/>
- <SoundCommand sound="weather_1.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,1)"/>
- <SoundCommand sound="weather_2.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,2)"/>
- <SoundCommand sound="weather_3.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,3)"/>
- <SoundCommand sound="weather_4.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,4)"/>
- <SoundCommand sound="weather_5.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,5)"/>
- <SoundCommand sound="weather_6.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,6)"/>
- <SoundCommand sound="weather_7.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,7)"/>
- <SoundCommand sound="weather_8.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,8)"/>
- <SoundCommand sound="weather_9.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,9)"/>
- <SoundCommand sound="weather_10.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,10)"/>
- <SoundCommand sound="weather_11.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,11)"/>
- <SoundCommand sound="weather_12.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,12)"/>
- <SoundCommand sound="weather_13.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,13)"/>
- <SoundCommand sound="weather_14.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,14)"/>
- <SoundCommand sound="weather_15.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,15)"/>
- <SoundCommand sound="weather_16.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,16)"/>
- <SoundCommand sound="weather_17.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,17)"/>
- <SoundCommand sound="weather_18.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,18)"/>
- <SoundCommand sound="weather_19.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,19)"/>
- <SoundCommand sound="weather_20.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,20)"/>
- <SoundCommand sound="weather_21.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,21)"/>
- <SoundCommand sound="weather_22.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,22)"/>
- <SoundCommand sound="weather_23.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,23)"/>
- <SoundCommand sound="weather_24.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,24)"/>
- <SoundCommand sound="temperature_0.mp3" volume="1" keepCur="true" condition="eq(#click_count,2)*eq(#temperature_level,0)"/>
- <SoundCommand sound="temperature_1.mp3" volume="1" keepCur="true" condition="eq(#click_count,2)*eq(#temperature_level,1)"/>
- <SoundCommand sound="temperature_2.mp3" volume="1" keepCur="true" condition="eq(#click_count,2)*eq(#temperature_level,2)"/>
- <SoundCommand sound="temperature_3.mp3" volume="1" keepCur="true" condition="eq(#click_count,2)*eq(#temperature_level,3)"/>
- <SoundCommand sound="temperature_4.mp3" volume="1" keepCur="true" condition="eq(#click_count,2)*eq(#temperature_level,4)"/>
- <SoundCommand sound="air_0.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,0)"/>
- <SoundCommand sound="air_1.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,1)"/>
- <SoundCommand sound="air_2.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,2)"/>
- <SoundCommand sound="air_3.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,3)"/>
- <SoundCommand sound="air_4.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,4)"/>
- <SoundCommand sound="air_5.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,5)"/>
- <SoundCommand sound="air_6.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,6)"/>
- </Trigger>
- </Triggers>
- </Button>
- <!--时钟-->
- <Button x="#view_width/2-320" y="#view_height/2-170" w="320" h="170">
- <Triggers>
- <Trigger action="up">
- <IntentCommand action="android.intent.action.MAIN" class="com.android.deskclock.DeskClockTabActivity" package="com.android.deskclock"/>
- </Trigger>
- </Triggers>
- </Button>
- <!-- 日历 -->
- <Button x="#view_width/2-320" y="#view_height/2" w="320" h="170">
- <Triggers>
- <Trigger action="up">
- <IntentCommand action="android.intent.action.MAIN" class="com.android.calendar.AllInOneActivity" package="com.android.calendar"/>
- </Trigger>
- </Triggers>
- </Button>
- <!--天气-->
- <Button x="#view_width/2" y="#view_height/2-170" w="320" h="170">
- <Triggers>
- <Trigger action="up">
- <IntentCommand action="android.intent.action.MAIN" class="com.miui.weather2.ActivityWeatherCycle" package="com.miui.weather2"/>
- <IntentCommand action="android.intent.action.MAIN" class="com.miui.weather2.ActivityWeatherMain" package="com.miui.weather2"/>
- </Trigger>
- </Triggers>
- </Button>
- </Clock>
复制代码
作者: WHY 时间: 2019-6-17 14:51
回复 14# smss
哦,不含属性的元素节点没有考虑到,
-replace '(?<!<\S+)\s' 改成 -replace '(?<!<[^<>\s]+)\s+'
#9已修改
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |