VBScriptファイルは、隠されたスクリプトの一部にすぎないため、サイレントモードで実行します。VBScriptファイルをバックグラウンドでサイレントモードで実行するにはどうすればよいですか?
私はVBScriptを使用して、SAP-GUIの各ステップを表示しない限り、完全に機能するSAPからドキュメントを自動的にエクスポートしています。
$vbsPDPPath = "$env:userprofile\AppData\Roaming\KPIReport"
$vbsPDPName = "SAP-ExportPDP.vbs"
$processNamePDP = $vbsPDPPath + "\" + $vbsPDPName
Start-Process $processNamePDP -WindowStyle Hidden
はしかしうまくいかなかった:
VBScriptファイルは、私はすでにのようなプロセスを隠そうとしたのPowerShellで開始されました。
私はあなただけ追加することができVBA、中のようなソリューションを探しています:
Application.ScreenUpdating = False
はまだそれを解決する方法は考えています。私はあなたがvbsコードを見せてもらうことが役に立つと思っていました。
私は、SAP GUIとExcelアプリケーションを隠すように言及していないことに気付きました。
Dim Number_PDP
Dim testNode
Dim WshShell
Dim profile
Set WshShell = WScript.CreateObject("WScript.Shell")
profile = WshShell.ExpandEnvironmentStrings("%USERPROFILE%")
'read XML file
Set xmlDoc = CreateObject("MSXML.DomDocument")
xmlDoc.Load profile & "\AppData\Roaming\KPIReport\DIS.xml"
For Each testNode In xmlDoc.selectNodes("/Reports/Report")
Number_PDP = testNode.SelectSingleNode("DIS_PDP").Text
'connect to SAP GUI
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
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
SapGuiAuto.Visible = false
'not working, thought it is possible to hide SAP
session.findById("wnd[0]").resizeWorkingPane 132,31,false
session.findById("wnd[0]/tbar[0]/okcd").text = "/n cv04n"
session.findById("wnd[0]").sendVKey 0
...
'cutted a couple of rows, just opens a document in Excel with SAP
'after SAP opens Excel I used this code to save the documents
set objExcel = getobject(,"Excel.Application")
if err.number<>0 then
err.clear
end if
'this part should be hidden as well, not working
objExcel.Visible = false
objExcel.ActiveWorkbook.SaveAs profile & "\AppData\Roaming\KPIReport\" & Number_PDP
objExcel.ActiveWorkbook.Close
objExcel.Quit
Next
は何// B $ processNamePDP' –
バッチmode.'cscriptにします。cscriptインタプリタを使用するようにしてくださいあなたは今見ますか? CMD画面またはPowersheel画面?それは現在どのようにキックオフされていますか? –
@VincentG私はそれを試しましたが、動かなかった –