RPA Express Script

variable
string

#1

How to get the data stored in a text file and store it in a string recorder variable using custom actions script?


#2

You can easily do it using this script

@CustomScriptAction(
output = 'text'
)

def customScript() {
    text = RString.of(Resource.read("path-to-file", "UTF-8"))
}

But we have a ready action for it in the action library - Read file. Is it not working properly for you?


#3

Thanks,
I just wanted to try with custom actions :slight_smile:


#4

:+1:
Hope you have fun using custom actions.
Feel free to write which custom actions you are interested in implementing.


#5

Hey how do i slice a string in custom actions. I am getting an error saying
’You tried to use a map entry for an index operation, this is not allowed. Maybe something should be set in parentheses or a comma is missing?’


#6

Could you post your code here to have a look?


#7

I am able to run the code now. I was using a different syntax for slice and i corrected it . It works fine now.

Thanks.