aisingapore / TagUI

Free RPA tool by AI Singapore
Apache License 2.0
5.66k stars 585 forks source link

How to change download location path in TagUI - use hack to override #567

Closed ItsSandeepThota closed 5 years ago

ItsSandeepThota commented 5 years ago

Hi @kensoh

I am trying to download file from chrome using xpath. My TagUi was installed in C:\apps\TagUi

I am having my code in C:\apps\Codes, when i download the file my file is being downloaded in C:\apps\Codes. Can i change the download location to something like C:\Files.

Thanks in advance.

kensoh commented 5 years ago

Hi @sandeep14897 there are a few issues with the answer, one of them is - https://github.com/kelaberetiv/TagUI/issues/469

TagUI wasn't designed to change the download folder to another folder from the script folder, so the hack below will let users override the download location to their desired location. In this case I think flowpath can be replaced with C:\\Files. Make sure user account has write access to folder.

chrome_step('Page.setDownloadBehavior',{behavior: 'allow', downloadPath: 'flow_path'});

Another way, is after downloading, you can use the run step to run cmd / c move source target to move the file to the target folder, or if more adventurous can use JavaScript fs module that comes packaged with PhantomJS engine (used in TagUI) - https://phantomjs.org/api/fs/method/move.html

kensoh commented 5 years ago

Closing issue for now until further input

ItsSandeepThota commented 5 years ago

@kensoh . Thank you. That is working fine.

Can we convert any type of file to .pdf using tagui, without opening the file. My case is i will download a file from chrome (.pptx) and it should be converted back to pdf and upload the same .pdf file.

will that work out for me. Please, help me on this.

Thank you

kensoh commented 5 years ago

I'm afraid TagUI does not have built-in file conversion capabilities. You can find out how to do that using command-line tools available on the internet and use the run step to do that. Or maybe use some free online convertor and add some TagUI workflow to do that. Or maybe write TagUI workflow to do that using Powerpoint and export. Method is visual automation but very tricky. Best is find other command-line tools to do it.

kensoh commented 5 years ago

Also, for different issues, raise a new issue so other users can learn from your question.

ItsSandeepThota commented 5 years ago

Sure @kensoh . Thank you.

andyguins commented 3 years ago

Hi @sandeep14897 there are a few issues with the answer, one of them is - #469

TagUI wasn't designed to change the download folder to another folder from the script folder, so the hack below will let users override the download location to their desired location. In this case I think flowpath can be replaced with C:\\Files. Make sure user account has write access to folder.

chrome_step('Page.setDownloadBehavior',{behavior: 'allow', downloadPath: 'flow_path'});

Another way, is after downloading, you can use the run step to run cmd / c move source target to move the file to the target folder, or if more adventurous can use JavaScript fs module that comes packaged with PhantomJS engine (used in TagUI) - https://phantomjs.org/api/fs/method/move.html

Hey there! I've been trying to use this hack but everytime the flow downloads the file i need, it fails. The folder where it is supposed to save in is inside the same folder as the script. How can i make sure the user account has write access to folder? Thanks!

kensoh commented 3 years ago

Hi @andyguins to save in same folder as script, there is no need to use this hack because the default download behaviour is saving in the same folder as the script. However, if you need to change to another folder, you can now use the download to step here - https://tagui.readthedocs.io/en/latest/reference.html#download-to

andyguins commented 3 years ago

Hi @kensoh, what i meant was that the folder where i want to save the file is inside the same folder as the script.

C:/tagui/flows/rpa script location

C:/tagui/flows/rpa/filesfolder files location

Anyways, i tried the dowload to step but it kept saving the files on the same folder.

kensoh commented 3 years ago

Oic... Can you do tagui update to get the latest version of TagUI and then do below to see if it helps?

download to c:\tagui\flows\rpa\filesfolder

If it still does not work, can you attach the file tagui\src\tagui_chrome.log here to see if there is any error message from Chrome. The user will need write access to the folder to save there. If your user does not have write access you can pick another location where you for sure has write access, for eg your user Desktop folder.

andyguins commented 3 years ago

I solved it, the problem was that i wrote the download to step as the last step of the flow when i should have written at the beginning. It was a pretty dumb problem :P I realised when i read the tagui_chrome.log that you mentioned.

Thanks for your help Ken!

kensoh commented 3 years ago

No probs Andy! Yes it has to be before the actual download, otherwise the download would have happened at original folder.