写了个脚本,想自动取//和第一个/之间的内容作为文件或图片的标题,但因为有http://和https://的区别,所以名字总是取不完整,下面是写的脚本。
^!z::suspend
~LButton::
CoordMode, Mouse, Screen
SetKeyDelay 0, 10
c := 0
MouseGetPos, x1, y1
KeyWait, LButton
MouseGetPos, x2, y2
if (x1<>x2 or y1<>y2) {
Getkeystate("#", "`"), Keywait
}
else if (A_priorHotKey = "~LButton" and A_TimeSincePriorHotkey < 400){
Getkeystate("#", "`"), Keywait
}
return
#`::
c := 1
Send ^c
clip:=clipboard
clipwait
filename = %clip%
subpart2 = /
FoundPos2 := InStr(filename, subpart2, false, 9, 1)
subpart = s
FoundPos := InStr(filename, subpart, false, 1, 1)
if FoundPos>=0&FoundPos><>5
{
filename := SubStr(filename,9,FoundPos2-9)
}
else if FoundPos>=0&FoundPos<=5
{
filename := SubStr(filename,FoundPos+3,FoundPos2-9)
}
FileAppend, %A_Hour%%A_Min%%A_SEC%%A_MSEC%%filename%, D:\Downloads\333.txt
FileAppend,`n, D:\Downloads\333.txt
clip=
tooltip 成功
sleep 2000
tooltip
return
仔细研究了下,好像只过第一个if没经过第二个else if. 还有这个多一个s之后的调用确实太麻烦了,想了好久还是不通,,请高人点播下,谢!
^!z::suspend
~LButton::
CoordMode, Mouse, Screen
SetKeyDelay 0, 10
c := 0
MouseGetPos, x1, y1
KeyWait, LButton
MouseGetPos, x2, y2
if (x1<>x2 or y1<>y2) {
Getkeystate("#", "`"), Keywait
}
else if (A_priorHotKey = "~LButton" and A_TimeSincePriorHotkey < 400){
Getkeystate("#", "`"), Keywait
}
return
#`::
c := 1
Send ^c
clip:=clipboard
clipwait
filename = %clip%
subpart2 = /
FoundPos2 := InStr(filename, subpart2, false, 9, 1)
subpart = s
FoundPos := InStr(filename, subpart, false, 1, 1)
if FoundPos>=0&FoundPos><>5
{
filename := SubStr(filename,9,FoundPos2-9)
}
else if FoundPos>=0&FoundPos<=5
{
filename := SubStr(filename,FoundPos+3,FoundPos2-9)
}
FileAppend, %A_Hour%%A_Min%%A_SEC%%A_MSEC%%filename%, D:\Downloads\333.txt
FileAppend,`n, D:\Downloads\333.txt
clip=
tooltip 成功
sleep 2000
tooltip
return
仔细研究了下,好像只过第一个if没经过第二个else if. 还有这个多一个s之后的调用确实太麻烦了,想了好久还是不通,,请高人点播下,谢!
