Contributions
Re: Use the return value of a Python function in another function
HiMarsha_Rthanks again for your help! here the screenshot of Test Log . I double checked the search area and is the right one Here the relevant part of the code: ImageRepository.AssetLibraryMenus.Menu_ExternalEnergyNetworks.Click() MySourceObject = ImageRepository.Assets.ElectricGridConnection ImageRepository.Assets.ElectricGridConnection.Click() X = Sys.Desktop.MouseX Y = Sys.Desktop.MouseY MyDestinationObject = Aliases.SimpsonGui.ComponentTreeView.qt_scrollarea_viewport MyDestinationObject.Click() toX = Sys.Desktop.MouseX toY = Sys.Desktop.MouseY Log.Message(X) Log.Message(Y) Log.Message(toX) Log.Message(toY) MySourceObject.Drag(X,Y,toX,toY)1.5KViews0likes0CommentsObject cannot be recognized again once it has been clicked
Hi everybody, I have an object that is not mapped automatically and therefore I have to work with it as an ImageRepositoryObject. I want to drag the object. To extract the coordinates, I click on it. Afterwards, when trying to drag it, the object is not recognized anymore. In the Script Test Log appears "unable to simulate the Drag action. No image was found". I do know that the click action is being succesfull because I get the right coordinates. Any idea what is happening and how I could fix it? I would be very thankful! Here the code in case it helps: ImageRepository.AssetLibraryMenus.Menu_ExternalEnergyNetworks.Click() MySourceObject = ImageRepository.Assets.ElectricGridConnection ImageRepository.Assets.ElectricGridConnection.Click() SX = Sys.Desktop.MouseX SY = Sys.Desktop.MouseY MyDestinationObject = Aliases.ComponentTreeView.qt_scrollarea_viewport MyDestinationObject.Click() DX = Sys.Desktop.MouseX DY = Sys.Desktop.MouseY MySourceObject.Drag(SX,SY,DX, DY) Best, PaolaSolved785Views0likes2CommentsRe: Use the return value of a Python function in another function
ThanksMarsha_RI already had tried it and did not work. I think, the problem is not at getting the return value, but at recognizing the object again (which I want to manipulate with the return value of the function) . Do you have any idea why an object cannot be recognized once I has been cklicked once? Thanks a lot again!1.6KViews0likes4CommentsUse the return value of a Python function in another function
Hi ! I defined a method to get the coordinates of an object. These coordinates I want to use in another function to drag and drop the object. I just do not now how to get the return value of a function. The reason why I want to use the coordinates in another function is because the object is nor recognized in my first function anymore (dont know why, if you have an idea, that is also welcomed) Here the function to obtain the coordinates: def getElectricGridDragDropCoordinates(): ImageRepository.AssetLibraryMenus.Menu_ExternalEnergyNetworks.Click() MySourceObject = ImageRepository.Assets.ElectricGridConnection ImageRepository.Assets.ElectricGridConnection.Click() SourceX = Sys.Desktop.MouseX SourceY = Sys.Desktop.MouseY MyDestinationObject = Aliases.SimpsonGui.wndQt5QWindowIcon..widget_placeholderEquipment.ComponentTreeView.qt_scrollarea_viewport DestinationX = MyDestinationObject.Left DestinationY = MyDestinationObject.Top return SourceX, SourceY, DestinationX, DestinationY; and here the function where I want to use these coordinates: def dragDrop(): getElectricGridDragDropCoordinates() Delay(200) t = tuple(#resultof getElectricGridDragDropCorrdinates ) SX = t[0] SY = t[1] DX = t[2] DY = t[3] MySourceObject = ImageRepository.Assets.ElectricGridConnection MySourceObject.Drag(SX,SY,DX + 1, DY + 1) Thanks a lot in advance :D!1.6KViews0likes6Comments