mirror of
https://github.com/reactos/ahk_tests.git
synced 2024-11-27 05:20:25 +00:00
45b3c059f3
Use helper function to terminate process. svn path=/trunk/ahk_tests/; revision=1975
92 lines
2.8 KiB
AutoHotkey
92 lines
2.8 KiB
AutoHotkey
/*
|
|
* Designed for IrfanView 4.23
|
|
* Copyright (C) 2012 Edijs Kolesnikovics
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
TestName = prepare
|
|
|
|
; Test if the app is installed
|
|
TestsTotal++
|
|
RegRead, UninstallerPath, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PuTTY_is1, UninstallString
|
|
if ErrorLevel
|
|
TestsFailed("Either registry key does not exist or we failed to read it.")
|
|
else
|
|
{
|
|
UninstallerPath := ExeFilePathNoParam(UninstallerPath)
|
|
SplitPath, UninstallerPath,, InstalledDir
|
|
if (InstalledDir = "")
|
|
TestsFailed("Either registry contains empty string or we failed to read it.")
|
|
else
|
|
{
|
|
ModuleExe = %InstalledDir%\putty.exe
|
|
TestsOK("")
|
|
}
|
|
}
|
|
|
|
|
|
; Terminate application
|
|
if bContinue
|
|
{
|
|
SplitPath, ModuleExe, ProcessExe
|
|
bTerminateProcess(ProcessExe)
|
|
}
|
|
|
|
|
|
; Test if connected to the Internet
|
|
TestsTotal++
|
|
if bContinue
|
|
{
|
|
if not bIsConnectedToInternet()
|
|
TestsFailed("No internet connection detected.")
|
|
else
|
|
TestsOK("Internet connection detected.")
|
|
}
|
|
|
|
|
|
; Test if can start application
|
|
RunApplication()
|
|
{
|
|
global ModuleExe
|
|
global TestName
|
|
global TestsTotal
|
|
global bContinue
|
|
global ProcessExe
|
|
|
|
TestsTotal++
|
|
if bContinue
|
|
{
|
|
IfNotExist, %ModuleExe%
|
|
TestsFailed("RunApplication(): Can NOT find '" ModuleExe "'.")
|
|
else
|
|
{
|
|
Run, %ModuleExe%
|
|
WinWaitActive, PuTTY Configuration, Specify the destination, 5
|
|
if ErrorLevel
|
|
{
|
|
Process, Exist, %ProcessExe%
|
|
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
|
|
if NewPID = 0
|
|
TestsFailed("RunApplication(): Window 'PuTTY Configuration (Specify the destination)' failed to appear. No '" ProcessExe "' process detected.")
|
|
else
|
|
TestsFailed("RunApplication(): Window 'PuTTY Configuration (Specify the destination)' failed to appear. '" ProcessExe "' process detected.")
|
|
}
|
|
else
|
|
TestsOK("")
|
|
}
|
|
}
|
|
}
|