Thread

Index > Puppeteer > Example: Skip over all the cygwin setup stuff
Author/Date Example: Skip over all the cygwin setup stuff
fret
24/05/2018 11:24am
This script gets me straight to the select a package page of the cygwin setup program:

function Error(Str)
{
    Print("Error: " + Str + "\n");
    return -1;
}

ProcessName = "C:\\cygwin64\\setup-x86_64.exe";
p = GetProcess(ProcessName);
if (!p)
    p = RunProcess(ProcessName, "");
if (!p)
    return Error("Can't find process: " + ProcessName);

for (i=0; i<6; i++)
{
    Btn = p.GetWindowByName("Next");
    Btn.WaitEnable(3000);
    Print("Next click\n");
    Btn.Click();
}

Btn = p.GetWindowByName("Next");
while (!Btn.WaitEnable(500))
{
    d = p.GetWindowByName("Setup");
    if (d.Length > 0)
    {
        // Print("d = " + ToString(d) + "\n");
        if (d.Type() == "List")
        {
            for (i=0; i<d.Length; i++)
            {
                Ok = p.GetWindowByName("Ok", d[i]);
                if (Ok)
                {
                    Print("Ok click\n");
                    Ok.Click();
                    i = 100;
                }
            }
        }
        else
        {
            Ok = p.GetWindowByName("Ok", d);
            if (Ok)
            {
                Print("Ok click\n");
                Ok.Click();
            }
        }
    }
}

Print("End\n");
return 0;
fret
24/05/2018 11:27am
It assumes the defaults of the previous run. So go through the steps manually first.
Reply