forked from camerb/AHKs
-
Notifications
You must be signed in to change notification settings - Fork 38
/
CaptureAhkImage.ahk
99 lines (89 loc) · 2.38 KB
/
CaptureAhkImage.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include FcnLib.ahk
#singleinstance force
if ( GetOS() == "WIN_7" )
{
Send, {PrintScreen}
Sleep, 100
IfWinExist, ahk_class MSPaintApp
{
fatalErrord("Paint is already open")
}
Run, C:\Windows\system32\mspaint.exe
WinWait, Untitled - Paint ahk_class MSPaintApp
Sleep, 100
Send, ^v
Sleep, 100
Click(186, 69)
Sleep, 100
Click(186, 69)
KeyWait, ``, D
Send, ^+x
Sleep, 100
Send, ^s
WinWait, Save As
description := Prompt("Provide a short description of the image (or something like 'images/appName/description')")
ForceWinFocus("Save As")
time:=CurrentTime()
path=C:\DataExchange\InstantAhkImage
description:=StringReplace(description, "/", "\")
if RegExMatch(description, "(images)\\(.*?)\\(.*?)$", MatchVar)
{
path=C:\Dropbox\AHKs\images\%MatchVar2%
description=%MatchVar3%
time:=""
}
FileCreateDir, %path%
SendInput, %path%\%time%%description%.bmp
Sleep, 100
MouseClick, left, 221, 449
Sleep, 100
MouseClick, left, 207, 514
Sleep, 100
MouseClick, left, 672, 498
Sleep, 100
WinClose, ahk_class MSPaintApp
}
else if ( GetOS() == "WIN_XP" )
{
Send, {PrintScreen}
Sleep, 100
IfWinExist, ahk_class MSPaintApp
{
fatalErrord("Paint is already open")
}
Run, C:\Windows\system32\mspaint.exe
WinWait, untitled - Paint ahk_class MSPaintApp
Sleep, 100
Send, ^v
Click(15, 70, "Control")
Click(40, 70, "Control")
KeyWait, ``, D
Send, ^x^e1{TAB}1{ENTER}^v
Send, ^s
WinWait, Save As
description := Prompt("Provide a short description of the image (or something like 'images/appName/description')")
ForceWinFocus("Save As")
time:=CurrentTime()
path=C:\DataExchange\InstantAhkImage
description:=StringReplace(description, "/", "\")
if RegExMatch(description, "(images)\\(.*?)\\(.*?)$", MatchVar)
{
path=C:\Dropbox\AHKs\images\%MatchVar2%
description=%MatchVar3%
time:=""
}
FileCreateDir, %path%
ForceWinFocus("Save As")
SendInput, %path%\%time%%description%.bmp
Sleep, 100
ControlClick, &Save
WinWaitClose, Save As
Sleep, 100
WinClose, ahk_class MSPaintApp
}
else
{
fatalErrord("looks like this OS is unsupported", "GetOS()", GetOS(), "A_ComputerName", A_ComputerName)
}
ExitApp
ESC::ExitApp