Example script - Using native windows dialogues with alpha4 and above

Discussion in 'Sythe Lib Archive' started by Sythe, May 3, 2017.

Example script - Using native windows dialogues with alpha4 and above
  1. Unread #1 - May 3, 2017 at 8:34 PM
  2. Sythe
    Joined:
    Apr 21, 2005
    Posts:
    8,063
    Referrals:
    450
    Sythe Gold:
    5,191
    Discord Unique ID:
    742989175824842802
    Discord Username:
    Sythe
    Dolan Duck Dolan Trump Supporting Business ???
    Poképedia
    Clefairy Jigglypuff
    Who did this to my freakin' car!
    Hell yeah boooi
    Tier 3 Prizebox Toast Wallet User
    I'm LAAAAAAAME Rust Player Mewtwo Mew Live Free or Die Poké Prizebox (42) Dat Boi

    Sythe Join our discord

    test

    Administrator Village Drunk

    Example script - Using native windows dialogues with alpha4 and above

    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);
    
     
    ^ Zavada likes this.
< Example script - Using Oversized BackBuffer | [INCOMPLETE] Discord Screenshotter >

Users viewing this thread
1 guest


 
 
Adblock breaks this site