WinActor

2020.10.16
SampleScenarios File
Sample scenario for addition date to the file name of the specified file and moving to the specified folder

This is a sample scenario that uses File-Library of WinActor(OR-5200) to add a date to the file name of the file specified by the full path and move it to a folder specified by the full path. (hereinafter referred to as this sample scenario)
*Please see this precautions upon downloading this sample scenario.

Feature

This sample scenario executes following process.

Extract the file name from the full path of the specified file.
Combine the full path of the specified folder with the extracted file name and date, and then generate the full path of the moved file.
Move the file to the generated full path.

WinActor(OR-5200) Modules to use

In this sample scenario, the following WinActor(OR-5200) modules are used.

  • 07_StringOperation/02_Split_Extraction_Deletion/Split_SplitString.ums6
  • 08_Date/GetDate(Year_Month_Day).ums6
  • 13_File/02_FileOperation/FileOperation_MoveFile.ums6

Operating Environment

The operation of this sample scenario was confirmed in the following environment.

  • Windows 10
  • OR-5200 6.1.0, WinActor 7.1.1

How to use

Create a scenario to be executed after waiting,

STEP1 Load this sample scenario


Extract the downloaded ZIP file. Load this sample scenario contained in the expanded folder with WinActor(OR-5200). For the expanded files, refer to File Structure.

STEP2 Set the variables required for operation

Update the values required to execute this sample scenario in the variable list. Before executing this sample scenario, set the following two variables.

  • SourceFileName
    • Specify the file name of the file to be moved with the full path.
      Example) C:\winactor\abc.txt
  • DestinationFolderName
    • Specify the folder name of the folder to be moved the file with the full path.
      Example) C:\winactor\temp
input.png

Variable display screen

STEP3 Execute this sample scenario

Start executing this sample scenario. This sample scenario will end when the file is moved to the specified folder.

STEP4 Complete the sample scenario

When the execution of this sample scenario is completed, SourceFileName has been moved to DestinationFoledeName. In the case of Step2 example; "C: \ winactor \ abc.txt" => "C: \ winactor \ temp \ yyyymmdd_abc.txt". "yyyymmdd" is the date of execution.

Trouble shooting

In this sample scenario, an error message will be displayed if a file name or a folder name is specified incorrectly.

See the error message list for more information.

Explanation

This section describes the implementation technique used in this sample scenario.

Extract the file name from the full path

In this sample scenario, just file name is extracted from the full path.

description1.png
applicable parts


The extraction method in this sample scenario will be explained using the following file path as an example.

  • C:\winactor\test\sample.txt

In the case of the example of the above file path, the file path is specified by combining some folder names and a file name with "\".
It is consisted of the following four elements, and the file name is always placed at the end of the file path.

  • C:
    folder name
  • winactor
    folder name
  • test
    folder name
  • sample.txt
    file name

The file name in the file path is a rule that the file name is always placed at the end of the file path.
Using this rule, the file name is extracted by "Split_SplitString" of the String Operation operation library in this sample scenario.

In the "Split_SplitString" library, it is a library that divides the "Split_source_string" by the "Delimiter_character"
and specifies the number of information to be acquired from the division result by the "index".
Furthermore, the number of divided elements will be acquired as the "divided size"

By specifying "File path" as "Split_source_string", "\" as "Delimiter_character", and "What number is the last element" as "index" in this library,
just the file name is available to acquire.

However, in the current WinActor(OR-5200) library, it has no library to acquire the value "what number is the last element"
Therefore, so execute the "Split_SplitString" library once in the same way, and set "file path" as the "Split_source_string"

In the above example, it is acquired a value of "4" as the "Segmentation_size"
After that, it is specifed "what number is the last element" and then will be executed "Split_SplitString"

At this time, "what number is the last element" is specified by the index of the programming array, thus it is one smaller than the actual size.
Therefore, it sets the value obtained by subtracting 1 from the division size. In the above example, it sets "3".

Combine multiple values

In this sample scenario, multiple values are combined by "Set_Variable" in node.

description2-1.png
applicable parts

  • %DestinationFolderName%\%ObtainedDate%_%Original file name%
    In the above example, the following five variable values are combined;
    "Move_to folder name" , "\", "acquired date" , "_", and "OriginalFileName"
    It is available to refer to a variable as a character string by writing "%variable name%"

description2-2.png
Example of variable setting

Track changes

VersionDateDetails
1.0 10/08/2020 First edition