afan
发表于 2020-5-3 08:35:53
本帖最后由 afan 于 2020-5-3 09:15 编辑
floor6ggg 发表于 2020-5-3 07:28
A神这是晚上只睡4小时的节奏吗?au3果然是真爱啊!!!
厚颜试用一下,嘎嘎嘎嘎。。。。
刚睡醒 呵呵 一会就发
2位都已经发了,有什么问题可以在此回复。
如果附件被毒瘤疯杀,我再传论坛自行下载~
fybhwsx
发表于 2020-5-3 11:13:58
本帖最后由 fybhwsx 于 2020-5-3 11:17 编辑
我测试查找系统带唤醒计算机的任务计划,着色不知道对不对,我觉得要是在找到的结果“true”与正则那对儿小括号颜色一致(或者在随便弄个颜色与整段或整行区分一下)最好。我不懂啊,只是瞎说哈。我最期待的还是A版能整合到Au3.REHelper中!
本来我正则这样写的:(?s)Windows.*?<WakeToRun>(.*?)< 但发现中间没用的段落也都着色了,明显我正则写的不对。。
任务计划代码一部分:
<!-- \Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64 Critical -->
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2010-09-30T14:53:37.9516706</Date>
<SecurityDescriptor>D:(A;OICI;FA;;;BA)(A;OICI;FA;;;SY)(A;OICI;GR;;;AU)(A;;FRFX;;;LS)</SecurityDescriptor>
<URI>\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64 Critical</URI>
</RegistrationInfo>
<Principals>
<Principal id="Author">
<UserId>S-1-5-18</UserId>
</Principal>
</Principals>
<Settings>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<Enabled>false</Enabled>
<ExecutionTimeLimit>PT2H</ExecutionTimeLimit>
<Hidden>true</Hidden>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<WakeToRun>true</WakeToRun>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
<MaintenanceSettings>
<Period>P1D</Period>
<Deadline>P2D</Deadline>
</MaintenanceSettings>
</Settings>
<Triggers>
<IdleTrigger />
</Triggers>
<Actions Context="Author">
<ComHandler>
<ClassId>{613FBA38-A3DF-4AB8-9674-5604984A299A}</ClassId>
<Data><!]></Data>
</ComHandler>
</Actions>
</Task>
<!-- \Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 Critical -->
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2010-09-30T14:53:37.9516706</Date>
<SecurityDescriptor>D:(A;OICI;FA;;;BA)(A;OICI;FA;;;SY)(A;OICI;GR;;;AU)(A;;FRFX;;;LS)</SecurityDescriptor>
<URI>\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 Critical</URI>
</RegistrationInfo>
<Principals>
<Principal id="Author">
<UserId>S-1-5-18</UserId>
</Principal>
</Principals>
<Settings>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<Enabled>false</Enabled>
<ExecutionTimeLimit>PT2H</ExecutionTimeLimit>
<Hidden>true</Hidden>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<WakeToRun>true</WakeToRun>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
<MaintenanceSettings>
<Period>P1D</Period>
<Deadline>P2D</Deadline>
</MaintenanceSettings>
</Settings>
<Triggers>
<IdleTrigger />
</Triggers>
<Actions Context="Author">
<ComHandler>
<ClassId>{DE434264-8FE9-4C0B-A83B-89EBEEBFF78E}</ClassId>
<Data><!]></Data>
</ComHandler>
</Actions>
</Task>
<!-- \Microsoft\Windows\Active Directory Rights Management Services Client\AD RMS Rights Policy Template Management (Automated) -->
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2006-11-10T14:29:55.5851926</Date>
<SecurityDescriptor>D:(A;;FA;;;BA)(A;;FA;;;SY)(A;;FRFX;;;WD)</SecurityDescriptor>
<Author>$(@%systemRoot%\System32\msdrm.dll,-6001)</Author>
<Description>$(@%systemRoot%\System32\msdrm.dll,-6002)</Description>
<URI>\Microsoft\Windows\Active Directory Rights Management Services Client\AD RMS Rights Policy Template Management (Automated)</URI>
</RegistrationInfo>
<Principals>
<Principal id="AllUsers">
<GroupId>S-1-1-0</GroupId>
</Principal>
</Principals>
<Settings>
<AllowHardTerminate>false</AllowHardTerminate>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<Enabled>false</Enabled>
<ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
<MultipleInstancesPolicy>Parallel</MultipleInstancesPolicy>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>
<IdleSettings>
<Duration>PT10M</Duration>
<WaitTimeout>PT1H</WaitTimeout>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
</Settings>
<Triggers>
<CalendarTrigger id="7dba1862-fdda-4030-83de-895375c111d4">
<StartBoundary>2006-11-09T03:00:00</StartBoundary>
<RandomDelay>PT1H</RandomDelay>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
<LogonTrigger id="06b3f632-87ad-4ac0-9737-48ea5ddbaf11">
<Delay>PT1H</Delay>
</LogonTrigger>
</Triggers>
<Actions Context="AllUsers">
<ComHandler>
<ClassId>{CF2CF428-325B-48D3-8CA8-7633E36E5A32}</ClassId>
</ComHandler>
</Actions>
</Task>
<!-- \Microsoft\Windows\Active Directory Rights Management Services Client\AD RMS Rights Policy Template Management (Manual) -->
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2006-11-10T14:29:55.5851926</Date>
<SecurityDescriptor>D:(A;;FA;;;BA)(A;;FA;;;SY)(A;;FRFX;;;WD)</SecurityDescriptor>
<Author>$(@%systemRoot%\System32\msdrm.dll,-6001)</Author>
<Description>$(@%systemRoot%\System32\msdrm.dll,-6003)</Description>
<URI>\Microsoft\Windows\Active Directory Rights Management Services Client\AD RMS Rights Policy Template Management (Manual)</URI>
</RegistrationInfo>
<Principals>
<Principal id="AllUsers">
<GroupId>S-1-1-0</GroupId>
</Principal>
</Principals>
<Settings>
<AllowHardTerminate>false</AllowHardTerminate>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
<MultipleInstancesPolicy>Parallel</MultipleInstancesPolicy>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>
<IdleSettings>
<Duration>PT10M</Duration>
<WaitTimeout>PT1H</WaitTimeout>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
</Settings>
<Triggers>
<LogonTrigger id="06b3f632-87ad-4ac0-9737-48ea5ddbaf11">
<Enabled>false</Enabled>
<Delay>PT1H</Delay>
</LogonTrigger>
</Triggers>
<Actions Context="AllUsers">
<ComHandler>
<ClassId>{BF5CB148-7C77-4D8A-A53E-D81C70CF743C}</ClassId>
</ComHandler>
</Actions>
</Task>
<!-- \Microsoft\Windows\AppID\EDP Policy Manager -->
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2015-02-09T10:54:13.9629482</Date>
<SecurityDescriptor>D:P(A;;FA;;;BA)(A;;FA;;;SY)(A;;FA;;;S-1-5-87-2978287140-3787137133-1749738600-1988163579-2060695581)</SecurityDescriptor>
<Source>$(@%SystemRoot%\system32\ApplockerCsp.dll,-101)</Source>
<Author>$(@%SystemRoot%\system32\ApplockerCsp.dll,-100)</Author>
<Description>$(@%SystemRoot%\system32\ApplockerCsp.dll,-102)</Description>
<URI>\Microsoft\Windows\AppID\EDP Policy Manager</URI>
</RegistrationInfo>
<Principals>
<Principal id="LocalService">
<UserId>S-1-5-19</UserId>
</Principal>
</Principals>
<Settings>
<AllowHardTerminate>false</AllowHardTerminate>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
</Settings>
<Triggers>
<WnfStateChangeTrigger>
<StateName>7588BCA328009213</StateName>
</WnfStateChangeTrigger>
<WnfStateChangeTrigger>
<StateName>75E0BCA328009213</StateName>
</WnfStateChangeTrigger>
</Triggers>
<Actions Context="LocalService">
<ComHandler>
<ClassId>{DECA92E0-AF85-439E-9204-86679978DA08}</ClassId>
<Data><!]></Data>
</ComHandler>
</Actions>
</Task>
正则:<WakeToRun>(.*)<
afan
发表于 2020-5-3 11:32:26
fybhwsx 发表于 2020-5-3 11:13
我测试查找系统带唤醒计算机的任务计划,着色不知道对不对,我觉得要是在找到的结果“true”与正则那对儿小 ...
说明里已经说到了:
- 关于执行结果:
执行结果如无错误,则在源字符串中对表达式的整行匹配结果着色,不分组与非
也就是说只要是你整个表达式捕获的字符都算在内,因此不会光只捕获“true”这个组,正则不会返回过程数据,你不知道它如何工作的,你只能看到结果,如果你只需要“true”这个组的内容,试问如果源字符串里面有很多“true”,你如何知道匹配了哪一个位置?当然,如果你人为的理解前面是 <WakeToRun> 后面是 < 的,那如果是表达式形式呢,比如 <W.+?> ,当然还有无限复杂的,所以你根本不可能定位到具体的组。所以,如果你需要仅定位到“true”,那么写法就应该注意让它成为整行表达式仅捕获的数据,如:
(?<=\<WakeToRun\>).*(?=<)
这种方式既可定位,却又不会捕获不吃字符的仅断言位置。
至于跟括号颜色一致那就更不现实了。
fybhwsx
发表于 2020-5-3 12:19:48
afan 发表于 2020-5-3 11:32
说明里已经说到了:
也就是说只要是你整个表达式捕获的字符都算在内,因此不会光只捕获“true”这个组 ...
嗯嗯,没细看说明。
如果我想提取包含下列字符内容的任务计划的名称正则最么写?
<WakeToRun>true</WakeToRun>
如第一段中有<WakeToRun>true</WakeToRun>
提取第一行中的Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64 Critical
这个问题跑题了哈,A版可以忽略。。
zghwelcome
发表于 2020-5-3 12:39:49
坐等A版佳作:face (22):
afan
发表于 2020-5-3 12:54:08
本帖最后由 afan 于 2020-5-3 12:56 编辑
fybhwsx 发表于 2020-5-3 12:19
嗯嗯,没细看说明。
如果我想提取包含下列字符内容的任务计划的名称正则最么写?
(?mi)(?<=^\<!--\h\\).+(?=\h--\>(?:(?!\<!)[\s\S])+?<WakeToRun>true<)
的确跑偏了~
fybhwsx
发表于 2020-5-3 13:08:53
afan 发表于 2020-5-3 12:54
的确跑偏了~
谢谢A版,提个小建议,不知好弄不。对匹配结果直接F3快捷键查询。
afan
发表于 2020-5-3 13:15:07
fybhwsx 发表于 2020-5-3 13:08
谢谢A版,提个小建议,不知好弄不。对匹配结果直接F3快捷键查询。
这个和 Au3.REHelper 保持一致 Ctrl - Enter
fybhwsx
发表于 2020-5-3 13:28:02
afan 发表于 2020-5-3 13:15
这个和 Au3.REHelper 保持一致 Ctrl - Enter
我说的对匹配结果查询,不是开始执行。就是对每个着色位置跳转查询。
比如着色完毕,我按F3默认跳转至第一个着色位置(开头或结尾),再按跳转至第二个着色位置(开头结尾)。。
afan
发表于 2020-5-3 13:35:12
fybhwsx 发表于 2020-5-3 13:28
我说的对匹配结果查询,不是开始执行。就是对每个着色位置跳转查询。
比如着色完毕,我按F3默认跳转至第 ...
这个可以有~
floor6ggg
发表于 2020-5-3 16:11:27
afan 发表于 2020-5-3 13:35
这个可以有~
很强大,
谢谢大神劳动节的礼物666节日不工作,后续再反馈,:face (24):
提个很小的小细节:界面上:文本多的时候,RICHEDIT50W的下拉框位置稍窄了一点(…………不确定是不是只有我的电脑这样啊…………),稍宽一些(…………richedit的大小与gui的大小需要稍调整???),拉动起来手感可能好一点点…………
afan
发表于 2020-5-3 16:29:02
floor6ggg 发表于 2020-5-3 16:11
很强大,
谢谢大神劳动节的礼物666节日不工作,后续再反馈,
Ok~ 应该是你使用的主题窗口边框比较宽的原因,下次先识别系统主题构件就可解决
afan
发表于 2020-5-4 12:16:38
(?mi)(^[ ]+|\-\V+|\w+\h*\+\V+?(?=\r)|\w+(?:[\h\d.]+)?|(?:(?:正则)?表..|.色))
自动生成论坛发帖表达式高亮测试
afan
发表于 2020-5-4 12:24:37
(?s)((?<=<)((?:\d)\D)\2*(?=>))
ok~
tubaba
发表于 2020-5-4 15:57:31
来来,发个测试看看效果,1442900481@qq.com