Guys please help, I have unique doubt?

excel
uiautomation
orchestrator
activities
studio

#1

Greetings all,

I am having certain task where I need to do the following task.

-saving certain value “I like uipath” in a certain .txt file and save that file on the desktop with the name “uipath.txt”

-similarly create a many files with unique names such as (uipath1.txt), (uipath2.txt),(uipath3.txt). and so on…

I just want to do this without trying out every name ie:=uipath1,uipath2,uipath3,etc

  • like the unique name has to becreated on the first attempt itself.

  • there shouldnt be message like (sorry this file already exist) and no attemmpt to try the same name for multiple attempts.

Thanks and reagrds,
Error.


#2

@Error
Creat using the datetime stamp so that every time a unqiue number is appended to your file name.


Creating file with unique name without attempting to do it with every file?
#3

Well, ummm,
that was short detail.
Sorry but i didnt get that . ]
Can you please elaborate?


#4

@Error create txt file with name value to “uipath”+DateTime.Now.ToString()+".txt"


Creating file with unique name without attempting to do it with every file?
#5

Hey there, thanks it gave me some idea.
But while i tried creating certain file using this method,

I got an error saying that the given filename does not exist…


#6

If You have files like you described: uipath1,uipath2,uipath3 or any other, which You would like just to increase last number, You can use this expression:

Directory.GetFiles(“path”).Select( Function(w) Regex.Match(w.ToString,"\d+").Value ).Max

It return the gratest number of file, e.g. if You have files uipath1,uipath2,uipath3, it will returns “3”.
It’s a string type and You just have to change “path” value for any full path You want.
Then in creating new file just increase this number by 1.


Creating file with unique name without attempting to do it with every file?
#7

writetxtfile.xaml (6.1 KB)
try this


Creating file with unique name without attempting to do it with every file?
#8

Well I didnt really understand what exactly am i supposed to do.
Can you please provide me with the workflow if possible.


#9

@pathrudu
@priyanka.yadav18
@KatKon
@sictpeng
@12scs169

Hey guys,
check this out.
I am attaching my zip file.
please have a look at the workflow and let me know if you guys have some interests.

I tried using date time stamp but discovered that a new file cannot be created with the file name containing the datetime stamp.

Please have a look at it.

DesktopAutomation.zip (1.1 MB)


#10

what do you mean by this?


#11

CreatingFile.xaml (5.6 KB)

If You have in folder files: UiPath1, UiPath2 and UiPath3, it will create UiPath4.

This example won’t work if You will have any other digits in path except of number of file. If You need it, You can improve it by changing regex - I mean “\d+” part.

P.S. Change the path


Creating file with unique name without attempting to do it with every file?
#12

datetime stamp.