chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Quintiq file version 2.0
#parent: #root
Method PTF_StartScriptExecution () id:Method_LibPTF_pnlTestRunner_PTF_StartScriptExecution
{
  #keys: '[102890.0.1865517405]'
  Body:
  [*
    // Serves as the entry point for script execution
    user              := ApplicationScope.Session().CurrentUser().ShortName();
    project           := ApplicationScope.Project().Name();
    fullpath          := this.PTF_GetScriptPath() + user + "_" + project + LibPTF::FileExtRunningScript();
    
    customCmdArgumentValue := CommandLine::Instance().StringArgument( "custom" );
    
    // If there is a custom defined path, we will use the custom defined path
    if( customCmdArgumentValue <> "" )
    {
      scripts := OS::ScanDirectory( this.PTF_GetScriptPath(), ".Qrunscript" );
    
      if( scripts.Size() = 0 )
      {
        MessageBox::Warning( ApplicationLibMacroPlanner, "There is no file with extension '.Qrunscript' in path " + this.PTF_GetScriptPath(), "&OK" );
      }
      else
      {
        fullpath := scripts.Element( 0 );
      }
    }
    
    isfile := OS::IsFile( fullpath );
    
    if( isfile )
    {
      file := OSFile::Construct();
      file.Open( fullpath, "Read", true );
      scriptText := file.ReadTextToEnd();
      file.Close();
    
      LibPTF_pnlTestRunner.PTF_ParseScript( scriptText );
    
      // Create start and end client log files with start client datetime
      this.PTF_WriteLogForStartEndClient( false );
    
      // Create empty action log files
      filename := vhResultLogPath.Value()
                  + ApplicationScope.Session().CurrentUser().ShortName()
                  + '_' + [String]ApplicationScope.Session().ClientId() + LibPTF::FileExtTempResult();
    
      fileactionlog := OSFile::Construct();
      fileactionlog.Open( filename, "Write", true );
      fileactionlog.Close();
      
      this.PTF_GUITimerStart();
    }
  *]
}