; AutoHotkey全自动安装环境设置和测试JAVA+Eclipas+Android+JRE+JDK+SDK+ADT+Android模拟器+Android Virtual Device Manager+NDK+Studio+Doc+Help+Android Application Project编程调试windows环境[草稿版]
DetectHiddenWindows,On
SetTitleMatchMode,2
; 激活窗口并单击按钮
IfWinExistActiveControlClick(ClassNN,WinTitle,WinText)
{
IfWinExist,%WinTitle%,%WinText%
{
IfWinActive,%WinTitle%,%WinText%
{
ControlClick,%ClassNN%,%WinTitle%,%WinText%
}
else
{
#WinActivateForce
WinActivate,%WinTitle%,%WinText%
}
}
}
loop {
sleep,10
IfNotExist,jdk-8u102-windows-i586.exe
{
msgbox,NotExist File jdk-8u102-windows-i586.exe
break
}
Process,Exist,jdk-8u102-windows-i586.exe
If Not(ErrorLevel)
{
run,jdk-8u102-windows-i586.exeW
}
IfWinExistActiveControlClick("Button1","警告 - Java 安装程序","Java 8 需要更新版本的 Windows。您可以继续安装")
IfWinExistActiveControlClick("Button1","Java SE Development Kit 8 Update 102 - 安装程序","Java Mission Control 分析和诊断工具套件现在作为 JDK 的一部分提供")
IfWinExistActiveControlClick("Button3","Java SE Development Kit 8 Update 102 - 定制安装","一个专用 JRE 以及 Java Mission Control 工具套件")
;在AutoHotkey中调用 大漠插件 的 GetOsType() 函数
os_type = dm.GetOsType()
;判断操作系统的类型,根据不同的操作系统自动设置java的
If (os_type = 2)
{
addpath = %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; ;你要添加的 RegRead, oldpath, HKLM, SYSTEM\ControlSet001\Control\Session Manager\Environment, Path ;读取原有
RegWrite, REG_SZ, HKLM, SYSTEM\ControlSet001\Control\Session Manager\Environment, Path, %oldpath%;?dpath% ;添加至注册表 RegWrite, REG_SZ, HKLM,
SYSTEM\CurrentControlSet\Control\Session Manager\Environment, Path, %oldpath%;?dpath% SendMessage, 0x1A, 0,"Environment",, ahk_id 0xFFFF ;立即生效
}
;AhkSetPath() 是我的JAVA环境变量全自动设置自定义AHK函数
;所有软件程序全自动安装,所有设置全自动设置
;一个大的loop循环,不断判断什么操作没有完成就立即进行相应操作然后继续判断,不会卡死在某几行代码中一直死循环,有无法处理的情况立即msgbox告诉用户
AhkSetPath(JAVA_HOME){ ... }
If JRE NOT Setup {AhkSetupInstallCopy(JRE){ ... }}
If JDK NOT Setup {AhkSetupInstallCopy(JDK){ ... }}
If Android SDK NOT Setup {AhkSetupInstallCopy(Android SDK){ ... }}
If Eclipse NOT Setup {AhkSetupInstallCopy(Eclipse){ ... }}
If ADT NOT Setup {AhkSetupInstallCopy(ADT){ ... }}
If SDK NOT Setup {AhkSetupInstallCopy(SDK){ ... }}
If Android Platform NOT Setup {AhkSetupInstallCopy(Android Platform){ ... }}
If Android Virtual Device Manager NOT Setup {AhkSetupInstallCopy(Android Virtual Device Manager){ ... }}
If JRE NOT Setup {AhkSetupInstallCopy(JRE){ ... }}
If JRE NOT Setup {AhkSetupInstallCopy(JRE){ ... }}
If JRE NOT Setup {AhkSetupInstallCopy(JRE){ ... }}
If JRE NOT Setup {AhkSetupInstallCopy(JRE){ ... }}
If JRE NOT Setup {AhkSetupInstallCopy(JRE){ ... }}
If JRE NOT Set {AhkSetPathConfigAndTest(JRE){ ... }}
If JDK NOT Set {AhkSetPathConfigAndTest(JDK){ ... }}
If Android SDK NOT Set {AhkSetPathConfigAndTest(Android SDK){ ... }}
If Eclipse NOT Set {AhkSetPathConfigAndTest(Eclipse){ ... }}
If ADT NOT Set {AhkSetPathConfigAndTest(ADT){ ... }}
If SDK NOT Set {AhkSetPathConfigAndTest(SDK){ ... }}
If Android Platform NOT Set {AhkSetPathConfigAndTest(Android Platform){ ... }}
If Android Virtual Device Manager NOT Set {AhkSetPathConfigAndTest(Android Virtual Device Manager){ ... }}
If JRE NOT Set {AhkSetPathConfigAndTest(JRE){ ... }}
If JRE NOT Set {AhkSetPathConfigAndTest(JRE){ ... }}
If JRE NOT Set {AhkSetPathConfigAndTest(JRE){ ... }}
If JRE NOT Set {AhkSetPathConfigAndTest(JRE){ ... }}
If JRE NOT Set {AhkSetPathConfigAndTest(JRE){ ... }}
If (WinExist(Java SE Development Kit 8 Update 102 - 完成,Java SE Development Kit 8 Update 102 已成功安装) And (AhkPathOK) And (RunJavaTestOK) And
(RunAndroidTestOK) AND (安卓模拟器启动测试成功)
{
;只有在完成所有任务时(完成JAVA+Eclipse+Android的安装设置与测试)才退出(终止) loop 循环
Break
}
}