Notepad, automatically saving text, giving name received from user

Can you help me with this task, please:

Request two entries from the user - file name and text. Then open the notepad,
write the text obtained from the user and save this file with a name you
received from.
b) Treat the task so that if the user enters the name of an existing file, this old file overwritten by a new one.
Note: Develop tasks using the user interface, not systemically. This means that only click and fill-in activities are allowed, and not activities that are saved or saved. overwrite the file.

1 Like

Hi , Welcome to the Uipath community Forum

You can use ‘Input Dialog’ box activity for Text
Another input Dialog box activity for Filename
Take those values into 2 variables ex:Txtvar , nameVar
Now use ‘Write text file’ activity and in the ‘FIle name’ property give the path where you want to save the file and append the FIlename variable
“C/uipath/wofkflow/”+nameVar+".txt"

Now in the 'Input ’ property give ‘Txtvar’

Hi
welcome to uipath community
–use INPUT DIALOG BOX activity and get the output with a variable of type string named str_filename and mention the label as "enter the filename"
–again use another INPUT DIALOG BOX ACTIVITY and get the output with a variable of type string named str_text and mention the label as "enter the text"
–now use a IF condition like this to check whether the use has mentioned the already existing file name @Nastiaitsan
Directory.GetFiles(“yourfolderpath”,"*.txt").Contains(str_filename.ToString)
if true it will go to THEN part where we can use
Delete activity and mention the file path as
"yourfolderpath"+"\"+str_filename+".txt"
followed by this use WRITE TEXT FILE activity and mention the file path as str_filename.Trim(".txt")+".txt" and input as str_text.ToString

or
if the condition is false it will go to ELSE part where we can use directlly the WRITE TEXT FILE activity and mention the file path as str_filename.Trim(".txt")+".txt" and input as str_text.ToString

kindly try this and let know for any queries or clarification
Cheers @Nastiaitsan