on 05-10-2013 1:04 PM
Hi,
I am writing a generic scripting tool with has a VBS syntax highlighting editor and runs sapgui scripts.
https://sourceforge.net/projects/lbscript/
But I am missing some functionality I would like it to have
Once a sapgui scripting session is open i would lile to be able to launch a VBS that the scripting recorder can record and attach to this session not a normal sapgui session
A normal recordgin looks like this
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
[etc.]
my script works like this (has a VBscript-like syntax as well ' are comments)
logon("/H/server/S/3201","800","user","password","en")
'send an okcode
'can use also sendokcode() and the text can be either an okcode, menu entry, or sapgui keypresses (ex. "/0" is enter)
send("/$tab")
'pop up a message with the status, in that case all buffers reset should appear
getstatus()
'a huge file containing all objects and children for the active window
dumpscreen("C:\Datos\SAP\Sapgui_Scripting\Test\screen.txt")
' sample user creation
transaction("SU01")
setfield("USR02-BNAME","Text","LESTEBAN3")
OkCode("CREA")
SetField("ADDR3_DATA-NAME_LAST","TEXT","Last name")
SetField("ADDR3_DATA-NAME_FIRST","TEXT","Name")
SetField("SZA5_D0700-SMTP_ADDR","TEXT","lbesteban@gmail.com")
Okcode("LOGO")
SetField("G_PASSWORD1","TEXT","inicial")
SetField("G_PASSWORD2","TEXT","inicial")
Okcode("PROF")
SetField("USPROF-PROFILE","column","SAP_ALL|SAP_NEW|S_A.SYSTEM")
okcode("UPD")
'take a screenshot based on the extension, valid extensions are bmp,jpg,gif and png
screenshot("C:\lbdemo_screen.png","png")
'async shell, launch and keep running
'shell("notepad","C:\log.txt")
'syncronous shell, will wait for it finishes
'waitfor("cmd.exe")
'wait() or msgbox()
wait("Script is done ....")
loadscript("C:\simple_create_user.vbs") (but this does not work well)
but the loadscript part fails, it can not attach to my sapgui session if created manually.
Can anyone help me there ?
Is there any other source of documentation rahter than the chm file in the sapgui setup ?
Thanks.
Luis
Please also, feel free to use the tool as it can help a lot in repetitive tasks, be a base to create stress test meters, etc. etc.
And if you have suggestions or comments please drop me an email.
Found the solution, the user needs to start saplogon and that publishes the scripting interface so another program can use it.
so instead of creating the scripting control app this way
app = CreateObject("Sapgui.ScriptingCtrl.1")
I used this other way
and then
and it works, now my scripting object can start scripts generated with the sap recorder without problems
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
VBA runs right from the command line using wscript.exe or cscript.exe
But, VBA can be run from inside any microsoft product which supports scripting, excel, word, powerpoint, VB.NET itself, and so on.
I have published two tools which use in one case excel to run and in another one they are run from inside a gui like macro editor
Maybe you can give them a try the are here http://lbscript.sourceforge.net/ the other one is the first version of this tool which I wrote a long ago http://lbscript.sourceforge.net/lbscript_excel.html
Hope it helps, if they are not clear enough du to my lousy documentation just drop me an email and I'll see if I can be helpful
Regards
Luis
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.