Micro Focus QTP (UFT) Forums
How to create a script to save to the local disk. - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to create a script to save to the local disk. (/Thread-How-to-create-a-script-to-save-to-the-local-disk)



How to create a script to save to the local disk. - geethwind - 08-26-2009

I have an export button in my application which opens the local disk Save dialog box.

first time when i was recording i selected a specific path where i wanted to Save. and when i re-run, the script is failing at the selection, because from second time onwards the same folder will be the default one for saving.

So my question is how can i handle this? can i set the folder all the time to my preferred folder.

Any help is highly appreciated.

Here is my code

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Code:
fldr = "C:\LRP"
filespec = fldr &"\" & "LostProtectionData.xls "

If (fso.FileExists(filespec)) Then

    fso.DeleteFile(filespec)
    
end if


' Export the results to the local drive.

Code:
Browser("IBM WebSphere Portal").Page("IBM WebSphere Portal").WebEdit("fromDate").Set "08/05/2009"
Browser("IBM WebSphere Portal").Page("IBM WebSphere Portal").WebEdit("toDate").Set "08/11/2009"
Browser("IBM WebSphere Portal").Page("IBM WebSphere Portal").WebButton("Find").Click
Browser("IBM WebSphere Portal").Page("IBM WebSphere Portal_2").WebButton("Export").Click
Browser("Browser").Dialog("File Download").WinButton("Save").Click
Browser("IBM WebSphere Portal").Page("IBM WebSphere Portal_2").Sync
'Dialog("Save As").WinComboBox("Save in:").Select "LRP"  ' This code is failing in re-run..

Dialog("Save As").WinButton("Save").Click
Dialog("Download complete").WinButton("Close").Click



RE: How to create a script to save to the local disk. - Saket - 08-27-2009

Hi,
there must be an edit box for filename, you can directly set the required file path every time there.
e.g.
Code:
Dialog("File Download").Dialog("Save As").WinEdit("File name:").Set YourPath

Please see this for wrapping your post make it more readable


RE: How to create a script to save to the local disk. - geethwind - 08-29-2009

Thankyou Saket

This works perfectly fine.