Micro Focus QTP (UFT) Forums
Draging a file from one folder and droping it onto the exe in another folder - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Draging a file from one folder and droping it onto the exe in another folder (/Thread-Draging-a-file-from-one-folder-and-droping-it-onto-the-exe-in-another-folder)



Draging a file from one folder and droping it onto the exe in another folder - TaranVohra - 05-17-2012

Hi ,
i want to know how can i select ,then Drag a CSV file from one folder over the exe placed in another folder


RE: Draging a file from one folder and droping it onto the exe in another folder - ravi.gajul - 05-21-2012

Hi Taran,
In order to achieve drag and drop, we shall use "Mercury.DeviceReplay" Object.Please see the example below for your reference
Code:
with Browser("..").Page("...r")    

x1=.WebElement("innerhtml:=TextBox").GetROProperty("abs_x")+10
h=.WebElement("innerhtml:=Text Box").GetROProperty("height")
y1=.WebElement("innerhtml:=Text Box").GetROProperty("abs_y")+h-10

end with

Set oDeviceReplay=CreateObject( "Mercury.DeviceReplay" )
oDeviceReplay.DragAndDrop x1,y1,x2,y2, LEFT_MOUSE_BUTTON
where
(x1,y1)=drag point
(x1,y2)=drop point



RE: Draging a file from one folder and droping it onto the exe in another folder - TaranVohra - 09-11-2012

Hi ...
i am actually interested in Dragging a File from one folder (C:\Newfolder) to say (D:\NewFolder)...

i am working on a Desktop application which requires an excel file to be dragged and dropped on an EXE of the app...

please help with this


RE: Draging a file from one folder and droping it onto the exe in another folder - freeboynil - 09-11-2012

My suggestion is Open the C:\Newfolder excel sheet and save it in the location of D:\Newfolder then delete the file in c:\Newfolder.

Code:
set ExcelObj = CreateObject("Excel.Application")
set oBook = ExcelObj.Workbooks.Open("C:\Newfolder.xls")
ExcelObj.Application.Visible = True
Excelobj.ActiveWorkbook.saveas "D:\newfolder.xls"
Excelobj.quit

next delete the c folder workbook