Tag Archive: custom code



Sometimes there might be a requirement to keep some files in the LG machine for temporary use. Have the file included in the script which needs to be copied to LG machine. Use the below mentioned commands to create a temporary folder inside c:\temp folder and copy the file from script folder to newly created folder in LG machine. Once the use of file is completed, use the last command to delete the newly created folder. Char command1[]=”mkdir \”c:\\temp\\\ext_jar”;

Char command2[]=”xcopy /Y filename.pdf \”c:\\temp\\\ext_jar\””;

Char command3[]=”RD /S /Q \”c:\\temp\\\ext_jar\””;

System(command1);

System(command2);

Lr_think_time(5);

System(command3);

Advertisements

Note: checkboxvalueRaw is the list of correlated values which is being listed in the check boxes. It has to be checked in random numberr and submitted.

int i, j;

char checkboxvalue_param[100],temp_param[60], temp1_param[60];

web_reg_save_param(“checkboxvalueRaw”,”LB=XXXXX”,”RB=YYYYY”,”ORD=ALL”,”Notfound=warning”,LAST);

          i=1;

          j=(rand()%(atoi(lr_eval_string(“{checkboxvalueRaw_count}”)))+1);

          lr_output_message (“i is %d, j is %d”, i,j);

          do     

                   {        sprintf (checkboxvalueRaw_param, “{checkboxvalueRaw_%d}”, i);

                             lr_save_string(lr_eval_string(checkboxvalueRaw_param), “checkboxvalue_sel”);

                             strcpy(temp_param, temp1_param);

                             strcat(temp_param, lr_eval_string(“{checkboxvalue_sel}”));

                             if (i<j)

                             {

                                      strcat(temp_param, “,”);

                             }

                             strcpy(temp1_param, temp_param);

                             i=i+1;

                   }

                   while (i==j);

lr_save_string(lr_eval_string(temp_param), “checkboxvalue_sel”);


char newvalue[15]=”I Love India”;

long pfile;

char *filename = “C:\\Sample.txt”;

pfile = fopen( filename,”a+” );

if(pfile == NULL)

{

printf( “Error in opening the filename – %s “,filename );

}

fputs(newvalue,pfile );

fputs( “\n”,pfile );

fclose( pfile );