Forum Discussion

mafuko's avatar
mafuko
Occasional Contributor
15 years ago

Problem with PictureObj.Stretch(Width, Height)

HI,

I want use this picture methods "stretch"  PictureObj.Stretch(Width, Height)  in TestComplete5 with VBscript like this:



    Set ObrazokObj = Sys.Desktop.Picture

    ObrazokObj.Stretch(800,800)

    ObrazokObj.SaveToFile("D:\plocha.png")



But I cant run the script, because I got this error:

    Syntax error



    At "

    ObrazokObj.Stretch(800,800)

    O"

    error 100:Syntax error while processing ",".

I don't understand why, can you pls write me how Can I change this methods of picture ? or other oportunity how to reduce size of image ? (I dont want use PictureObj.size)

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Change your code to the following:





        Set ObrazokObj = Sys.Desktop.Picture

        Call ObrazokObj.Stretch(800, 800)

        Call ObrazokObj.SaveToFile("D:\plocha.png")





    I'm no VB expert but IIRC, if you're calling a method on an object, you need to preface the line with "Call".  The above works fine.

  • Hi Matus,





    As Robert said, you need to call the Stretch method by using the Call statement. However, you can also call the method in the following way:











    I recommend that you read the MSDN 'Call Statement' article for more information.
  • mafuko's avatar
    mafuko
    Occasional Contributor
    Thank you very much,

    I don't see this mistake and 2 my frineds too :-D other point of view everytime help.