Issues with Monitor Events & Append Range

datatable
excel
studio
userevents

#1

Hey There,
I’ve been working with Monitor Events.
Use Case:
Monitor the system desktop for click or keypress event & count the occurence of each & write it out to Excel file.

So,
For Monitor Events, I’ve used a Parallel activity – One for Click Trigger, One for System Trigger (chose Keyboard only). Each time i click or hit a key, ideally a counter increments & current timestamp is noted. This along with a string(whether its a click or key press) is written in excel.

My problem lies with appending the data to excel with the build data table, add data row activity & append to excel.
I think append makes sense as after each click an entry is added to excel, but thats somehow not working.
Attaching my workflow here. Please someone help.

Main.xaml (20.1 KB)


#2

The problem seems to be with Add Data Row activity i suppose. It has nothing added to the datatable & its not adding anything to Excel file. How can i fix this. Also, is there a way i can directly insert an array to the excel file?


#3

You could use the Generate Data Table with separators for column values to convert prepared string into a DataTable and then append it to your Excel.

Another remark is that I wouldn’t use the Excel Scope for this as it will be faster to use the Append Range under System->File->Workbook activities.

Also, I am not super familiar with the Parallel activity, but wouldn’t it cause an issue when UiPath tries to access the same file at the same time when a click and a keyboard action takes place in quick succession?


#4

@sandhya.dev01 check whether array consists of values by print them before using add Data row activity.


#5

@Manjuts90 Well, i did that already. it logs the individual array elements, but the same “arrayVariable” in Add Data Row activity(in the attached workflow) isnt populating.


#6

@loginerror … I tried using Excel Append Range as well as Workbook Append Range. Also used Write Range(which seems to work fine but that’s not hat i’m trying to achieve).

I’m new to parallel activity too, but it seems to be working fine so far :slight_smile: just that i haven’t completed that side of the workflow & it’ll have same activities. So that’ll be okay once i figure out this excel append.

Again, tried using Generate Data Table as well, but didn’t quite understand how to give separators because one of my column value is “Mouse Clicks” which has a space, and that doesnt seem to work. Plus, its used for Screen Scraping activity right?


#7

@sandhya.dev01

Check out the attached workflow:
AppendRangeFromString.zip (8.0 KB)

You will see that with a simple, unique separator you can use the Generate Data Table activity to feed data into the Excel.

The spaces are indeed a problem, but if you use two dashes -- without the extra spaces around them (as I did in the example workflow), it will separate the columns the right way.


#8

@loginerror Many Thanks :relaxed: … I’d tried almost everything simple to complicated, and it was this simple …