Forum Discussion

amithsid's avatar
amithsid
Contributor
11 years ago

Query related to Log.Picture()

Hello,



How to change the name of the picture thats gets generated when I use Log.Picture().

Consider the following JS code-

Log.Picture(Sys.Desktop, "Message Text", "Extended Message Text", pmHighest);



The picture produces has a default name as Picture1, how to change it?



Thank you,

Amith n g
  • I don't believe you can, but maybe the picture method and savetofile will give you a work around to whatever you are trying to accomplish with this.






    function main(){


    var myPicture = Sys.Desktop.Picture();


    myPicture.SaveToFile('C:\\ThisImage.PNG');

    }


  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    I don't believe you can, but maybe the picture method and savetofile will give you a work around to whatever you are trying to accomplish with this.






    function main(){


    var myPicture = Sys.Desktop.Picture();


    myPicture.SaveToFile('C:\\ThisImage.PNG');

    }


  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    You can log it directly to the log like so:






    function main(){


    var myPicture = Sys.Desktop.Picture();


    myPicture.SaveToFile('C:\\ThisImage.PNG');


    Log.Picture(myPicture,'This is a test.');

    }





    Unfortunately I don't believe there is a way to control how the log names the logged picture so you'll have 2 images at this point, the one you saved to file and the one from the log. It is at least the same image.

  • Hello,



    Thanks for your reply, I have already tried that. Then comes up another problem- how to load the same image and post it to the log?


    unction main(){


     


    var myPicture = Sys.Desktop.Picture();


     


    myPicture.SaveToFile('C:\\pic1.PNG');


    var PicObj = Utils.Picture;


      // Loads an image from a file


      PicObj.LoadFromFile("C:\\Temp\\pic1.jpg"); 


      // Saves this image to the test log


      path=Log.Picture(PicObj, "preReq 1 passed", "patient record created", pmHighest);



    }

    If I use this, again the picture gets generated as Picture1.png