A few days ago my pc was upgraded to Windows 7, since then however I can no longer use any scripts.
Sap version: SAP 720
When doubleclicking on a script or dragging a script onto SAP nothing happens at all.
When starting a script using for example the GuiXT code 'Image (Toolbar) img Start=Script' I immediately receive the following error:
This script (see below) should return the total number of rows in a grid and the number of rows selected.
The error always points to the line where GetObject("SAPGUI") is located, also in other transactions.
Apart from this I also don't have the 'Script development tools' anymore, which is apparently due to the missing of the windows agent. Is there a solution apart from installing this?
Can somebody help me resolve this?
The script
Dim rows
Dim aw
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
set session = application.ActiveSession
On error resume next
Set GRID1 = session.FindById("wnd[0]/usr/cntlCONTAINER/shellcont/shell")
Set GRID1 = session.FindById("wnd[0]/usr/cntlGRID1/shellcont/shell")
GRID1.setCurrentCell -1,""
selection = GRID1.SelectedRows
'Bereken aantal geselecteerde rijen
Dim selected
selected = 0
If selection<>"" Then
Dim start_pos, current_pos, reeks_pos, range, aantalKommas
'selection="1,3,5-10,12,15,20,21"
'selection="1,4,5"
'Initialize
start_pos = 1
range = 0
aantalKommas = 0
Do
current_pos = instr(start_pos , selection , "," , 1) '2
'msgbox "Current: " & current_pos
If current_pos<>0 Then
aantalKommas = aantalKommas + 1
'msgbox aantalKommas,,"Aantal komma's"
End If
reeks_pos = instr(start_pos , selection , "-" , 1) '6
'msgbox "Reeks: " & reeks_pos
If current_pos>reeks_pos And reeks_pos<>0 Then
under = Mid(selection,start_pos,(reeks_pos-start_pos))
upper = Mid(selection,reeks_pos+1,(current_pos-reeks_pos))
range = upper-under+range
'msgbox "Under: " & under & chr(13) & "Upper: " & upper & chr(13) & "Range: " & range
Else
If current_pos = 0 and reeks_pos <> 0 Then
under = Mid(selection,start_pos,(reeks_pos-start_pos))
upper = Mid(selection,reeks_pos+1,len(selection))
range = upper-under+range
End If
End If
start_pos = current_pos + 1
Loop While instr(start_pos , selection , "," , 1)<>0 Or instr(start_pos , selection , "_" , 1)<>0
'Msgbox aantalKommas+1+range,,"Aantal rijen"
selected = aantalKommas+1+range
End If
'Aantal rijen
rows = GRID1.RowCount
Msgbox "Totaal: " & rows & chr(13) & "Geselecteerd: " & selected, ,"Aantal Rijen"