<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Loop key in VBS script recording - Sap Gui in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaa-p/630676#M156346</link>
    <description>&lt;P&gt;Hi Mr Truong,&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;You could try the following: 
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;i = 0
do
i = i + 1
session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").setFocus
on error resume next
session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").key = " " &amp;amp; cstr(i)
if err.number &amp;lt;&amp;gt; 0 then exit do
on error goto 0
session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT6/ssubTABSTRIPCONTROL1SUB:SAPLMEGUI:1313/chkMEPO1313-ELIKZ").selected = false
loop

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Regards,&lt;/P&gt;
  &lt;P&gt;ScriptMan&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jan 2018 08:00:45 GMT</pubDate>
    <dc:creator>script_man</dc:creator>
    <dc:date>2018-01-29T08:00:45Z</dc:date>
    <item>
      <title>Loop key in VBS script recording - Sap Gui</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaq-p/630675</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;I have been record a Script to unlock delivery item for purchase order (PO) (.select=false) like image, but more PO different number item so i need your help.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/109245-1.png" /&gt;&lt;/P&gt;
  &lt;P&gt;This script works fine, but I need it to loop to the next Key and then continue looping until there are no more key.&lt;/P&gt;
  &lt;P&gt;REM HERE MY RECORD VBS*********************************&lt;/P&gt;
  &lt;P&gt;session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").&lt;STRONG&gt;setFocus&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST")&lt;STRONG&gt;.key = " 1"&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT6/ssubTABSTRIPCONTROL1SUB:SAPLMEGUI:1313/chkMEPO1313-ELIKZ").&lt;STRONG&gt;selected = false&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;REM END MY RECORD VBS***************************&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/109247-2.png" /&gt;&lt;/P&gt;
  &lt;P&gt;I would really appreciate it if someone could help me.&lt;/P&gt;
  &lt;P&gt;Many Thanks&lt;/P&gt;
  &lt;P&gt;Truong from Viet Nam&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jan 2018 16:10:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaq-p/630675</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-01-28T16:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Loop key in VBS script recording - Sap Gui</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaa-p/630676#M156346</link>
      <description>&lt;P&gt;Hi Mr Truong,&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;You could try the following: 
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;i = 0
do
i = i + 1
session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").setFocus
on error resume next
session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").key = " " &amp;amp; cstr(i)
if err.number &amp;lt;&amp;gt; 0 then exit do
on error goto 0
session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT6/ssubTABSTRIPCONTROL1SUB:SAPLMEGUI:1313/chkMEPO1313-ELIKZ").selected = false
loop

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Regards,&lt;/P&gt;
  &lt;P&gt;ScriptMan&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 08:00:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaa-p/630676#M156346</guid>
      <dc:creator>script_man</dc:creator>
      <dc:date>2018-01-29T08:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Loop key in VBS script recording - Sap Gui</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaa-p/630677#M156347</link>
      <description>&lt;P&gt;Thanks for your reply, ScriptMan&lt;/P&gt;
  &lt;P&gt;Your script is working really smooth but unfortunately your script just working "key 1" to "key 9", "key 10" to end not working&lt;/P&gt;
  &lt;P&gt;Can you help me?&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/108471-untitled.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 08:59:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaa-p/630677#M156347</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-01-29T08:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Loop key in VBS script recording - Sap Gui</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaa-p/630678#M156348</link>
      <description>&lt;P&gt;Hi ScriptMan,&lt;/P&gt;
  &lt;P&gt;base on your script, i code one more line same your script but i change some thing.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;i = 0
do until i &amp;gt; 10
i = i+1

session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").setFocus

on error resume next
session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").key= "   " &amp;amp; cstr(i)

if err.number &amp;lt;&amp;gt; 0 then exit do
on error goto 0

session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT6/ssubTABSTRIPCONTROL1SUB:SAPLMEGUI:1313/chkMEPO1313-ELIKZ").selected
= false

loop
REM ***********************************

i = 9
do 
i = i+1

session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").setFocus

on error resume next

session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").key= "  " &amp;amp; cstr(i)

if err.number &amp;lt;&amp;gt; 0 then exit do
on error goto 0

session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT6/ssubTABSTRIPCONTROL1SUB:SAPLMEGUI:1313/chkMEPO1313-ELIKZ").selected
= false

loop
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jan 2018 10:00:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaa-p/630678#M156348</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-01-29T10:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Loop key in VBS script recording - Sap Gui</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaa-p/630679#M156349</link>
      <description>&lt;P&gt; &lt;/P&gt;
  &lt;P&gt;No idea how many spaces it needs to be, but it could be work e.g. also like that.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;i = 0
do 
i = i+1

session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").setFocus

on error resume next
session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").key= right("   " &amp;amp; cstr(i), 4)

if err.number &amp;lt;&amp;gt; 0 then exit do
on error goto 0

session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT6/ssubTABSTRIPCONTROL1SUB:SAPLMEGUI:1313/chkMEPO1313-ELIKZ").selected
= false

Loop
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jan 2018 10:54:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaa-p/630679#M156349</guid>
      <dc:creator>script_man</dc:creator>
      <dc:date>2018-01-29T10:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Loop key in VBS script recording - Sap Gui</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaa-p/630680#M156350</link>
      <description>&lt;P&gt;Thank you very much ScriptMan.&lt;/P&gt;
  &lt;P&gt;Your script is really usefull with me.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 07:11:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-key-in-vbs-script-recording-sap-gui/qaa-p/630680#M156350</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-01-30T07:11:52Z</dc:date>
    </item>
  </channel>
</rss>

