Find Files Modified Since Yesterday

This process prompts the user to select a folder and then displays a list of files in the folder that have been modified since yesterday.

Display.SelectFolder Description:'Please select a folder to search for files that were modified since yesterday.' \
                    InitialDirectory:'' \
                    IsTopMost:False \
                    SelectedFolder=> SelectedFolder \
                    ButtonPressed=> ButtonPressed
#Checks if the user pressed the OK button. If not (i.e if the user pressed the "Cancel" button), the main body of the Process will not be executed.

if ButtonPressed='OK' then
    #Retrieve the current date and subtract 1 day to calculate yestaday's date

    DateTime.Current DateTimeFormat:DateTime.DateTimeFormat.DateOnly \
                        Offset:'0' \
                        CurrentDateTime=> CurrentDate
    DateTime.Add DateTime:CurrentDate  \
                        TimeToAdd:-1  \
                        TimeUnit:DateTime.TimeUnit.Seconds \
                        ResultedDate=> YesterdaysDate
    #The next action creates a temporary file where the paths of the modified files will be stored.

    File.GetTempPath TempFile=> TempFile

    Folder.GetFiles Folder:SelectedFolder  \
                        FileFilter:'*' \
                        IncludeSubfolders:True \
                        FailOnAccessDenied:True \
                        SortBy1:Folder.SortBy.NoSort \
                        SortDescending1:False \
                        SortBy2:Folder.SortBy.NoSort \
                        SortDescending2:False \
                        SortBy3:Folder.SortBy.NoSort \
                        SortDescending3:False \
                        Files=> AllFilesInFolder
    #The next action loops though all the items of the "AllFilesInFolder" variable (which contains a list of files).

    #In each iteration, the current item (file) of the list will be stored into the variable "item"

    loop foreach item in AllFilesInFolder

        if item.LastModified >= YesterdaysDate then
            File.WriteText File: TempFile  \
                        TextToWrite: item+' modified on '+item.LastModified  \
                        AppendNewLine:True \
                        IfFileExists:File.IfFileExists.Append \
    #Runs the notepad application, with the temporary file's path as a command line argument. Ths means that the temporary file will be opened through notepad.

    System.RunApplication ApplicationPath:'notepad'  \
                        CommandLineArguments:TempFile \
                        WorkingDirectory:'' \
                        WindowStyle:System.ProcessWindowStyle.Normal \
                        ProcessId=> ProcessId

Display.ShowMessage Title:'Process Completed!' \
                    Message:'Example "Find Files Modified since Yesterday" completed.' \
                    Icon:Display.Icon.None \
                    Buttons:Display.Buttons.OK \
                    DefaultButton:Display.DefaultButton.Button1 \
                    IsTopMost:False ButtonPressed=> ButtonPressed