How to select latest file in file explorer and right click

I need to select latest generated file in the file explorer and perform right click on it.

I have filename already but by using Click Text activity, I am unable to select that file.
Here is my selector-

<wnd app='explorer.exe' cls='CabinetWClass' title='Reports' />
<ctrl automationid='System.ItemNameDisplay' idx='5' />

Reason I can see is “idx” which is dynamic in my case. By removing idx, it doesn’t work for me?

Any suggestion how to solve this issue?

@adoshi

May I know what you want to do after selecting that file ?

Actually that’s my OneDrive folder. I am generating Excel report in OneDrive. After selecting that report file, I need to right click and select ‘Share’ option of OneDrive and copy Report link. Later link will be shared in Email so Users can download and view the Report.

I am unable to find any shortcut key to share OneDrive file URL in Email.

I am able to solve this issue by using Search box in the file explorer but still struggling with ‘Share’ option in selection. I am able to record Click activity for Share but selector looks dynamic.

It looks like automationid is dynamic.

<wnd app='explorer.exe' cls='#32768' idx='*' />
<ctrl name='Context' role='popup menu' />
<ctrl automationid='31150' />

Any suggestion on how to select ‘Share’?

variableCreation = new FileInfo(“X:\Yourfilepath\YourFile.file”).CreationTime.ToString(“dd/MM/yyyy”)
gives you the creation date as (String)

For Each Activity
Go through all files > get creation date > add to collection

Invoke Activity with your List:
Method : Sort

Then get the Last value of your List.

PS: You dont need any Selectors in Fileexplorer just your path to the folder and get all files into a List.

@TastyToast But then how can I perform right click on it?
Can’t I use Search in file explorer to get only file name and perform right click on it? I already have filename.
Though I am still getting challenge in right click ‘Share’ option as it has dynamic selector.

Any suggestion would be much appreciated.

No Problem if your selector is not good:

Click Text Activity :
Selector should be a larger window where “Share” is in it.
Text: Share

Example (this is just a non-working how-to demo for windows explorer):


<wnd app='uipath.studio.exe' cls='HwndWrapper*' title='BlankProcess9 - UiPath Studio Pro Community' /><ctrl automationid='Ribbon' />

For example with this selector and “UI Explorer” as Text in Click Text Activity UiPath would find the exact selector of UI Explorer and click on it.

If you have a button with a unique text, your selector can be very wide.

You can use wildcards to replace uncertain elements with "

Here is my sequence:

  1. Search in WIN explorer search bar (working fine)
  2. Insert Filename in search (working fine)
  3. Right click on file and select ‘Share’ option (Right click is working but cannot select ‘Share’ option)

As per your comment I tried to change my selector but it doesn’t work -

<wnd app='explorer.exe' cls='*' idx='*' />
<ctrl name='Context' role='popup menu' />
<ctrl automationid='Share*' />

My actual selector is below but automationid is keep on changing -

<wnd app='explorer.exe' cls='#32768' idx='*' />
<ctrl name='Context' role='popup menu' />
<ctrl automationid='31150' />

How can I search for exact menu item in right click using click text? It doesn’t work for me.

Click Text Activity (not Click Activity):
Selector: <wnd app='explorer.exe' cls='*' idx='*' /><ctrl name='Context' role='popup menu' />
Text: Share

That should do the trick :slight_smile:

Thank you @TastyToast It worked but just a small question, in my case I have two menu items starting with ‘Share’; Share and Share with Skype.
By removing automationid, it clicks on ‘Share with Skype’ and not ‘Share’ which I want to be clicked.

image
This is my activity and selector but it clicks ‘Share with Skype’ -

<wnd app='explorer.exe' cls='*' idx='*' />
<ctrl name='Context' role='popup menu' />

@adoshi, this problem will come as you’ve made idx = * so first match will get picked by default, so possibly try to avoid using click activity… Use type into on this window. PFB

image

Use as many downs as required and pair that with enter!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.