RDP - scripting (512 Views)
Reply
Valued Contributor
Nan_Raso
Posts: 46
Registered: ‎04-15-2013
Message 1 of 3 (512 Views)
Accepted Solution

RDP - scripting

Hello Friends,

               I have come across the scenario, while doing LR scripting with RDP protocol. 

 

My question: 

Is it possible to write the condition statement in RDP scripting? like if some rdp_sync_on_image fails do something within if loop. I have read something, that rdp_sync_on_image will return LR_PASS if it pass, or LR_FAIL if it fails.

 

So is it possible to get those LR_PASS/LR_FAIL and do the conditional formatting?

 

or is there any other way so I will capture image and compare with some image? 

please let me know if any way or suggestion for the above scenario.

 

Please do let me know if any informtion is needed from my side.

Really appreciate your help!!!

 

Thanks.

Nan Raso.

 

Thanks,
Nan Raso
Valued Contributor
Nan_Raso
Posts: 46
Registered: ‎04-15-2013
Message 2 of 3 (498 Views)

Re: RDP - scripting

Hello Friends, 

I have tried something as below, but shows some error.

 

Code :

rdp_save_image("StepDescription=Test_save",
"FileName=c:\\temp\\Test_save",
"ImageTop=559",
"ImageLeft=629",
"ImageHeight=40",
"ImageWidth=107",
"Origin=Default",
RDP_LAST);

 

if(rdp_sync_on_image("StepDescription=Image Synchronization",
"WaitFor=Appear",
"Tolerance=Medium",
"Timeout=10",
"AddOffsetToInput=Default",
"FailStepIfNotFound=Yes", IMAGEDATA,
"ImageLeft=629",
"ImageTop=559",
"ImageWidth=107",
"ImageHeight=40",
"ImageName=Test_save",              // "ImageName=c:\\temp\\Test_save",

ENDIMAGE, RDP_LAST))

 

when i tried to execute, it show below error :

 

Virtual User Script started at : 2013-07-28 00:20:55
Starting action vuser_init.
vuser_init.c(14): Connecting to the RDP Server (host: "{Server}", userName: "{User}", domain: "{DOM}") was successful
vuser_init.c(23): Saving current screen snapshot to file 'c:\temp\Test_save'.
vuser_init.c(23): Saving image
vuser_init.c(32): Error: File not found "Test_save"    //Error: File not found "c:\temp\Test_save"
vuser_init.c(32): There was an error while synchronizing on image
Abort was called from an action.

 

 

When i check manaully in the directory, the exact file exists.

 

Please help me to sort this out. 

 

Gr8 Thanks !!

Nan Raso

 

Thanks,
Nan Raso
Valued Contributor
Nan_Raso
Posts: 46
Registered: ‎04-15-2013
Message 3 of 3 (464 Views)

Re: RDP - scripting

[ Edited ]

All, Thanks for your valuable time spending on my post. I came up with some idea, as below for the above situation.

 

CheckPoint = rdp_sync_on_image("StepDescription=Image Synchronization",
                                 "WaitFor=Appear",
                                 "Tolerance=Exact",
                                  "Timeout=20",
                                  "AddOffsetToInput=Default",
                                  "FailStepIfNotFound=No",
                                  IMAGEDATA,
                                  "ImageLeft=529", "ImageTop=207", "ImageWidth=308", "ImageHeight=313",                        "ImageName=sync_314.png", ENDIMAGE,
                                RDP_LAST);

 

//converting int to char
itoa(CheckPoint,CheckPoint_String,10);

 

//saving the "char" value to string

lr_save_string(CheckPoint_String,"CheckPoint_Value");

 

//using the string for comparison with "0"(LR_PASS)

 if (0==strcmp(lr_eval_string("{CheckPoint_Value}"),"0"))
        { 
             rdp_mouse_click("StepDescription=Mouse Click",
                                             "Snapshot=snapshot_315.inf",
                                             "MouseX=780",
                                              "MouseY=282",
                                              "MouseButton=LEFT_BUTTON",
                                             "Origin=Default",
                                              RDP_LAST);
        }

 

Feel free to leave to suggestions.

 

Thanks

Nan_Raso

Thanks,
Nan Raso
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.