自动剪切合适大小的图片思路

入门 新手

2021-07-23

因工作需要,我经常会把大大小小的票据扫描进电脑存档,不过每次扫描进电脑的图片,都是按照A4纸大小扫描进电脑,这样就会扫描进很多空白的地方,出于节省空间(也可能处于洁癖)考虑,我就想把扫描到的文件按照票据大小剪切下来。

这样一剪一切,看似简单无脑操作,但是量多的时候,真是有够烦的。于是我便开始思考如何用AHK来实现我的自动批量剪切票据啦。

我非常喜欢AHK的一个地方就是,入门门槛非常低,只要会几个英语单词,还有按照列表一件一件做事情的经验,就可以开始编写自己想要的程序啦!

认识几个指令,就能按照自己的意愿切割随意大小的图片。

我用到的指令主要有

send

sleep

mousemove

click

mousegetpos

pixelgetcolor

还有其他一些很基础的东西,几乎没有函数哈哈!!

很多人问我:网络上有很多现成的,为什么不用?非要自己做。我觉得网络上好多软件,体积都异常庞大,动不动就多少G多少G的,而我这个脚本,做好才4.43KB!!!而且自己对自己的环境设计,针对性非常高。

一开始我就想只切票据用,不用像抠图软件那样扣得那么细致,只要一个矩形就好,于是我就在帮助文档里面乱翻,看有没有什么可以自动帮我切下来的东西。看到了一个关键指令【MouseClickDrag】,帮助文档里面的介绍是这样的:点击并按住指定的鼠标按钮, 接着移动鼠标到目标坐标, 然后松开按钮.哇!!这不就是我想要的功能嘛!

于是,我就想到,我只要得到左上角和右下角的坐标不就好了嘛~~那怎么得到呢?就用pixelgetcolor像素查找指令加if指令判断好咯!从左上角开始搜到右下角,如果突然从白色变成其他深颜色,那就是票据啦!!同理,再从右下角往左上角搜像素,这样就确定好坐标!直接mouseclickdrag剪切!

……

一开始大致思路是这样,但做到一半的时候,又遇到了许多问题

1.  票据有长有短,有宽有窄,两个坐标太不好捉摸了

2. 扫描件里面有好多细小的黑点,会被误认为内容

3.有些票据也是纯白色的,扫描出来后,几乎跟外面一圈混合在了一起

于是我就不断改变思路,主要还是围绕着怎么获得矩形的长宽问题。

目前我的自制软件已经更新到2.3版本,哈哈!!思路又变了,就是不从周围开始检测,而是先定位一个中心点,从中心点出发向上下左右开始检测,一检测到变白,就确定坐标!

 

 

感谢社区QQ群里的大神们,不断给我新的思路,还有实现一些非常微妙功能的指令,以及函数。

感谢【僵尸】、【db】、【空】、【河许人】、【雪】、【梦醒】等等大神们,给我各种辅助工具加持!

我还会再接着继续思考,改良!创作!

2021-12-31

想不到一晃眼五个月过去了!这五个月经过群里各位大神的指点与讨论学习,我的“剪切脚本”就像一个生命一样不断成长,功能也不断扩大,从之前简单的键鼠模拟指令,到现在已经用到自建函数与数组集合等指令!现在贴上来大家一起学习。有什么看不明白的,我们讨论区讨论!

