- Joined
- Apr 21, 2005
- Sythe Gold
- 5,470
- Messages
- 8,074
This code will open the Resize dialogue in an mspaint window and change and save the values there. It uses virtual mouse and keyboard.
Code:
SetWindow("- Paint");
global ancestor_hwnd = GetAncestorWindowHWND();
ShowGameWindow(true);
Sleep(1000);
def ClickInnerWindow(window, x,y,button) {
var original = GetWindowHWND();
SelectInnerWindowByHWND(window);
ClickMouse(x,y,button);
Sleep(100);
UnselectInnerWindow();
SelectInnerWindowByHWND(original);
}
SetVirtualInputsOn();
SetVirtualMouseWFPModeOn();
global resizebutton = LoadBitmapFromString(
"0001>01W^PLRx4sF+o`-Q(5a185jTn&S4Y4000mG5C8}O0a~>8|F8hK3IGOx015yGfB*zZ5{#N" +
"{4<t`W^*979AlyO5mxCkDBlF6SI#CHEI(_TgO?0mQ3<gKC>^@MfR>z`Uu-JE`qs4}YCtc8ww9#" +
"|yj>&tFb^{n7{<mBX*_RLE$!tu7xc6(0bxjphls8a`77&~QAL8yvrwS4sVq+r!00000", 0xff00ff, false);
def ResizePaintBMP(newwidth, newheight) {
var x = 0; var y = 0;
Scrape();
if (FindBitmap(x,y, resizebutton, 0, 0)) {
ClickMouse(x,y,1);
Sleep(500);
if (SetWindow("Resize and Skew") == "") {
Die("Can't find the resize and skew window");
}
ResetInnerWindowsIterator();
for(var w = NextInnerWindowsIterator(); w != 0; w = NextInnerWindowsIterator()) {
if (GetInnerWindowTextByHWND(w) == "Pixels") {
ClickInnerWindow(w, 1,1,1);
}
if (GetInnerWindowTextByHWND(w) == "&Maintain aspect ratio") {
ClickInnerWindow(w, 1,1,1);
}
}
var current_window = GetWindowHWND();
ResetInnerWindowsIterator();
for(var w = NextInnerWindowsIterator(); w != 0; w = NextInnerWindowsIterator()) {
if (GetInnerWindowTextByHWND(w) == "&Horizontal:") {
w = NextInnerWindowsIterator();
var x = 0; var y = 0; var wi = 0; var he = 0;
if (GetInnerWindowDims(w, x, y, wi, he)) {
SelectInnerWindowByHWND(w);
ClickMouse(wi-2,1,1);
Sleep(100);
for (var i = 0; i < 4; ++i) {
KeyDown(0x08);
Sleep(100);
KeyUp(0x08);
}
SendKeys("" + newwidth);
UnselectInnerWindow();
SelectInnerWindowByHWND(current_window);
}
}
if (GetInnerWindowTextByHWND(w) == "&Vertical:") {
w = NextInnerWindowsIterator();
var x = 0; var y = 0; var wi = 0; var he = 0;
if (GetInnerWindowDims(w, x, y, wi, he)) {
SelectInnerWindowByHWND(w);
ClickMouse(wi-2,1,1);
Sleep(100);
for (var i = 0; i < 4; ++i) {
KeyDown(0x08);
Sleep(100);
KeyUp(0x08);
}
SendKeys("" + newheight);
UnselectInnerWindow();
SelectInnerWindowByHWND(current_window);
}
}
}
ResetInnerWindowsIterator();
for(var w = NextInnerWindowsIterator(); w != 0; w = NextInnerWindowsIterator()) {
if (GetInnerWindowTextByHWND(w) == "OK") {
print(GetInnerWindowTextByHWND(w) + ", " + GetInnerWindowClassNameByHWND(w));
SelectInnerWindowByHWND(w);
ClickMouse(1,1,1);
}
}
SetWindowByHWND(ancestor_hwnd);
Sleep(100);
}
}
ResizePaintBMP(900, 600);






















