APTS 3 Posted September 13, 2015 Report Share Posted September 13, 2015 It is almost 2016. What is currently the best method for typing a text filename into a windows Save As dialog? Here is my current code: click(<pid=87>,"Left Click","No") wait(.5) change checkbox(<id="rsAddMap">,"Checked") click(<id="rsPhoto">,"Left Click","No") wait(.5) click(<id="rsViewReport">,"Left Click","No") wait for element(<id="download">,30,"Appear") wait(.5) set(#url,$replace($url,"#",""),"Global") set(#pt1,"www.targetsite.com","Global") set(#pt2,$scrape attribute(<tagname="iframe">,"src"),"Global") navigate("{#pt1}{#pt2}","Wait") wait for element(<id="download">,30,"Appear") wait(10) click(<id="download">,"Left Click","No") comment("What can I do here to interact with the Save As dialog?" ) stop script The above code takes me as far as opening the windows Save As dialog box and specify a default file name. How do I specify my own filename and then click the enter button? Quote Link to post Share on other sites
django 1 Posted September 13, 2015 Report Share Posted September 13, 2015 you want own file name on popup window and automatically click on save button ? If i understand correctly then you can use Set Dialog Text and Click Dialog Button command Quote Link to post Share on other sites
APTS 3 Posted September 13, 2015 Author Report Share Posted September 13, 2015 Thanks for your suggestion django. Of course it makes sense to try what you are suggesting, but for some reason I am running into a problem. When I do: stop scriptafter, click(<id="download">,"Left Click","No")then the windows Save As dialog box will open after about 5 or 6 seconds. When I change stop script to wait(10) and then try to wait for the windows Save As dialog to open, it never does. Since the Save As dialog is not popping up, the plugin commands that follow cannot work. Here is the portion of my code that I am talking about:click(<id="download">,"Left Click","No")wait(10)plugin command("WindowsCommands.dll", "set dialog text", "Save As", "File name:", "blue.pdf")wait(5)plugin command("WindowsCommands.dll", "click dialog button", "Save As", "Save")stop script Any idea what I might be doing wrong? Thanks Quote Link to post Share on other sites
django 1 Posted September 14, 2015 Report Share Posted September 14, 2015 you can simply use this First Scrape download url set(#downloadurl,"http://www.orimi.com/pdf-test.pdf","Global")download file(#downloadurl,"{$special folder("Application")}\\yourfilename.pdf")stop script Quote Link to post Share on other sites
APTS 3 Posted September 14, 2015 Author Report Share Posted September 14, 2015 Thanks again for the reply django, but that is not going to work because there is no link directly to the PDF. The PDF is generated dynamically only when the download button is pressed. I already used your suggestion to scrape the fullhref and then try to save it: set(#url,$scrape attribute(<id="download">,"fullhref"),"Global")download file(#url,"{$special folder("Desktop")}\\TEST.zip") The problem is that the fullhref appears like this using the PDF.js web viewer: http://www.reports.targetsite.ca/pdfjs/web/viewer.html?file=%2FReport%2F%3FSessionID%3D62294da9-9e7f-4d12-8d64-ebc684083a66%26ReportID%3D246214%2C%26InvoiceID%3D430019%26InvoiceItemID%3D470627%26Type%3DBasic%20Report%26Agent%3D2%26NoImg%3Dfalse%26AddMap%3Dtrue As you can see from the above URL, there is no path to the PDF. The path uses the PDF.js web viewer to display a PDF based on the parameters passed in. I don't know how to save the PDF. My example code above only saves the PDF.js web viewer page, which does not render correctly when I try to display it after saving. Quote Link to post Share on other sites
Denethor 1 Posted March 20, 2017 Report Share Posted March 20, 2017 Did you ever find a solution to this? I am having the same issue. I think the real issue is you are trying to have UBot click on it's own Save As dialog. You would probably need to spawn a separate thread before clicking the download button that looked for the Save As dialog from the download button and filled in the file name and clicked Save. Quote Link to post Share on other sites
Denethor 1 Posted March 20, 2017 Report Share Posted March 20, 2017 I tried to replicate what you were trying to do.Did you simply try the "save downloaded file" browser command? wait(5)save downloaded file("C:\\Users\\SkyDrive\\Documents\\metrics.csv") Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.