;~ ToolTip, 注意调整屏幕`n亮度百分比
;~ Sleep, 1500
;~ ToolTip
WinShow, ahk_class WTWindow
if !WinExist("ahk_class WTWindow")
{
MsgBox, 未开启OCR扫描
Run, E:\Linteng\software\Ocr\PandaOCR.exe
WinWait, ahk_class WTWindow
WinHide, ahk_class WTWindow
}
Else
WinHide, ahk_class WTWindow
Return

End::ExitApp


Home::
kaishi:
send ^c
sleep,200
clipboard=%clipboard%
RegExMatch(Clipboard, ".+(?=\\)", aw)
Send, {Enter}
WinWait, ahk_class Photo_Lightweight_Viewer
WinActivate, ahk_class Photo_Lightweight_Viewer
Sleep, 100
;---------------------------------判断是否为销售单--------------
 t1:=A_TickCount, X:=Y:=""

Text:="|<售>*118$26.0U400M300CGk03xYzUTNDs2GLy04UVU9880OGG0DzwU3zz81vzm00YYU099802GG0AYYU3zhDszzzy7zzzUC3U01k00040000U02|<售2>*123$26.00800E600A1U039M00qmTk5g7y191zUGEME4Y04Dd013zy0FzzU4Rzs10GE0E4Y0499016GE8FzzryTzxzXzzzsDjk00M00030000M0000008|<售3>**50$27.1UQ00RXU03hgr0Dgjw0hZtU4Yjw0YYU0YYY8CpYV3LzY8SzwV24YY80YYV14YY88YY13ogbMTzxzXk0zw3zy1U70000A0000U0000004|<售4>*120$26.00A00M700CVk03tAU0ylTs6Y7y081zU808E6U04Dzc17zy0FzzU4Fh810G00E4U0490017k08FzzryTzzzUzz0E3U000M0001000000000008|<售5>**50$25.10M01YA01qG80PNDs5Yby0G3y099104YUXeGEHLz89vzY4VGG2091100UUW0E0FYcANzzryw0Dz7zy00s00070000U000001|<售6>*127$25.00001UA00kC00vL00Ttjs7wLy3P/z0ZZV0GmUVdNEFrzc8zzo4xzu2EZZV0GmUU99EFYYc8uGLwzzzzDzzzVzy00C0001U000M000000E|<售7>*120$24.000030M030s07Ms07PN23z/z1P/z19/z19929892Rz92Tzt2xzt2V09210921092E082M012zzvzzzzz7zw31k000M0008000400U|<售8>*120$25.00000k600M700RXU0Cqm43z/z0hZzUGGzk998EYUY8vyG4Tzt2SzwV8E2EU818E40Y8U0E4M012TzxzjzzzkzzUM70000k0008000200E"

if (ok:=FindText(X, Y, 727-150000, 502-150000, 727+150000, 502+150000, 0.3, 0.1, Text))
{
  ; FindText().Click(X, Y, "L")
}

If(x!="")
{
;~   MsgBox, 0, , 这是销售单,准备开切, 1
Goto, Qxiaoshou
}
Else
{
;~   MsgBox, 0, , 这不是销售单, 1
Goto, yanjiuhui
MsgBox,
}
Return

yanjiuhui:
;---------------------------------判断是否为研究会--------------
 t1:=A_TickCount, X:=Y:=""

Text:="|<茶图>*152$49.000000000000s000040Dzw00030TUzU003kw00w001ss007000xs1w1k00vk0S0Q00Qs000D00SM0007U0DA0002s07YE003A07W4003603l1007301skA0C300wM0zw1U0S60001U0C3U001k070s001k33U7001U71U0w03Uz0k07zzzzUs0TzzzzUA1zzzzzU63zzzzz0E"
Text.="|<茶图2>*150$48.00000000000000000U0zz0000U7sDs001kS00S001ss007003vU3s3U03j03s1k03i0001s0760001M0740001M07A0002M0DA0006Q0DAA00AM0D4200sM0D60sD0M0C601k0k0C30001k0S1U003U2C0s0060AQ0C00A1sQ03k0zzsQ07zzzzkQ0zzzzzUM3zzzzz0U"


if (ok:=FindText(X, Y, 172, 84, 1734, 882, 0, 0, Text))
 {
   CoordMode, Mouse
   X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
 }
If(x!="")
{
;~   MsgBox, 0, , 这是研究会单,准备开切, 1
Goto, Qyanjiuhui
}
Else
{
Goto, baoxiao
}
Return

baoxiao:
;---------------------------------判断是否为费用报销单--------------
 t1:=A_TickCount, X:=Y:=""

Text:="|<费>*143$22.00001nU3zyMDzzk1nb3zzsCxvVzzbbzzy1sksD3T1zzsPU70CQM0tlU3b60CQM0tlU3DC01ls0S1sD03U0048"

if (ok:=FindText(X, Y, 867-150000, 240-150000, 867+150000, 240+150000, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}
If(x!="")
{
;~   MsgBox, 0, , 这是费用报销单,准备开切, 1
Goto, Qbaoxiao
}
Else
{
Goto, rongsheng
}
Return
;---------------------------------判断是否为荣升单--------------
rongsheng:
t1:=A_TickCount, X:=Y:=""

Text:="|<荣升>*156$34.0000007A07Q0Nq0zkTzw7b06Q1yQ0Mk4Nk5XM1b0zzk6Rb777zzQAM3b0lnk6A3zy0Mk0y03X07w0AA0vS0kk7Aw630klUkA03040kU"
Text.="|<荣2>*156$33.00000000000000000000001a0000Ak0Ak1aM1y0TzUwk1a0Ta0Ak0MkD6E3633z0MmMMkz7s320MvTzs360DU0Mk1y0360PM0kk6Ns663X61Uk0MEM602040k00000000000000004"

if (ok:=FindText(X, Y, 373, 172, 1555, 844, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}
If(x!="")
{
;~   MsgBox, 0, , 这是荣升单,准备开切, 1
  Goto, Qrongsheng
}
Else
{
;~ MsgBox, 0, , 这不是荣升单, 1
Goto, jinyi
}
Return

;---------------------------------判断是否为金驿单--------------
jinyi:
 t1:=A_TickCount, X:=Y:=""

;~ Text:="|<金驿>*165$60.0000000000C88C1URw10Ty9y3kRa10SM/yCAIwzySMTeTzIw10Tz/y7wLyTwO8+y1UQOlaP++yTyTwl6T+CoBY6Ml6R+Dj5Yzyl6NOSz5g7yl6FyJrTyQEly00001u0E10U"
Text:="|<金驿2>*163$22.0000C3jlg+GMQcvzujkk+g10zzzkn2GDA98DkJUX7z64U|<金驿>*165$60.0000000000C88C1URw10Ty9y3kRa10SM/yCAIwzySMTeTzIw10Tz/y7wLyTwO8+y1UQOlaP++yTyTwl6T+CoBY6Ml6R+Dj5Yzyl6NOSz5g7yl6FyJrTyQEly00001u0E10U"

 if (ok:=FindText(867-150000, 171-150000, 867+150000, 171+150000, 0, 0, Text))
 {
   CoordMode, Mouse
   X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
}
If(x!="")
{
  MsgBox, 0, , 这是金驿单,准备开切, 1
  Goto, Qjinyi
}
Else
{
Goto, lingxing
}
Return
;---------------------------------判断是否为零星单--------------
lingxing:
t1:=A_TickCount, X:=Y:=""

Text:="|<零星>*126$48.0020001U00707zzk7zzU7U3k3brk7U3kTzzw7zzkM30w7U1ktvTU7U3ks3007zzk7vT03Xlk0DU01Xk00Tk03nUs0yS03Xrw1zjw3zzw7Xbs73U0Tbzs63XUlzz0C3nk00T0DzzU0Ts0E3k007k003kA03k003kS01k0Tzzy00000000U"

if (ok:=FindText(X, Y, 972-150000, 357-150000, 972+150000, 357+150000, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}
If(x!="")
{
;~   MsgBox, 0, , 这是零星单,准备开切, 1
  Goto, Qlingxing
}
Else
{
Goto, hongshou
}
Return
;---------------------------------判断是否为红色收款单--------------
hongshou:
t1:=A_TickCount, X:=Y:=""

Text:="|<红色收款>*152$71.000000000sw00CS000001tw00Sw000003zk00ts00001zzU0TnX00000Tzw0vbz00000Tzs1rDy00007zzU3ivs00000Dy07RrU0000Tzk0Cvj000000PU0RzQ000001zU0vvs00007zz01zbk00007yy03yD00000Dzy07QT00000zzy0Asz00001bzy01nzU0003yww03yS00000zlk07kM00001y11"

if (ok:=FindText(X, Y, 663, 94, 1259, 932, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}
If(x!="")
{
;~   MsgBox, 0, , 这是红色收款单,准备开切, 1
  Goto, Qhongshou
}
Else
{
Goto, zhili
}
Return

;---------------------------------判断是否为智力单--------------
zhili:
t1:=A_TickCount, X:=Y:=""

Text:="|<智力>*146$44.0k000000A0000s020000601i0001U0S1w00E09XnU0A04LEk0360T4801zvzVy0DsC0iQ00630NU001Uk41U00EA2Tw00A23630021U1Uk01UM0Tg00k606300M1U1Uk0A0s0Tw061w067030C011U001U00800008"

if (ok:=FindText(X, Y, 660-150000, 214-150000, 660+150000, 214+150000, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}
If(x!="")
{
;~   MsgBox, 0, , 这是智力单,准备开切, 1
  Goto, Qzhili
}
Else
{
Goto, baozhuang
}
Return

;---------------------------------判断是否为包装送货单--------------
baozhuang:
t1:=A_TickCount, X:=Y:=""

Text:="|<Deliver>*174$71.0kT000000zzU1Uz000001U7033b0000036C06y7000006AQ0Ds600000Aus0zU0000007zU3bzw00003yDk63zs00007s7U00000000A030000000000000000000000000000000000000s1w864002001y7ssAsnyDlY668FUNV64En8AAm20V4B1X6kENwA36MS3wD1VXEM6DVg7kA33AgU8C3GP0k4AMn4kQ4An1UTlzbtUkTnb700002010z76C201A64000000Tzzzzzzzzzzz000000000001"
Text.="|<del>*169$44.0000004k00A0s0Blk3UQ23QQ4s60kr73i0Y7BllvU9snQQss6D5z7S60l1Dlr1UDkHwTUM3z4rzk603zBzy1U07nQTsM00Rz7T6001DlllU1U7QQCs1y0r73y0zsBVkT0A73MQ7k20Mk00M0U2A3zy080nszzU20AyDzs0w3D7070Dsn1k1s2zws"

if (ok:=FindText(X, Y, 906-150000, 225-150000, 906+150000, 225+150000, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}
If(x!="")
{
;~   MsgBox, 0, , 这是包装送货单,准备开切, 1
  Goto, Qbaozhuang
}
Else
{
Goto, gongzi
}
Return

;---------------------------------判断是否为工资单--------------
gongzi:
t1:=A_TickCount, X:=Y:=""

Text:="|<茶>*142$71.0000E10000000001U700000000070C00000000060S1k0000000A0y7U000U00083wS00030000E7ts00060004URnU0000000Dsli00000000znXM00000000zi6U000000008NA000000000TXsE00000000yDzy00000001yTzw00000002S30s0000000yS61U0000001zyBX00000007zCTY00000000kQzU000000010Rb0000000020P70000000040y70000000080s700000000M0U60001|<茶2>*132$28.60A00M1k70U7kw20T7U83wQ0UBnUTlnA1zCBU7yko026300/lg00yDzy3wzzs9sA3qXkkATvXMlzaDm0UAz020vC081gQ0U2ks20C1k80E30k1U620202"
Text.="|<茶2>*132$30.30C0070C0030D1s10D3s10T3U10P7090t60DslA0TtV8013100169001QDzs1wTzw1SNqw1D10QDvV8MTtlAETwlS010ND010N7010BVU105Uk1070M1020M10208U"


if (ok:=FindText(X, Y, 641, 67, 933, 953, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}
If(x!="")
{
;~   MsgBox, 0, , 这是工资单,准备开切, 1
  Goto, Qgongzi
}
Else
{
Goto, hongdan
}
Return



;-------------------以下通过尺寸进行判断-------------------------------------------------------------------------------------

xiangsu4:               ;-------------------------像素组----------------------
xsz := {"CCCCCC":1, "CACACA":2, "C8C8C8":3, "C5C5C5":4, "B5B5B5":5, "C4C4C4":6, "CBCBCB":7, "000000":8, "CACCCC":9, "BFBFBF":10, "BEC2C8":11, "C8C2BE":12}
Return


hongdan:
MouseMove, 950, 460, 0   ;--------------------------移动到中心点
Sleep, 50
MouseGetPos, m, n
MouseMove, 0, -350, 0, R
MouseGetPos, a, b           ;---------------------移动到图片上边
g1:                                          ;------------------------------------------第一个坐标开始
PixelGetColor, c, a, b
Gosub xiangsu4
RegExMatch(c, "\w{6}$", h)
If(xsz.haskey(h)=1)           ;像素颜色是否包含在数组里面
{
	a+=0                       ;这是x轴
	b+=4
	Goto g1
}
Else
;~ MsgBox 颜色变了,(%a%, %b%)%c%
;~ WinShow ahk_pid 10968
x1 := a
y1 := b
;~ 	MouseMove, %x1%, %y1%, 0
	Sleep, 100
	MouseMove, %m%, %n%, 0
    MouseMove, -290, 0, 0, R
    MouseGetPos, a, b
	Goto g2
Return
g2:                                         ;------------------------------------------第二个坐标开始
PixelGetColor, c, a, b
Gosub xiangsu4
RegExMatch(c, "\w{6}$", h)
If(xsz.haskey(h)=1)
{
	a+=4                             ;这是x轴
	b+=0
	Goto g2
}
Else
;~ MsgBox 颜色变了,(%a%, %b%)%c%
;~ WinShow ahk_pid 10968
x2 := a-10
y2 := b
;~ MouseMove, %x2%, %y2%, 0
	Sleep, 100
	MouseMove, %m%, %n%, 0
    MouseMove, 0, 350, 0, R
    MouseGetPos, a, b
	Goto g3
Return

g3:                                         ;------------------------------------------第三个坐标开始
PixelGetColor, c, a, b
Gosub xiangsu4
RegExMatch(c, "\w{6}$", h)
If(xsz.haskey(h)=1)
{
	a+=0                             ;这是x轴
	b-=10
	Goto g3
}
Else
;~ MsgBox 颜色变了,(%a%, %b%)%c%
;~ WinShow ahk_pid 10968
x3 := a
y3 := b
;~ MouseMove, %x3%, %y3%, 0
	Sleep, 100
	MouseMove, %m%, %n%, 0
    MouseMove, 290, 0, 0, R
    MouseGetPos, a, b
	Goto g4
Return

g4:                                         ;------------------------------------------第四个坐标开始
PixelGetColor, c, a, b
Gosub xiangsu4
RegExMatch(c, "\w{6}$", h)
If(xsz.haskey(h)=1)
{
	a-=12                             ;这是x轴
	b-=0
	Goto g4
}
Else
x4 := a
y4 := b
;~ MouseMove, %x4%, %y4%, 0
	Sleep, 100
kuan := x4-x2
chang := y3-y1
If(440 < chang And chang < 580 And 250 < kuan And kuan < 420)
{
  MsgBox, 0, , 这是红票据,准备开切, 1
  Goto, Qhong
}
Else If(690 < chang And chang < 710 And 560 < kuan And kuan < 605)
{
Goto, Qxiaoshou
	}
Else
{
MsgBox, 不知道这是什么单子
note(该四边形的长宽分别是:)
Send, 长%chang%
Send, 宽%kuan%
;~  And 250 < kuan < 420
}
Return
;------------------------------------------以下是每一种票据的切割方法-

Qxiaoshou:  ;-------------------------------------------------------------------------------切割销售单------------------------------------
ControlClick, Photos_ButtonEx16, ahk_class Photo_Lightweight_Viewer, 导航栏, LEFT, 1, x15 y20
Sleep, 30
Send, !o
Send, {Down}{Enter}
WinWait, ahk_class MSPaintApp
WinKill, ahk_class Photo_Lightweight_Viewer
Sleep, 500
Click 1762, 1025                     ;  点击右下角缩小画面
Sleep, 600
click 160, 100             ;点击工具栏选择按钮
PixelSearch, 2a, 2b, 14, 170, 1900, 800, 0x584E8C, 10, Fast
chongce:
;~ If(2a != "" And 2a > 750)
If(2a != "")
{
	sleep, 300
	MouseMove %2a%, %2b%
;~     KeyWait, ScrollLock, D
    sleep, 200
    mousemove -478, -34, 0, Relative                         ;相对位置的移动
    sleep, 100
;~     KeyWait, ScrollLock, D
    Send {LButton Down}
    MouseMove 614, 448, 0,Relative
    Send {LButton Up}
;~     KeyWait, ScrollLock, D
        send ^x
        send ^s
        send ^n
        send ^v
Sleep, 200
ImageSearch, 8a, 8b, 1258, 877, 1682, 1142, D:\ImageSearch\xiongmaojiaobiao.png                  ;寻找右下角熊猫识别的角标
Sleep, 200
Click, Right, %8a%, %8b%
Sleep, 500
Send, {Down 3}
Send, {Enter}
Sleep, 300
MouseClickDrag, L, 785, 157, 1325, 425           ;从这里开始识别
Sleep, 300
WinActivate, PandaOCR - 如果我有時光機 ahk_class WTWindow
WinWait, PandaOCR - 如果我有時光機 ahk_class WTWindow
WinActivate, PandaOCR - 如果我有時光機 ahk_class WTWindow
Sleep, 500
ImageSearch, Oa, Ob, -99, -99, 490, 75, D:\ImageSearch\wenzishibie.png
MouseMove %Oa%, %Ob%
WinActivate, ahk_class WTWindow
WinWaitActive, ahk_class WTWindow
ControlClick, RichEdit20A2,ahk_class WTWindow
Sleep, 50
Clipboard:=""
Send, {Ctrl Down}{a}
Send, {Ctrl Up}
Send ^c
a := Clipboard
RegExMatch(a, "000\d{4}", b)                    ;正则表达式,用一定的规则,进行筛选输出
WinActivate, ahk_class MSPaintApp
Send ^s
Sleep, 200
WinActivate, ahk_class #32770
WinWait, ahk_class #32770
Sleep, 80
ControlClick, ToolbarWindow323, ahk_class #32770,,,, NA x550, y55
SendInput %aw%
Sleep, 80
Send, {Enter}
Sleep, 200
ControlClick, Edit1, ahk_class #32770
Sleep, 80
Send, {BackSpace 7}
Send %b%
send {.}jpg
Send {enter}
Sleep, 100
Send !{F4}
WinClose, ahk_class WTWindow
Sleep, 100
Send, {Delete}
Sleep, 200
Send, {Enter}
Goto, xiayizhang
}
Else
{
  MsgBox, 0, , 有干扰,换个姿势, 1
  TestColor := 0x584E8C
  TestColor .= 0x453C9E
  PixelSearch, 2a, 2b, 713, 189, 1147, 993, %TestColor%, 10, Fast
  Goto, chongce
}
Return

xiayizhang:       ;--------------------进入下一张剪切
MsgBox, 4, , 是否剪切下一张?
IfMsgBox, Yes
Sleep, 80
Send, {Right}
Goto, kaishi
;~ 	Return
;~ IfMsgBox, No
;~ MsgBox, 退得出去么
;~ 	Return
Return

Qyanjiuhui:   ;--------------------------------------------------------切割研究会单子------------------------------------
Sleep, 30
Send, !o                        ;用画图应用打开
Send, {Down}{Enter}
WinWait, ahk_class MSPaintApp
WinKill, ahk_class Photo_Lightweight_Viewer
Sleep, 500
Send, ^{PGDN}
Sleep, 100
Send, {WheelDown}
Sleep, 300
YLabel3:
PixelSearch, a, b, 178, 263, 272, 349,0xB03944, 10, FAST RGB
If(a !="")
{
	MouseMove, %a%, %b%
;~     KeyWait, F1, D
	MouseGetPos, c, d
	e := c - 76
	f := d - 94
	If(f < 190)
	{
	f = 195
	}
	g := e + 521
	h := f + 680
	Click, 160, 96
	MouseClickDrag, L, %e%, %f%, %g%, %h%
;~ 	MsgBox, 可以
;~ 	KeyWait, F1, D
	Send, ^c
	ClipWait
	ImageSearch, 8a, 8b, 1258, 877, 1682, 1142, D:\ImageSearch\xiongmaojiaobiao.png                  ;寻找右下角熊猫识别的角标
	Sleep, 200
	Click, Right, %8a%, %8b%
	Sleep, 500
	Send, {Down 4}
	Send, {Enter}
	Goto, YLabel2
}
Else
{
    MsgBox, 0, , 没找到中心点, 1
	MouseClickDrag, L, 1910, 550, 1910, 477
	Goto YLabel3
	Return
}
Return
YLabel2:
Sleep, 300
WinWait, PandaOCR - 如果我有時光機 ahk_class WTWindow
WinActivate, PandaOCR - 如果我有時光機 ahk_class WTWindow
ControlClick, RichEdit20A2,ahk_class WTWindow
Sleep, 50
Send, {Ctrl Down}{a}
Send, {Ctrl Up}
Send ^c
a := Clipboard
RegExMatch(a, "\d{8}(?!\d)", l)           ;-------------检测8位数号码,后为非数字
WinActivate, ahk_class MSPaintApp
Send ^x
Send ^s
Send ^n
Sleep, 100
Send ^w
WinWait, 调整大小和扭曲
Send {left}
Send {tab}1
Send {enter}
Send ^v
Send ^s
Sleep, 200
WinActivate, ahk_class #32770
WinWait, ahk_class #32770
Sleep, 80
ControlClick, ToolbarWindow323, ahk_class #32770,,,, NA x550, y55
SendInput %aw%
Sleep, 80
Send, {Enter}
Sleep, 200
ControlClick, Edit1, ahk_class #32770
Sleep, 80
Send, {BackSpace 7}
If(l != "")
	{
	Send %l%
	send {.}jpg
	Send {enter}
	Sleep, 100
	}
Else
	{
	Send 无名
	send {.}jpg
	Send {enter}
	Sleep, 100
	}
Send !{F4}
WinClose, ahk_class WTWindow
Sleep, 100
Send, {Delete}
Sleep, 200
Send, {Enter}
Return

Qbaoxiao:   ;--------------------------------------------------------切割费用报销单------------------------------------
Send, !o
Send, {Down}{Enter}
WinWait, ahk_class MSPaintApp
WinKill, ahk_class Photo_Lightweight_Viewer
Sleep, 500
Send, ^{PGDN}
Sleep, 100
fei:
;-------------------------------------定位到费字--------------------
 t1:=A_TickCount, X:=Y:=""

Text:="|<费>*142$28.000000E8001xw0DzbXUzzzz01tsw677XUTzzy3nzzsDD7X1zzzzbbzzz4S7Vw7kRj0Tzzw7zzzVrU1s0SD701swQ07Xlk0SC701tsQ077Vk0QS701noQ2"

if (ok:=FindText(X, Y, 828-150000, 193-150000, 828+150000, 193+150000, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}
if(x = "")
  {
  MsgBox, 0, , 没找到费字, 2
 ;不知道你们发现没有,用系统自带的画图功能,当鼠标滑过图形时,会导致轻微变形,想了好久,想到一个“曲线救国”的方法,就是抖一下,图形就会恢复啦
  MouseMove, 1918, 380    ;---------------拖动滚动条,抖动一下再找
  Send, {LButton Down}
  MouseMove, 1918, 410
  MouseMove, 1918, 380
  Send, {LButton, Up}
  Sleep, 200
  Goto fei
  return
  }
Else
{
a = % x - 216
b = % y - 71
c = % a + 645
d = % b + 390
Goto xLabel1
}
Return

;---------------------------------------------------------------------------------------------------------------------------------------
xLabel1:               ;--------------------------------------------统一切割技术,只要确定好四边,就能统一用这个标签下的操作---------
Click, 156 102
Sleep, 100
MouseClickDrag, L, %a%, %b%, %c%, %d%
Send, ^c
;~ KeyWait, F1, D
	ClipWait
	ImageSearch, 8a, 8b, 1258, 877, 1682, 1142, D:\ImageSearch\xiongmaojiaobiao.png                  ;寻找右下角熊猫识别的角标
	Sleep, 200
	Click, Right, %8a%, %8b%
	Sleep, 500
	Send, {Down 4}
	Send, {Enter}
Sleep, 300
WinActivate, PandaOCR - 如果我有時光機 ahk_class WTWindow
Clipboard := ""
Sleep, 80
WinWaitActive, PandaOCR - 如果我有時光機 ahk_class WTWindow
ControlClick, RichEdit20A2,ahk_class WTWindow
Sleep, 50
Send, {Ctrl Down}{a}
Send, {Ctrl Up}
Send ^c
a := Clipboard
RegExMatch(a, "\d{8}(?!\d)", l)           ;----------------------------------检测8位数号码,后为非数字
;~ MsgBox, %l%
;~ KeyWait, F1, D
WinHide, PandaOCR - 如果我有時光機 ahk_class WTWindow
WinActivate, ahk_class MSPaintApp
Send ^x
Sleep, 50
Send ^s
Send ^n
Sleep, 100
Send {LCtrl Down}{w}
Send {Lctrl Up}
WinWait, 调整大小和扭曲
Send {left}
Send {tab}1
Send {enter}
Send ^v
Send ^s
Sleep, 200
WinActivate, ahk_class #32770
WinWait, ahk_class #32770
Sleep, 80
ControlClick, x552 y53, 保存为 ahk_class #32770
;~     KeyWait, Alt, D
SendInput %aw%
Sleep, 80
Send, {Enter}
Sleep, 200
ControlClick, Edit1, 保存为 ahk_class #32770
Sleep, 80
Send, {BackSpace 7}
If(l != "")
	{
	Send %l%
	send {.}jpg
;~     KeyWait, Alt, D
	Send {enter}
	Sleep, 100
	}
Else
	{
	Send 无名
	send {.}jpg
;~       KeyWait, F1, D
	Send {enter}
	Sleep, 100
	}
Send !{F4}
WinClose, ahk_class WTWindow
Sleep, 100
Send, {Delete}
Sleep, 200
Send, {Enter}
Return
;----------------------------------------------------------------------------------------------------------------------------


Qrongsheng:  ;--------------------------------------------------------切割荣升单---------------------------------------
Send, !o
Send, {Down}{Enter}
WinWait, ahk_class MSPaintApp
WinKill, ahk_class Photo_Lightweight_Viewer
Sleep, 500
Send, ^{PGDN}
Sleep, 100
MouseClickDrag, L, 1918, 352, 1919, 402              ;-------------拉右边滚动条至合适位置
Sleep, 500
;------------下面开始识别定位顾客位置---------------
guke:
Insert::
t1:=A_TickCount, X:=Y:=""

Text:="|<顾客>*154$29.00000zzU41zz7zn0UTzbzsLjDzkTsTzVzUzz0T1zy7zvnwTzrrsDyPbkMAqtkzs1V1Um|<顾客2>*140$31.00000000001zy0M0kM7zsE43MADzUA47QEDs3icDM1rI0w0ze3nsIR3zwPiUMM/Wk8A5aA7y00021000002"
Text.="|<顾客2>*161$24.00000000Dz0UARDwDwTSDy7yDyDMDy3kCuTyDS7wSy480W7s00080000U"


if (ok:=FindText(X, Y, 17, 185, 847, 993, 0.4, 0.1, Text))
{
  ; FindText().Click(X, Y, "L")
}
 ;-------------------识别完毕-------------------------------------------
Send, {Alt}{h}{s}{e}{r}    ;------------选择图画的按钮快捷键
Sleep, 200
MouseMove, %X%, %Y%      ;这是荣升中间点的位置
;~ KeyWait, F1, D
if(x = "")
  {
  MsgBox, 0, , 没找到中心点, 1
  MouseMove, 1918, 380    ;---------------抖动一下再找
  Send, {LButton Down}
  MouseMove, 1918, 410
  MouseMove, 1918, 380
  Send, {LButton, Up}
  Sleep, 200
  Goto guke
  return
  }
else
{
Sleep, 300
If(y>333)               ;----------单子太长,顶部有点低了,要调高一点
{
 MouseMove, 1918, 380
 Send, {LButton Down}
 MouseMove, 1918, 467
 Send, {LButton Up}
 Sleep, 200
  Goto guke
  }
;~ MsgBox, 0, , 找到了!, 1
MouseMove, -57, -128, 1, R         ;移动到左上角
MouseGetPos, zsx, zsy
zsy := zsy<180 ? 190 : zsy
Sleep, 100
MouseMove, 386, 706, 0, R
MouseGetPos, yxx, yxy
MouseClickDrag, L, %zsx%, %zsy%, %yxx%, %yxy%
Goto rong1
return
}
rong1:
Send, ^c
  ImageSearch, 8a, 8b, 1258, 877, 1682, 1142, D:\ImageSearch\xiongmaojiaobiao.png                  ;寻找右下角熊猫识别的角标
  Sleep, 200
  Click, Right, %8a%, %8b%
  Sleep, 500
  Send, {Down 4}
  Send, {Enter}
Sleep, 300
WinActivate, PandaOCR - 如果我有時光機 ahk_class WTWindow
WinShow, PandaOCR - 如果我有時光機 ahk_class WTWindow
Clipboard := ""
Sleep, 80
WinWaitActive, PandaOCR - 如果我有時光機 ahk_class WTWindow
ControlClick, RichEdit20A2,ahk_class WTWindow
Sleep, 50
Send, {Ctrl Down}{a}
Send, {Ctrl Up}
Send ^c
l:=""
a := Clipboard
RegExMatch(a, "(?<!\d)\d{8}", l)           ;-------------检测8位数号码,后为非数字
WinClose, ahk_class WTWindow
WinActivate, ahk_class MSPaintApp
Send ^x
Send ^s
Send ^n
Sleep, 100
Send ^w
WinWait, 调整大小和扭曲
Send {left}
Send {tab}1
Sleep, 40
Send {enter}
Send ^v
Send ^s
Sleep, 200
WinActivate, ahk_class #32770
WinWaitActive, ahk_class #32770
ControlClick, ToolbarWindow323, ahk_class #32770,,,, NA x550, y55
Sleep, 80
SendInput, %aw%
Sleep, 100
Send, {Enter}
Sleep, 100
ControlClick, Edit1, ahk_class #32770,,,, NA x510, y538
Sleep, 80
Send, {BackSpace 7}
Send %l%
send {.}jpg
Sleep, 500
Send {enter}
Sleep, 100
Send !{F4}
WinClose, ahk_class WTWindow
Sleep, 100
Send, {Delete}
Sleep, 200
Send, {Enter}
Return

Qhong:  ;-------------------------------------------------------------------------------切割红票据------------------------------------
x2:=y1:=x4:=y3:=""
ControlClick, Photos_ButtonEx16, ahk_class Photo_Lightweight_Viewer, 导航栏, LEFT, 1, x15 y20
Sleep, 30
Send, !o
Send, {Down}{Enter}
WinWait, ahk_class MSPaintApp
WinKill, ahk_class Photo_Lightweight_Viewer
Sleep, 500
Send, ^{PGDN}               ;---------------缩小整体尺寸
MouseClickDrag, L, 1918, 352, 1919, 455         ;--------------滑动滚动条至合适位置
k := Clipboard
Click, 160, 98
t1:=A_TickCount, X:=Y:=""

Text:="|<方块>*121$8.000y8W8WDU2"

if (ok:=FindText(X, Y, 644-150000, 557-150000, 644+150000, 557+150000, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}


If(x=""){
MsgBox, 找不到这个点
}
Else{
x22= % x + 9
y22= % y + 9
MouseMove, %X22%,%Y22%
}

Click, Down
MouseMove, 1880, 779
Click, Up                        ;----------------------拉长图画,覆盖掉屏幕灰色部分
MouseMove, 468, 433
;~ KeyWait, F1, D
MouseGetPos, m, n
MouseMove, 0, -200, 0, R
MouseGetPos, a, b

hg1:                                          ;------------------------------------------第一个坐标开始
PixelGetColor, c, a, b
Gosub xiangsu4
RegExMatch(c, "\w{6}$", h)
If(xsz.haskey(h)=1)           ;像素颜色是否包含在数组里面
{
	a+=0                       ;这是x轴
	b+=4
	Goto hg1
}
Else
;~ MsgBox 颜色变了,(%a%, %b%)%c%
;~ WinShow ahk_pid 10968
x1 := a
y1 := b
	MouseMove, %x1%, %y1%, 0
;~     KeyWait, F1, D
	Sleep, 100
	MouseMove, %m%, %n%, 0
    MouseMove, -265, 0, 0, R
    MouseGetPos, a, b
	Goto hg2
Return

hg2:                                         ;------------------------------------------第二个坐标开始
PixelGetColor, c, a, b
Gosub xiangsu4
RegExMatch(c, "\w{6}$", h)
If(xsz.haskey(h)=1)
{
	a+=4                             ;这是x轴
	b+=0
	Goto hg2
}
Else
;~ MsgBox 颜色变了,(%a%, %b%)%c%
;~ WinShow ahk_pid 10968
x2 := a-10
y2 := b
MouseMove, %x2%, %y2%, 0
	Sleep, 100
	MouseMove, %m%, %n%, 0
    MouseMove, 0, 200, 0, R
    MouseGetPos, a, b
	Goto hg3
Return

hg3:                                         ;------------------------------------------第三个坐标开始
PixelGetColor, c, a, b
Gosub xiangsu4
RegExMatch(c, "\w{6}$", h)
If(xsz.haskey(h)=1)
{
	a+=0                             ;这是x轴
	b-=10
	Goto hg3
}
Else
;~ MsgBox 颜色变了,(%a%, %b%)%c%
;~ WinShow ahk_pid 10968
x3 := a
y3 := b
MouseMove, %x3%, %y3%, 0
	Sleep, 100
	MouseMove, %m%, %n%, 0
    MouseMove, 335, 0, 0, R
    MouseGetPos, a, b
	Goto hg4
Return

hg4:                                         ;------------------------------------------第四个坐标开始
PixelGetColor, c, a, b
Gosub xiangsu4
RegExMatch(c, "\w{6}$", h)
If(xsz.haskey(h)=1)
{
	a-=12                             ;这是x轴
	b-=0
	Goto hg4
}
Else
;~ ElapsedTime := A_TickCount - StartTime
;~ MsgBox, %ElapsedTime% milliseconds have elapsed.
;~ WinShow ahk_pid 10968
x4 := a
y4 := b
MouseMove, %x4%, %y4%, 0
	Sleep, 100
MouseClickDrag, L, %x2%, %y1%, %x4%, %y3%
Sleep, 100
Send ^c
Sleep, 100
;~ MsgBox, 剪切完毕
ImageSearch, 8a, 8b, 1258, 877, 1682, 1142, D:\ImageSearch\xiongmaojiaobiao.png                  ;寻找右下角熊猫识别的角标
Sleep, 200
Click, Right, %8a%, %8b%
Sleep, 500
Send, {Down 4}
Send, {Enter}
WinActivate, PandaOCR - 如果我有時光機 ahk_class WTWindow
WinWait, PandaOCR - 如果我有時光機 ahk_class WTWindow
WinActivate, PandaOCR - 如果我有時光機 ahk_class WTWindow
Sleep, 500
ControlClick, RichEdit20A2, PandaOCR - 如果我有時光機 ahk_class WTWindow
Sleep, 500
Send, ^a
Send, ^c
;~ KeyWait, Numpad0, D              ;-----------------------------【【【KeyWait果然还是要加个D,才能好好工作】】】
a := Clipboard
Label1:         ;-----------------(?<=...) 和 (?<!...) 分别是正的和负的 回顾 断言, 因为它们检查当前位置的 左边 而不是右边.
RegExMatch(a, "(?<![\d-])\d{7}(?!\d)", b)           ;---------------检测七位数号码,前后都为非数字,
If(b="")                      ;--------------------------------(?!...) 被称为负预测断言, 因为它要求指定的模式不存在.
{
;~ 	MsgBox, 啥都没有
	Goto Label2
}
Else
{
;~ 	MsgBox, 恭喜成功了%b%
	f := b
    Goto Label3
}
Return

Label2:
RegExMatch(a, "i)c[0-9]{6}", b)
;~ MsgBox, 曲线救国%b%
f := StrReplace(b, "c")
f := StrReplace(f, "000", "0000")
Goto Label3
Return

Label3:
WinActivate, ahk_exe mspaint.exe
Sleep, 200
Send ^x
Send ^s
Send ^n
Sleep, 100
Send {LCtrl Down}{w}
Send {Lctrl Up}
WinWait, 调整大小和扭曲
Send {left}
Send {tab}1
Send {enter}
Send ^v
Send ^s
Sleep, 200
WinActivate, ahk_class #32770
WinWait, ahk_class #32770
Sleep, 80
ControlClick, x565 y55, 保存为 ahk_class #32770
SendInput %aw%
Sleep, 80
Send, {Enter}
Sleep, 200
ControlClick, Edit1, 保存为 ahk_class #32770
Sleep, 80
Send, {BackSpace 7}
If(b != "")
	{
	Send %b%
	send {.}jpg
	Send {enter}
	Sleep, 100
	}
Else
	{
	Send 猜不透名字
	send {.}jpg
;~       KeyWait, F1, D
	Send {enter}
	Sleep, 100
	}
Send !{F4}
WinClose, ahk_class WTWindow
Sleep, 100
Send, {Delete}
Sleep, 200
Send, {Enter}
Return

Qjinyi:                ;------------------------------------------开始切割金驿------------------------------------
Send, !o
Send, {Down}{Enter}
WinWait, ahk_class MSPaintApp
WinKill, ahk_class Photo_Lightweight_Viewer
Sleep, 500
Send, ^{PGDN}
Sleep, 100
MouseClickDrag, L, 1918, 352, 1919, 402              ;-------------拉右边滚动条至合适位置
Sleep, 500
;------------下面开始识别定位金驿位置---------------
jinyi2:
 t1:=A_TickCount, X:=Y:=""

Text:="|<金驿3>*158$30.0k7bw1s2n43C2HAC3WFss1mFsDz2L60E2Ik0E3rwzzkMkAF0Mk4F3vy4F0Tk2H0Ek2G1kETzkU0U |<50金驿>*157$31.0000004000070SzkCk9AMAC4WMw1mEs7zx8w0A0ZvU20K63zzDzsNU0lUAF0sk28Xzx1Yk7zUGE261zz7300000000000U"
;~ Text:=""


 if (ok:=FindText(4, 159, 850, 905, 0, 0, Text))
 {
   CoordMode, Mouse
   X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
   ; Click, %X%, %Y%
 }
 ;-------------------识别完毕-------------------------------------------
Send, {Alt}{h}{s}{e}{r}    ;------------选择图画的按钮快捷键
Sleep, 200
If(X !="")
{
zx=""
zy=""
zx:=x-170
zy:=y-34
yx:=zx+512
yy:=zy+675
MouseClickDrag, L, %zx%, %zy%, %yx%, %yy%
Goto rong1            ;-------------------反正操作都一样,借用一下荣升的标签
Return
	}
Else
{
    MsgBox, 0, , 没找到中心点, 1
	MouseClickDrag, L, 1910, 550, 1910, 477
	Goto jinyi2
	Return
}
Return

Qlingxing:                ;------------------------------------------开始切割零星------------------------------------
Send, !o
Send, {Down}{Enter}
WinWait, ahk_class MSPaintApp
WinKill, ahk_class Photo_Lightweight_Viewer
Sleep, 500
Send, ^{PGDN}
Sleep, 100
ling:
t1:=A_TickCount, X:=Y:=""

Text:="|<零星>*117$61.00000000000001U0C00S0001w07zzzU7zzy03k07k00s1U1s03k7uzzw0x1Ns7yC0T0Tzzw7U70S0D00S7rvjs07U0D3k1k003zzzUk4tw01sS3k1yQy00kDU000T00063k000zk007ls200yC003kw3k0z3s01sTzw0ywzw1zzzy1wS7w0s7U01s7By0Q3kE3zzza0Q1sQ2307s0S6yTU007w0BzzvW"

if (ok:=FindText(X, Y, 443-150000, 566-150000, 443+150000, 566+150000, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}
if(x = "")
  {
  MsgBox, 0, , 没找到零字, 2
  MouseMove, 1918, 380    ;---------------抖动一下再找
  Send, {LButton Down}
  MouseMove, 1918, 410
  MouseMove, 1918, 380
  Send, {LButton, Up}
  Sleep, 200
  Goto ling
  return
  }
Else
{
a = % x - 388
b = % y - 30
c = % x + 307
d = % y + 352
Goto xLabel1
}
Return

Qhongshou:                ;------------------------------------------开始切割红色收款单------------------------------------
Send, !o
Send, {Down}{Enter}
WinWait, ahk_class MSPaintApp
WinKill, ahk_class Photo_Lightweight_Viewer
Sleep, 500
Send, ^{PGDN}
Sleep, 100
hshou:
t1:=A_TickCount, X:=Y:=""

Text:="|<收>*145$26.00000DDU03nw00wz00DDU1vnskTwwC7jDzlvnjwSxtw7jQS1vr7USxns7jSw1vxz0SzDk7z3w1zkS0Sw7U7D3y0Xlzs0wzzUDyDU3y1k0u0A8"

if (ok:=FindText(X, Y, 329-150000, 462-150000, 329+150000, 462+150000, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}
if(x = "")
  {
  MsgBox, 0, , 没找到收字, 2
  MouseMove, 1918, 380    ;---------------抖动一下再找
  Send, {LButton Down}
  MouseMove, 1918, 410
  MouseMove, 1918, 380
  Send, {LButton, Up}
  Sleep, 200
  Goto hshou
  return
  }
Else
{
a = % x - 262
b = % y - 39
c = % x + 436
d = % y + 340
Goto xLabel1
}



Qzhili:                ;------------------------------------------开始切割智力单------------------------------------
Send, !o
Send, {Down}{Enter}
WinWait, ahk_class MSPaintApp
WinKill, ahk_class Photo_Lightweight_Viewer
Sleep, 500
Send, ^{PGDN}
Sleep, 100
zli:
t1:=A_TickCount, X:=Y:=""

Text:="|<智力>*141$41.0000000300000060000k08U001k0z000301szk0604VVU0801t600Lky2A1zlr/7k1n30H8004610000MA6js00UMFUk030k31U04107u00M60A401UA0M8060s0rk0s7U1VU207023000A00000008"

if (ok:=FindText(X, Y, 306-150000, 329-150000, 306+150000, 329+150000, 0, 0, Text))
{
  ; FindText().Click(X, Y, "L")
}
if(x = "")
  {
  MsgBox, 0, , 没找到智力字, 2
  MouseMove, 1918, 380    ;---------------抖动一下再找
  Send, {LButton Down}
  MouseMove, 1918, 410
  MouseMove, 1918, 380
  Send, {LButton, Up}
  Sleep, 200
  Goto zli
  return
  }
Else
{
a = % x - 192
b = % y - 97
c = % x + 731
d = % y + 547
Goto xLabel1
}







Qbaozhuang:                ;------------------------------------------开始切割包装送货单------------------------------------
ControlClick, Photos_ButtonEx16, ahk_class Photo_Lightweight_Viewer, 导航栏, LEFT, 1, x15 y20
Sleep, 30
Send, !o
Send, {Down}{Enter}
WinWait, ahk_class MSPaintApp
WinKill, ahk_class Photo_Lightweight_Viewer
Sleep, 500
Send, ^{PGDN}
Sleep, 100
shdw1:
t1:=A_TickCount, X:=Y:=""

Text:="|<收货单位>*172$55.4k1A0MU6M2M0mk4k3AB8Unk/I12LjstW7v1UPqMAz2NUkNz8671zkuAyg3zUaEgaSS0gUTA6GD60qE9V394X0P87xVZUGk3Q080UYCC330A0MH0000U0000E|<收货单位2>**30$55.00000000E2M0q0AE3A1A0nM3E124YMNu7z1ZSKsSl29Uk1+86DVzkuAaY300aMBaHK0wkTcKGD60KE9U396X0P82wlYUHkBo0M0kY/C1a040EL7311U6080E"
Text.="|<收货单位2>*177$44.0000000000000004000E1090L0g6E+qBkzVbWfbvBsEkyknXyBA/wBkzV+3a2oB8GUdUh5PYc2w7k417Ulb61UIM00000001U000000MM0000066000001nX6Rda0INK8AU0BqQvWC02NA6BUU0aPI+F9080FX08EE00000000000000zzzzzzzs"



if (ok:=FindText(X, Y, 210-150000, 280-150000, 210+150000, 280+150000, 0.1, 0.4, Text))
{
  ; FindText().Click(X, Y, "L")
}
if(x = "")
  {
  MsgBox, 0, , 没找到收货单位字, 2
  MouseMove, 1918, 380    ;---------------抖动一下再找
  Send, {LButton Down}
  MouseMove, 1918, 410
  MouseMove, 1918, 380
  Send, {LButton Up}
  Sleep, 200
  Goto shdw1
  return
  }
Else
{
;~   MouseMove, %x%, %y%
;~   If(y>333)               ;----------单子太长,顶部有点低了,要调高一点
;~   {
;~   MouseMove, 1918, 380
;~   Send, {LButton Down}
;~   MouseMove, 1918, 467
;~   Send, {LButton Up}
;~   KeyWait, F1, D
;~   Sleep, 200
;~   Goto shdw1
;~   }
;~ Else
;~ {
a = % x - 65
b = % y - 58
c = % x + 460
d = % y + 659
Goto xLabel1
}
;~ }










Qgongzi:                ;------------------------------------------开始切割工资单------------------------------------
Send, ^,
Send, ^,
Send, ^,
Sleep, 80
Send, !o
Send, {Down}{Enter}
WinWait, ahk_class MSPaintApp
WinKill, ahk_class Photo_Lightweight_Viewer
Sleep, 500
Send, ^{PGDN}
Sleep, 100
gongzi3:
t1:=A_TickCount, X:=Y:=""

Text:="|<资>**50$29.18k1k0X0302AC80AkME5k1s0D03M0C0AM0M0kQ0k70S1Vs0TXQ00C0UwD01zRy0300A061UM0A3Uk0M61U0kQ301Us6031UA0670000As001kTUE|<资2>*136$21.00000M0A300mzy6Y1U9682Em7UC0A1810kkMA3nS0D6060E0k2260EMk2660Ekk6660FU00Qw060w701q0020004"
Text.="|<资2>*140$23.0100M300MA30GTy090M0YMU6Ek0Q3E0E4M1UkQ3C0T7U183zz06060AAA0MMM0kkk1V1U362009k01ky0C0C7U0400000001"


if (ok:=FindText(X, Y, 328, 191, 954, 985, 0.3, 0.4, Text))
{
  ; FindText().Click(X, Y, "L")
}
if(x = "")
  {
  MsgBox, 0, , 没找到资字, 1
  Sleep, 80
  MouseMove, 1918, 380    ;---------------抖动一下再找
  Send, {LButton Down}
  MouseMove, 1918, 410
  MouseMove, 1918, 380
  Send, {LButton Up}
  Sleep, 200
  Goto gongzi3
  return
  }
Else
{
a = % x - 421
b = % y - 87
c = % x + 340
d = % y + 335
Goto xLabel1
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA捐赠
共{{data.count}}人
人已捐赠
其他应用案例

小巧的计时器 萌新也可以看懂

2021-7-23 8:57:28

其他教程

让无标题窗口,可以随意的拖动

2021-7-24 6:56:52

3 条回复 A文章作者 M管理员
  1. hexuren

    学以致用非常不错,加油改进,希望能尽快看到你的作品。

    • 月下马

      想重新编辑,放代码进去,没找到编辑键

  2. 〇〇小猪

    小马哥?

个人中心
购物车
优惠劵
有新私信 私信列表
搜索