-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStandAlone_MEMUplay_Screenshot_001.ahk
140 lines (112 loc) · 4.97 KB
/
StandAlone_MEMUplay_Screenshot_001.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
; ********************************
; MEMUplay directories
; ********************************
; Music: C:\Users\CowNi\Music\MEmu Music
; Video: C:\Users\CowNi\Videos\MEmu Video
; Pictures: C:\Users\CowNi\Pictures\MEmu Photo
; Downloads: C:\Users\CowNi\Downloads\MEmu Download
; Screenshots: c:\Users\CowNi\Pictures\MEmu Photo\Screenshots
;
; ********************************
; System environemental variables
; ********************************
; ALLUSERSPROFILE=C:\ProgramData
; APPDATA=C:\Users\CowNi\AppData\Roaming
; HOMEPATH=\Users\CowNi
; LOCALAPPDATA=C:\Users\CowNi\AppData\Local
; TEMP=C:\Users\CowNi\AppData\Local\Temp
; TMP=C:\Users\CowNi\AppData\Local\Temp
; USERNAME=CowNi
; USERPROFILE=C:\Users\CowNi
; capture variable using:
; EnvGet, USER_PROFILE, USERPROFILE
;
; ********************************
; Combined: System environemental variables
; and MEMUplay directories
; ********************************
; Music: "%USERPROFILE%\Music\MEmu Music"
; Video: "%USERPROFILE%\Videos\MEmu Video"
; Pictures: "%USERPROFILE%\Pictures\MEmu Photo"
; Downloads: "%USERPROFILE%\Downloads\MEmu Download"
; Screenshots: "%USERPROFILE%\Pictures\MEmu Photo\Screenshots"
#include <Vis2>
#include lib\CowNinja_Functions.ahk
#include <Gdip_All>
#include lib\Image_Processing_Library.ahk
; # Win (Windows logo key)
; ! Alt
; ^ Control
; + Shift
; Take screenshot in MEMUplay (Alt + F3)
Text_To_Screen("{!F3}")
; Crop Screenshot
Path = %USERPROFILE%\Pictures\MEmu Photo\Screenshots ; change this to the actual folder
Newest_ScreenCap := DIR_Newest_File(Path)
pCroppedBitmap := Gdip_CropBitmap(Newest_ScreenCap, 0, 0, 77, 77, 0) ; crops 77 pixels from upper and lower side of bitmap rectangle. Does not dispose of pBitmap.
MsgBox, 1. Lastest file in %Path% is `n`n%Newest_ScreenCap%`n`nCropped Picture is: %pCroppedBitmap%
Crop_X := 100
Crop_Y := 25
Crop_H := 50
Crop_W := 75
/*
Input_Image := % """" Newest_ScreenCap """"
Dest_Crop := % """" Crop_X " " Crop_Y " " Crop_H " " Crop_W """"
Dest_Scale := ""
Dest_filename := % """" Path "\Crop_Test.png"""
Dest_compression := """png"""
*/
Crop_W := 75
Input_Image := Newest_ScreenCap
Dest_Crop := Crop_X . " " . Crop_Y . " " . Crop_H . " " . Crop_W
Dest_Scale := ""
Dest_filename := Path . "\Crop_Test.png"
Dest_compression := "png"
MsgBox, ImageToFile(Input_Image, Dest_Crop, Dest_Scale, Dest_filename, Dest_compression)`nImageToFile(%Input_Image%, %Dest_Crop%, %Dest_Scale%, %Dest_filename%, %Dest_compression%)
results := ImageToFile(Input_Image, Dest_Crop, Dest_Scale, Dest_filename, Dest_compression)
MsgBox, %results%
return
DIR_Newest_File(Folder_Path)
{
Loop %Folder_Path%\*.* ; www.autohotkey.com/forum/viewtopic.php?p=342784#342784
If ( A_LoopFileTimeModified >= Time )
Time := A_LoopFileTimeModified, File := A_LoopFileLongPath
MsgBox, 1. Lastest file in %Folder_Path% is `n`n%File%
return File
}
ImageToFile(image, crop := "", scale := "", filename := "", compression := "") {
return Graphics.Picture.Preprocess("file", image, crop, scale, filename, compression)
}
ImageToBase64(image, crop := "", scale := "", extension := "", compression := "") {
return Graphics.Picture.Preprocess("base64", image, crop, scale, extension, compression)
}
;-- returns cropped bitmap. Specify how many pixels you want to crop (omit) from each side of bitmap rectangle
Gdip_CropBitmap(pBitmap, left, right, up, down, Dispose=1) {
/* DESCRIPTION of function Gdip_CropBitmap()
-------------------------------------------------------------------------------------------------------------------
Description : returns cropped bitmap. Specify how many pixels you want to crop (omit) from each side of bitmap rectangle
Link : http://www.autohotkey.com/community/viewtopic.php?p=477333#p477333
Author : Learning one
Date : Nov 14 2012
AHK-Version : AHK_L
License : unknown
Parameter(s) : see examples
Remark(s) : none
Dependencies : GDIP.ahk
-------------------------------------------------------------------------------------------------------------------
*/
/* EXAMPLE(s)
pCroppedBitmap := Gdip_CropBitmap(pBitmap, 10, 10, 10, 10) ; crops 10 pixels from each side of bitmap rectangle. Disposes of pBitmap.
pCroppedBitmap := Gdip_CropBitmap(pBitmap, 50, 50, 0, 0) ; crops 50 pixels from left and right side of bitmap rectangle. Disposes of pBitmap.
pCroppedBitmap := Gdip_CropBitmap(pBitmap, 0, 0, 77, 77, 0) ; crops 77 pixels from upper and lower side of bitmap rectangle. Does not dispose of pBitmap.
*/
Gdip_GetImageDimensions(pBitmap, origW, origH)
NewWidth := origW-left-right, NewHeight := origH-up-down
pBitmap2 := Gdip_CreateBitmap(NewWidth, NewHeight)
G2 := Gdip_GraphicsFromImage(pBitmap2), Gdip_SetSmoothingMode(G2, 4), Gdip_SetInterpolationMode(G2, 7)
Gdip_DrawImage(G2, pBitmap, 0, 0, NewWidth, NewHeight, left, up, NewWidth, NewHeight)
Gdip_DeleteGraphics(G2)
if Dispose
Gdip_DisposeImage(pBitmap)
return pBitmap2
} ;</05.01.000052>