on 07-02-2013 5:40 PM
Hello all this is the first time I have posting any question to any kind of forum so please excuse my ignorance of where to submit questions. This seemed like the best place for a VBScript question....
Ok so the company I work for uses SAP and has created several PDF step by step guides to help users through some processes. I have been tasked with converting some of these guides into scripts with the goal of saving time, reducing errors, etc...
I have been following the same pattern for each that I have converted... Record script to a .vbs file, edit file, submit users to use.
My question is whether or not there is a way to somehow capture as a string the ID of the element that currently has focus. I am trying to clean up the issue of parts not being fully or properly extended to other plants. The issue is that when I enter a part using MM01 I do not always enter at the same tab (I select all of them before entering.) My end goal is to have the script be able to determine which Material Master tab it is on when entering a part via MM01.
To accomplish this I noticed that no matter which tab you enter on the Material description box has the focus which in the case of the purchasing tab is accessed via:
session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP09/ssubTABFRA1:SAPLMGMM:2000/subSUB2:SAPLMGD1:2301/ctxtMARC-EKGRP")
What I want is to grab the "wnd[0]/usr/tabsTABSPR1/tabpSP09/ssubTABFRA1:SAPLMGMM:2000/subSUB2:SAPLMGD1:2301/ctxtMARC-EKGRP" portion of that. Then with a Left() and a Right() slice get the "tabpSP09" portion which would assist the script in orientating itself.
To do all of this I would need to be able to get the ID of the initially focused text box. I do not even know if this is something that can be done but I figured it couldn't hurt to ask.
I apologize for my long-winded explanation I wanted to be specific just in case there may even be a better way to reach my desired ends.
Thank you in advance for any help that may come my way.
'-Begin-----------------------------------------------------------------
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
ActID = session.ActiveWindow.GuiFocus.ID
MsgBox ActID
'-End-------------------------------------------------------------------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.