Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

VBS skip code when check box missing

Former Member
0 Kudos

Hi,

I have a problem with check box which is not always available.

When this check box is present it should be unchecked and then should be pressed ENTER. This will unlock some additional fields which subsequently will be edited.

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP/tabpT\05/ssubSUBSCREEN_BODY:SAPLV60F:4203/chkRV60F-KFREL").selected = false

session.findById("wnd[0]").sendVKey 0

Then is the script which edit available fields

s=0

Do

If session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP/tabpT\05/ssubSUBSCREEN_BODY:SAPLV60F:4203/tblSAPLV60FTCTRL_FPLAN_TEILFA/ctxtFPLT-FKSAF[10,0]").text="A" Then _

          session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP/tabpT\05/ssubSUBSCREEN_BODY:SAPLV60F:4203/tblSAPLV60FTCTRL_FPLAN_TEILFA/ctxtFPLT-AFDAT[0,0]").text= sht.cells(i,11).Text

          session.findById("wnd[0]").sendVKey 0

s=s+1

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP/tabpT\05/ssubSUBSCREEN_BODY:SAPLV60F:4203/tblSAPLV60FTCTRL_FPLAN_TEILFA").verticalScrollbar.position = s

Loop Until session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP/tabpT\05/ssubSUBSCREEN_BODY:SAPLV60F:4203/tblSAPLV60FTCTRL_FPLAN_TEILFA/ctxtFPLT-FKSAF[10,1]").text=""

I need to modify the script to skip first two rows( checkbox and "Enter") when chech box does not exist and to continue from s=0.

I will be very thankful if you advise me how to solve this problem.

Regards,

Guero

1 ACCEPTED SOLUTION

script_man
Active Contributor
0 Kudos

Hi Guero,

You could try this:

. . .

on error resume next

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP/tabpT\05/ssubSUBSCREEN_BODY:SAPLV60F:4203/chkRV60F-KFREL").selected = false

if err.number = 0 then session.findById("wnd[0]").sendVKey 0

on error goto 0

. . .

Regards,

ScriptMan

2 REPLIES 2

script_man
Active Contributor
0 Kudos

Hi Guero,

You could try this:

. . .

on error resume next

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP/tabpT\05/ssubSUBSCREEN_BODY:SAPLV60F:4203/chkRV60F-KFREL").selected = false

if err.number = 0 then session.findById("wnd[0]").sendVKey 0

on error goto 0

. . .

Regards,

ScriptMan

0 Kudos

Hi ScriptMan,

It works perfect.Thank you!

As I am new with scripting I thought that the script after on error resume next is performed only in case of error but it seems its not true.

Regards,

Guero