I'm trying to automate my SAP GUI until the end of the page and I got the code below from this site https://www.appsloveworld.com/vba/200/144/algorithm-for-finding-end-of-a-list-sap-gui
I only changed the text after findById but I get this error at the line which changes verticalScrollbar.Position:
object doesn't support this property or method
Any ideas on how to solve that?
Do While Not blank
If session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").Text = "" _
Then blank = True
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").verticalScrollbar.Position = i
i = i + 1
Loop
Related
I am trying to get some data from google map with VBA to extract in to excel. as I am not expert in VBA so facing some problem. in side google map, if we scroll to down there are some web result links coming in script. I want to extract that link if possible. here I try from my end but not getting actually result what I want
here is screen shot for web result of google map url
also here I some code which I try but not success
Public Sub GmapData()
'On Error Resume Next
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "https://g.page/MiguelLopezSalon?share" ' try with first URLS and second
Do
DoEvents
Loop Until ie.readystate <> 4
Application.Wait (Now + TimeValue("00:00:15"))
Dim MyData As New MSForms.DataObject
MyData.GetFromClipboard
For N = 0 To ie.document.getElementsByClassName("ugiz4pqJLAG__primary-text gm2-body-2").Length - 1
If ie.document.getElementsByClassName("ugiz4pqJLAG__primary-text gm2-body-2").Item(N).innerText = "About this data" Then
ie.document.getElementsByClassName("ugiz4pqJLAG__primary-text gm2-body-2").Item(N).ScrollIntoView (False)
End If
Next N
Application.Wait (Now + TimeValue("00:00:05"))
GMD = ie.document.getElementsByClassName("trex").Item(0).innerHTML ' facing error here
ActiveSheet.Cells(1, 1).Value = GMD
End Sub
I try to google on my issue.. then found its a iframe inside html.. also try with following code line but still not get result
ie.document.getElementsByTagName("iframe")(0).document.getElementsByClassName("trex").Item(0).innerHTML
Please anyone can me help out. to extract data within Ifram
When I open a T-Code from SAP GUI, some of the fields are pre-populated from past queries. Is it possible to enter a T-Code and all the fields in the next window to be forced blank?
I develop scripts for SAP GUI and run into problems if fields already have content from prior queries.
The history cannot be disabled user-wise. Period.
Either all or nobody.
If you want to disable the history go to SAPgui options into Local data setting
The history in Windows is a simple Access MDB file but it is password-protected, so you may try to crack it and delete only your user lines but it is a bunch of work.
However, I guess the history that makes you crazy is not what I described above, but SPA/GPA parameters. Check it first
You can empty some fields with :
""
session.findById("wnd[1]/usr/ctxtRMMG1_REF-BWTAR").Text = ""
But doesn't work all the time...
My method for this is to loop through all the fields (and recursively on all children elements) and set the text value of them to an empty string.
On read-only fields it throws an error and this is why "On Error Resume Next" is necessary.
Sub Start_Clearing()
'setup SAP
If Not IsObject(SAPApplication) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set SAPApplication = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = SAPApplication.Children(0)
End If
If Not IsObject(Session) Then
Set Session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject Session, "on"
WScript.ConnectObject SAPApplication, "on"
End If
Dim UserArea As Object
Set UserArea = Session.findByID("wnd[0]/usr")
Clear_Fields UserArea
End Sub
'_______________________________
Sub Clear_Fields(Area As Object)
Set SAPApplication = GetObject("SAPGUI").GetScriptingEngine
Dim Obj As Object
Dim NextArea As Object
On Error Resume Next
For i = 0 To Area.Children.Count - 1
Set Obj = Area.Children(CInt(i))
If Obj.ContainerType = True Then
If Obj.Children.Count > 0 Then
Set NextArea = SAPApplication.findByID(Obj.ID)
Clear_Fields NextArea
End If
End If
Obj.Text = ""
Next i
End Sub
I am using wkhtmltopdf tool-kit to convert my webpage to PDF. The code is working fine and it is also creating the PDF perfectly but the code below
Dim process = New Diagnostics.Process()
process.StartInfo.UseShellExecute = False
process.StartInfo.CreateNoWindow = True
process.StartInfo.FileName = wkhtmltopdfLocation
process.StartInfo.Arguments = htmlUrl + " " + pdfSaveLocation
process.Start()
process.WaitForExit(500)
enters a never ending loop. I have rechecked my code and this code does not belong to any loop and there is no unhandled loop in my code either. But this piece of code keeps creating a new process over and over again and does not stop till I stop debugging the project. I'd really like to know what am I doing wrong over here.
Thanks.
Using QRCode.net assembly to generate QRCode images for URLs, I've tried most of the properties / options available and the URLs first character is always replaced with an asterisk (*). As the QRCode text is to be a URL, this means that some QRCode reader apps don't recognise my QRCode as a valid URL. For now, I pad the URL with a ' ' space so you at least get '*http://myapp.com', instead of '*ttp://myapp.com', but this always happens..
QRCode.Net on CodePlex
Has anyone seen this before, or know which setting stops it, I've tried most, here's my code:
Dim iee As New ImageEncoder()
iee.AutoConfigurate = True
iee.ECI = -1
iee.Encoding = 4
iee.Fnc1Mode = 0
iee.ErrorCorrectionLevel = 0
iee.Version = 1
iee.ProcessTilde = False
iee.MarginSize = 10
iee.ModuleSize = 6
iee.StructuredAppend = False
iee.StructuredAppendCounter = 0
iee.StructuredAppendIndex = 0
iee.TextData = " http://myApp.com/?querystringdata=here")
Dim image As Bitmap = iee.Encode2Image()
Dim tempSitePath As String
tempSitePath = HttpContext.Current.Server.MapPath(HttpContext.Current.Session("dirTempPath"))
image.Save(tempSitePath + "loc_" + locid + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
This was bugged with them.. Ended up using a different library..
I found a demo library for QRCode.net.
http://www.codeproject.com/Articles/258779/Just-launched-new-open-source-project-QrCode-Net-a
This has downloadable source-code. I opened the solution, made a few changes to get the project to build and it created codes with no asterisk (*). I believe the demo code is older than this post, but perhaps the library has also been updated with a fix.
I'm working on executing the same code several times to produce a table. My first thoughts went out to using an array to do this.
Here is what i have got so far:
Dim iRow
iRow = 0
'alternate color for rows
Do While Not rsGlobalWeb.EOF
If iRow Mod 2 = 0 Then
response.write "<tr bgcolor=""#FFFFFF"">"
Else
response.write "<tr bgcolor=""#EEEEEE"">"
End If
'some other code
SqlBackup = "SELECT * FROM CMDBbackup WHERE Naam_Cattools = '" & rsGlobalWeb("Device_name") & "'"
Set rsBackup = Server.CreateObject("ADODB.Recordset")
rsBackup.Open SqlBackup, dbGlobalWeb, 3
'declaration of array
Dim fieldname(5),i
fieldname(0) = "Device_name"
fieldname(1) = "Image"
fieldname(2) = "Backup"
fieldname(3) = "Uptime"
fieldname(4) = "Processor"
fieldname(5) = "Nvram"
For i = 0 to 5
If rsGlobalWeb(fieldname(i)) <> "" Then
response.write("<td>" & rsGlobalWeb(fieldname(i)) & "</td>")
Else
If Not rsBackup.EOF Then
If Not IsNull(rsBackup(fieldname(i))) And (rsBackup(fieldname(i)) <> "") Then
response.write("<td>" & rsBackup(fieldname(i)) & " (backup)</td>")
End if
Else
response.write("<td>No data found</td>")
End if
End if
Next
response.write("</tr>")
iRow = iRow + 1
rsGlobalWeb.MoveNext
Loop
The issue i have now is that the following error occurs even tho i have friendly messages turned off:
"500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed."
The logfile shows the following:
"DaEngineSDB.asp |58|800a000d|Type_mismatch 80 -" Where the 58 is the line with the Dim Fieldname.
Without the array it does show the remainder of the code (i have 1 other field which gets added). If i remove the array and fill the fieldname(i) with a normal string value it also works fine.
I was trying out stuff that google says but after attempting several things i am still running up to a wall.
Any ideas what it could be?
Thanks in advance,
Erik
First you should turn on error displaying in your iis, or read the error log for its description, google it if not sure how.
Without error description, it's way too difficult to check what is wrong.
Problem solved!
After banging my head against the wall for a day i found out that i stupidly declared the array inside the DO WHILE loop. Moved the declaration out of it and problem solved.