首页 > 解决方案 > 尝试使用 sendkey

问题描述

第一个SendKeys "%H"是公认的。我在报告中看到了结果。然而,“R”不是。

Reports\Templates\Sensor_Exporter\Master8.pbix

Start-Sleep -s 15
$wshell = New-Object -ComObject WScript.Shell

[void][System.Reflection.Assembly]::LoadWithPartialName("'Microsoft.VisualBasic");

[Microsoft.VisualBasic.Interaction]::AppActivate("Master8 - Power BI Desktop");

Start-Sleep -s 5

$wshell.SendKeys("%H")
$wshell.SendKeys("R")

标签: powershellpowerbisendkeys

解决方案


只需将 start-sleep -s 2 放在两个 sendkey 之间就可以了。


推荐阅读