SAP-Forum.ORG
   
This web site isn't affiliated with, sponsored by, or approved by SAP AG. Is only a SAP users community.

Go Back   SAP-Forum.ORG > SAP Forums > SAPScript - Smartforms

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sap gui 7.20 macropus SAP Manuals 0 12-16-2010 03:42 AM
Windows SAP Gui 7.20 - configure logon pad Zumba SAP BASIS 1 08-20-2010 02:02 PM
Sniffing SAP GUI Passwords? Rima SAP BASIS 2 07-08-2010 05:37 PM
How to find information for SAP GUI Pepa SAP BASIS 2 06-21-2010 05:29 PM
SAP Gui hangs Golfi SAP BASIS 4 06-06-2010 03:59 PM

Aprenda SAP!
Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2011, 12:23 AM
SAPMM SAPMM is offline
Senior Member
 
Join Date: May 2010
Location: Virginia
Posts: 238
Default SAP GUI Scripting - Parse GuiUserArea, scrollbar limits

Hello Gurus,

I'm trying to automate certain changes in RZ20 configuration.

The idea is to parse the monitoring tree area (a GuiUserArea consiting of an array of labels and two scrollbars) and perform a series of actions wen some text is found.

The problem is that we have to scroll to access the whole area and I do not know any references to stop the scrolling. GuiScrollbar Object refers only to the movible part of the scrollbar: Maximum refers to the limit of the mobile part and PageSize refers to the amount of lines scrolled.

I would need some property such as "MaxPosition" but, according to the API documentation, there is no such property:

Code:
For $i = 0 To $session.findById("wnd[0]/usr" ).VerticalScrollbar.MaxPosition Step $step_v
	For $j = 0 To $session.findById("wnd[0]/usr" ).HorizontalScrollbar.MaxPosition Step $step_h
		$session.findById("wnd[0]/usr" ).VerticalScrollbar.Position = $i
		$session.findById("wnd[0]/usr" ).HorizontalScrollbar.Position = $j
		For $k = 0 To $session.findById("wnd[0]/usr" ).Children.Count - 1
			If StringInStr($session.findById("wnd[0]/usr" ).Children.ElementAt($k).Text, $search, 1) > 0 Then
				$session.findById($session.findById("wnd[0]/usr" ).Children.ElementAt($k).Id).SetFocus
				_Processing()
				$session.findById("wnd[0]/tbar[1]/btn[5]" ).press
			EndIf
		Next
	Next
Next

Has anyone faced this issue?

My SAPGUI version is 7200.3.7.1066 (7.20 SP7) and the SAP system is a Solution Manager 7.0

Thanks in advance.
Best regards,
SAPMM
Reply With Quote
Sponsors
  #2  
Old 08-20-2011, 12:25 AM
Portal Portal is offline
Senior Member
 
Join Date: May 2010
Location: Miami
Posts: 791
Default Re: SAP GUI Scripting - Parse GuiUserArea, scrollbar limits

Hi SAPMM,

Sorry I cannot offer a simple idea with this but if I read your note right you are looking to know when you have reached the maximum position of the scrollbar. If there were not a simple property as you have explored then these are the 2 approaches I would take.

1) replace the For loops with do loops
Increment the scrollbars and perform your checks
use a try catch clause or on error goto to catch when the scroll has been exceded
Perform a check to see if the solution has finished if not reset and move on.

2)
uses the same approach but performs it upfront recording the position integer until it reaches the end
Then use these integers to control your For loops.

Hope this gives you some avenues to explore.

Regards,
Portal
Reply With Quote
  #3  
Old 08-20-2011, 12:28 AM
SAPMM SAPMM is offline
Senior Member
 
Join Date: May 2010
Location: Virginia
Posts: 238
Default Re: SAP GUI Scripting - Parse GuiUserArea, scrollbar limits

Hi Portal,

Thank you. Although your approach cannot be used because the setting of the scrollbar positiion beyond its limits does not trigger any exception, it does set the position in the limit, so the code will be:

Code:
$session.findById("wnd[0]/usr" ).VerticalScrollbar.Position=10000  ; value beyond scrollbar position limit
$v_limit=$session.findById("wnd[0]/usr" ).VerticalScrollbar.Position
$session.findById("wnd[0]/usr" ).HorizontalScrollbar.Position=10000 ; value beyond scrollbar position limit
$h_limit=$session.findById("wnd[0]/usr" ).HorizontalScrollbar.Position
 
 
For $i = 0 To $v_limit Step $step_v
	For $j = 0 To $h_limit Step $step_h
		$session.findById("wnd[0]/usr" ).VerticalScrollbar.Position = $i
		$session.findById("wnd[0]/usr" ).HorizontalScrollbar.Position = $j
		For $k = 0 To $session.findById("wnd[0]/usr" ).Children.Count - 1
			If StringInStr($session.findById("wnd[0]/usr" ).Children.ElementAt($k).Text, $busqueda, 1) > 0 Then
				$session.findById($session.findById("wnd[0]/usr" ).Children.ElementAt($k).Id).SetFocus
				_Process()
				$session.findById("wnd[0]/tbar[1]/btn[5]" ).press
			EndIf
		Next
	Next
Next
But is far neater (when working with small pages) to get the stop positions beforehand and store then in an array:

Code:
Dim $v_stops = StringSplit("0,41,82", ",")
Dim $h_stops = StringSplit("0,35", ",")
 
For $i = 1 To $v_stops[0]
	For $j = 1 To $h_stops[0]
		$session.findById("wnd[0]/usr" ).VerticalScrollbar.Position = $v_stops[$i]
		$session.findById("wnd[0]/usr" ).HorizontalScrollbar.Position = $h_stops[$j]
		For $k = 0 To $session.findById("wnd[0]/usr" ).Children.Count - 1
			If StringInStr($session.findById("wnd[0]/usr" ).Children.ElementAt($k).Text, $busqueda, 1) > 0 Then
				$session.findById($session.findById("wnd[0]/usr" ).Children.ElementAt($k).Id).SetFocus
				_Process()
				$session.findById("wnd[0]/tbar[1]/btn[5]" ).press
			EndIf
		Next
	Next
Next
Regards,
SAPMM
Reply With Quote
Entre a los Links relacionados
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 10:20 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Forum Design By inferno