编辑:在Qt支持的帮助下,我已经解决了如何自动化这两部分Qt企业安装程序的问题。下面是脚本调用。
我正在尝试在Windows 8.1和Windows 10上静默安装Qt 5.5.1 Enterprise,使用“--script”开关调用自动化UI的javascript,但似乎无法读取所有元素用户界面阅读它。
我有2个控制器页面的工作方式与标准的Qt安装程序不同,特别是“CredentialsPageCallback”,它需要在调用“gui.clickButton(buttons.NextButton);”之前检查复选框。 它还支持一个名为“ManualLicensePageCallback”的新回调页面,该页面根本没有文档。 这是我写的剧本。我需要凭据页面上的复选框名称,以及手册页面上的两个“行编辑”调用:
// Emacs mode hint: -*- mode: JavaScript -*-
function Controller() {
//installer.autoRejectMessageBoxes();
installer.installationFinished.connect(function() {
gui.clickButton(buttons.NextButton);
})
}
Controller.prototype.WelcomePageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.CredentialsPageCallback = function() {
gui.pageWidgetByObjectName("CredentialsPage").enterManuallyCheckBox.click();
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ManualLicensePageCallback = function() {
var page = gui.pageWidgetByObjectName("ManualLicensePage");
page.LicenseeLineEdit.setText("NAME");
page.Qt5KeyLineEdit.setText("REG KEY");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.IntroductionPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.TargetDirectoryPageCallback = function() {
gui.currentPageWidget().TargetDirectoryLineEdit.setText("C:\\Path\\To\\Install");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ComponentSelectionPageCallback = function() {
var widget = gui.currentPageWidget();
//BY DEFAULT, THE DEFAULT INSTALL METHOD IS SELECTED
//USE THESE WIDGET CALLS TO DESELECT ANY ITEMS
//widget.deselectAll();
//widget.deselectComponent("qt.55.win64_msvc2013_64");
//widget.deselectComponent("qt.55.qt3d");
//widget.deselectComponent("qt.55.qtquick1");
//widget.deselectComponent("qt.55.qtwebengine");
//widget.deselectComponent("qt.55.qtquickcontrols");
//widget.deselectComponent("qt.55.qtscript");
//widget.deselectComponent("qt.55.qtcanvas3d");
//widget.deselectComponent("qt.55.qtlocation");
//widget.deselectComponent("qt.tools");
//widget.deselectComponent("qt.extras");
//widget.deselectComponent("qt.enterpriseaddons");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.LicenseAgreementPageCallback = function() {
gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
gui.clickButton(buttons.NextButton);
}
Controller.prototype.StartMenuDirectoryPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ReadyForInstallationPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.FinishedPageCallback = function() {
var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm
if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) {
checkBoxForm.launchQtCreatorCheckBox.checked = false;
}
gui.clickButton(buttons.FinishButton);
}
答案 0 :(得分:3)
我在5.8安装中搜索XML文件时,在名为components.xml
的文件中找到了一个Windows标签值。查看完所有内容后,看起来该文件是由您在安装时的选择生成的。所以我完成了最新发布的Qt(5.9.0)的完整安装,除了Source之外,我知道在尝试使用其中的一些之后,组件标签是"qt.59.src"
。
关于直接UI元素检查以获取这些,我尝试了gui-inspect-tool repo中的所有UI检查工具,但没有一个淘汰。 UISpy.exe
提供的信息最多,但相当不稳定。看起来Qt不会将其组件名称传播到“名称”字段,以便与WinAPI和本机Windows UI检查器一起使用。所有“名称”字段都是空字符串或从所有UI检查工具返回错误。
安装完成后,您可以在基本qt安装中打开components.xml。
然后为整个文件搜索术语Prebuilt
。每次点击都会将您带到描述字段,上面两行是您需要的名称字段。对于5.9,我认为对于预先构建的二进制文件有一个例外,那就是(已弃用)Qt脚本。
以下是components.xml中其中一个软件包的示例:
<Package>
<Name>qt.59.android_armv7</Name>
<Title>Android ARMv7</Title>
<Description>Qt 5.9.0 Prebuilt Components for Android ARMv7</Description>
<Version>5.9.0-0</Version>
<LastUpdateDate></LastUpdateDate>
<InstallDate>2017-06-16</InstallDate>
<Size>145381493</Size>
<Dependencies>qt.tools.qtcreator,qt.59.doc,qt.59.examples,qt.tools.win32_mingw530</Dependencies>
<Checkable>true</Checkable>
</Package>
<Name>
qt.59.android_armv7
是用于QS文件的实际组件字符串,例如,
Controller.prototype.ComponentSelectionPageCallback = function() {
var widget = gui.currentPageWidget();
widget.selectAll();
widget.deselectComponent("qt.59.android_armv7");
gui.clickButton(buttons.NextButton);
}
为了节省一些人可能使用5.9或具有类似结构的安装程序,这里是不同预构建平台的所有标签名称:
Android ARMv7:"qt.59.android_armv7"
Android x86:"qt.59.android_x86"
MinGW 5.3.0 32位:"qt.59.win32_mingw53"
msvc2017 64位:"qt.59.win64_msvc2017_64"
msvc2015 32位:"qt.59.win32_msvc2015"
msvc2015 64位:"qt.59.win64_msvc2015_64"
msvc2013 64位:"qt.59.win64_msvc2013_64"
UWP x64(MSVC2015):"qt.59.win64_msvc2015_winrt_x64"
UWP x64(MSVC2017):"qt.59.win64_msvc2017_winrt_x64"
UWP x86(MSVC2015):"qt.59.win64_msvc2015_winrt_x86"
UWP x86(MSVC2017):"qt.59.win64_msvc2017_winrt_x86"
UWP armv7(MSVC2015):"qt.59.win64_msvc2015_winrt_armv7"
UWP armv7(MSVC2017):"qt.59.win64_msvc2017_winrt_armv7"
作为进一步的礼貌,这里是所有组件的转储。其中一些实际上是您选择的组件的依赖项,因此您的里程会有所不同:
"qt"
"qt.59"
"qt.59.android_armv7"
"qt.59.android_x86"
"qt.59.doc"
"qt.59.doc.qtcharts"
"qt.59.doc.qtdatavis3d"
"qt.59.doc.qtnetworkauth"
"qt.59.doc.qtpurchasing"
"qt.59.doc.qtremoteobjects"
"qt.59.doc.qtscript"
"qt.59.doc.qtspeech"
"qt.59.doc.qtvirtualkeyboard"
"qt.59.doc.qtwebengine"
"qt.59.examples"
"qt.59.examples.qtcharts"
"qt.59.examples.qtdatavis3d"
"qt.59.examples.qtnetworkauth"
"qt.59.examples.qtpurchasing"
"qt.59.examples.qtremoteobjects"
"qt.59.examples.qtscript"
"qt.59.examples.qtspeech"
"qt.59.examples.qtvirtualkeyboard"
"qt.59.examples.qtwebengine"
"qt.59.qtcharts"
"qt.59.qtcharts.android_armv7"
"qt.59.qtcharts.android_x86"
"qt.59.qtcharts.win32_mingw53"
"qt.59.qtcharts.win32_msvc2015"
"qt.59.qtcharts.win64_msvc2013_64"
"qt.59.qtcharts.win64_msvc2015_64"
"qt.59.qtcharts.win64_msvc2015_winrt_armv7"
"qt.59.qtcharts.win64_msvc2015_winrt_x64"
"qt.59.qtcharts.win64_msvc2015_winrt_x86"
"qt.59.qtcharts.win64_msvc2017_64"
"qt.59.qtcharts.win64_msvc2017_winrt_armv7"
"qt.59.qtcharts.win64_msvc2017_winrt_x64"
"qt.59.qtcharts.win64_msvc2017_winrt_x86"
"qt.59.qtdatavis3d"
"qt.59.qtdatavis3d.android_armv7"
"qt.59.qtdatavis3d.android_x86"
"qt.59.qtdatavis3d.win32_mingw53"
"qt.59.qtdatavis3d.win32_msvc2015"
"qt.59.qtdatavis3d.win64_msvc2013_64"
"qt.59.qtdatavis3d.win64_msvc2015_64"
"qt.59.qtdatavis3d.win64_msvc2015_winrt_armv7"
"qt.59.qtdatavis3d.win64_msvc2015_winrt_x64"
"qt.59.qtdatavis3d.win64_msvc2015_winrt_x86"
"qt.59.qtdatavis3d.win64_msvc2017_64"
"qt.59.qtdatavis3d.win64_msvc2017_winrt_armv7"
"qt.59.qtdatavis3d.win64_msvc2017_winrt_x64"
"qt.59.qtdatavis3d.win64_msvc2017_winrt_x86"
"qt.59.qtnetworkauth"
"qt.59.qtnetworkauth.android_armv7"
"qt.59.qtnetworkauth.android_x86"
"qt.59.qtnetworkauth.win32_mingw53"
"qt.59.qtnetworkauth.win32_msvc2015"
"qt.59.qtnetworkauth.win64_msvc2013_64"
"qt.59.qtnetworkauth.win64_msvc2015_64"
"qt.59.qtnetworkauth.win64_msvc2015_winrt_armv7"
"qt.59.qtnetworkauth.win64_msvc2015_winrt_x64"
"qt.59.qtnetworkauth.win64_msvc2015_winrt_x86"
"qt.59.qtnetworkauth.win64_msvc2017_64"
"qt.59.qtnetworkauth.win64_msvc2017_winrt_armv7"
"qt.59.qtnetworkauth.win64_msvc2017_winrt_x64"
"qt.59.qtnetworkauth.win64_msvc2017_winrt_x86"
"qt.59.qtpurchasing"
"qt.59.qtpurchasing.android_armv7"
"qt.59.qtpurchasing.android_x86"
"qt.59.qtpurchasing.win32_mingw53"
"qt.59.qtpurchasing.win32_msvc2015"
"qt.59.qtpurchasing.win64_msvc2013_64"
"qt.59.qtpurchasing.win64_msvc2015_64"
"qt.59.qtpurchasing.win64_msvc2015_winrt_armv7"
"qt.59.qtpurchasing.win64_msvc2015_winrt_x64"
"qt.59.qtpurchasing.win64_msvc2015_winrt_x86"
"qt.59.qtpurchasing.win64_msvc2017_64"
"qt.59.qtpurchasing.win64_msvc2017_winrt_armv7"
"qt.59.qtpurchasing.win64_msvc2017_winrt_x64"
"qt.59.qtpurchasing.win64_msvc2017_winrt_x86"
"qt.59.qtremoteobjects"
"qt.59.qtremoteobjects.android_armv7"
"qt.59.qtremoteobjects.android_x86"
"qt.59.qtremoteobjects.win32_mingw53"
"qt.59.qtremoteobjects.win32_msvc2015"
"qt.59.qtremoteobjects.win64_msvc2013_64"
"qt.59.qtremoteobjects.win64_msvc2015_64"
"qt.59.qtremoteobjects.win64_msvc2015_winrt_armv7"
"qt.59.qtremoteobjects.win64_msvc2015_winrt_x64"
"qt.59.qtremoteobjects.win64_msvc2015_winrt_x86"
"qt.59.qtremoteobjects.win64_msvc2017_64"
"qt.59.qtremoteobjects.win64_msvc2017_winrt_armv7"
"qt.59.qtremoteobjects.win64_msvc2017_winrt_x64"
"qt.59.qtremoteobjects.win64_msvc2017_winrt_x86"
"qt.59.qtscript"
"qt.59.qtscript.android_armv7"
"qt.59.qtscript.android_x86"
"qt.59.qtscript.win32_mingw53"
"qt.59.qtscript.win32_msvc2015"
"qt.59.qtscript.win64_msvc2013_64"
"qt.59.qtscript.win64_msvc2015_64"
"qt.59.qtscript.win64_msvc2017_64"
"qt.59.qtspeech"
"qt.59.qtspeech.android_armv7"
"qt.59.qtspeech.android_x86"
"qt.59.qtspeech.win32_mingw53"
"qt.59.qtspeech.win32_msvc2015"
"qt.59.qtspeech.win64_msvc2013_64"
"qt.59.qtspeech.win64_msvc2015_64"
"qt.59.qtspeech.win64_msvc2017_64"
"qt.59.qtvirtualkeyboard"
"qt.59.qtvirtualkeyboard.win32_mingw53"
"qt.59.qtvirtualkeyboard.win32_msvc2015"
"qt.59.qtvirtualkeyboard.win64_msvc2013_64"
"qt.59.qtvirtualkeyboard.win64_msvc2015_64"
"qt.59.qtvirtualkeyboard.win64_msvc2017_64"
"qt.59.qtwebengine"
"qt.59.qtwebengine.win32_msvc2015"
"qt.59.qtwebengine.win64_msvc2015_64"
"qt.59.qtwebengine.win64_msvc2017_64"
"qt.59.src"
"qt.59.win32_mingw53"
"qt.59.win32_msvc2015"
"qt.59.win64_msvc2013_64"
"qt.59.win64_msvc2015_64"
"qt.59.win64_msvc2015_winrt_armv7"
"qt.59.win64_msvc2015_winrt_x64"
"qt.59.win64_msvc2015_winrt_x86"
"qt.59.win64_msvc2017_64"
"qt.59.win64_msvc2017_winrt_armv7"
"qt.59.win64_msvc2017_winrt_x64"
"qt.59.win64_msvc2017_winrt_x86"
"qt.enterpriseaddons"
"qt.enterpriseaddons.qtquickcompiler"
"qt.enterpriseaddons.qtquickcompiler.doc"
"qt.enterpriseaddons.qtquickcompiler.qt59.android_armv7"
"qt.enterpriseaddons.qtquickcompiler.qt59.android_x86"
"qt.enterpriseaddons.qtquickcompiler.qt59.win32_mingw53"
"qt.enterpriseaddons.qtquickcompiler.qt59.win32_msvc2015"
"qt.enterpriseaddons.qtquickcompiler.qt59.win64_msvc2013_64"
"qt.enterpriseaddons.qtquickcompiler.qt59.win64_msvc2015_64"
"qt.enterpriseaddons.qtquickcompiler.qt59.win64_msvc2015_winrt_armv7"
"qt.enterpriseaddons.qtquickcompiler.qt59.win64_msvc2015_winrt_x64"
"qt.enterpriseaddons.qtquickcompiler.qt59.win64_msvc2015_winrt_x86"
"qt.enterpriseaddons.qtquickcompiler.qt59.win64_msvc2017_64"
"qt.enterpriseaddons.qtquickcompiler.qt59.win64_msvc2017_winrt_armv7"
"qt.enterpriseaddons.qtquickcompiler.qt59.win64_msvc2017_winrt_x64"
"qt.enterpriseaddons.qtquickcompiler.qt59.win64_msvc2017_winrt_x86"
"qt.installer.changelog"
"qt.license.automotive"
"qt.license.embedded"
"qt.license.enterprise"
"qt.license.python"
"qt.tools"
"qt.tools.perl"
"qt.tools.qtcreator"
"qt.tools.qtcreator.enterprise.plugins"
"qt.tools.qtcreatorcdbext"
"qt.tools.vcredist_msvc2015_x64"
"qt.tools.vcredist_msvc2015_x86"
"qt.tools.win32_mingw530"
作为一个完整的功能,这是我用于Windows安装的实际功能:
Controller.prototype.ComponentSelectionPageCallback = function() {
var widget = gui.currentPageWidget();
widget.selectAll();
widget.deselectComponent("qt.59.android_x86");
widget.deselectComponent("qt.59.android_armv7");
widget.deselectComponent("qt.59.win32_mingw53");
widget.deselectComponent("qt.59.win64_msvc2013_64");
widget.deselectComponent("qt.59.win64_msvc2017_winrt_armv7");
widget.deselectComponent("qt.59.win64_msvc2015_winrt_armv7");
widget.deselectComponent("qt.59.src");
widget.deselectComponent("qt.tools.perl");
widget.deselectComponent("qt.tools.win32_mingw530");
gui.clickButton(buttons.NextButton);
}
如果您想了解如何从头开始制作其中一个脚本,请查看此答案以开始使用:https://stackoverflow.com/a/34032216/3543437
将所有包含59.
的字符串更改为591.
的5.9.1;如果您使用5.9.0的相同脚本作为5.9.1,它将尝试安装所有内容,因为没有取消选择正确的组件。
看起来好像他们坚持使用5.9.1的相同约定,所以只需将59
更改为593
;我假设这也是5.9.2的情况,以及随后的5.9版本。