well, from guessing, this is what i could come up with:
program ChangeBackground;
function FindColorNClick(var x, y: Integer; color, xs, ys, xe, ye, tol: Integer): Boolean;
begin
Result := findcolortolerance(x, y, color, xs, ys, xe, ye, tol); //it returns true if
//it finds the color
ClickMouse(x, y, True); //clicks the color
end;
var x, y: integer; //you forgot to set the variables
begin
Wait(3000);
Writeln('Clicking Minimize All Button');
ClickMouse(95, 785, True);
Wait(500);
Writeln('Right-Clicking Background');
ClickMouse(375, 644, False);
Wait(500);
Writeln('Clicking Personalize');
ClickMouse(390, 630, True);
Wait(2000);
Writeln('Finding and Clicking Choose a desktop background');
while not FindColorNClick(x, y, {you need to set these:} color, xs, ys, xe, ye, 5) do wait(100);
//while the color isnt found(the button) it waits.
ClickMouse(x, y, True);// you needed the x, y variables edit: sorry :p i forgot it would already be clicked. change it back
Wait(2000);
Writeln('Choosing a Background');
ClickMouse(320, 463, True);
end.
i hope you under stand my changes :) if not, pm me and i'll try to help you out