2012-08-15 17:57:54 +00:00
|
|
|
/*
|
|
|
|
* Designed for K-Meleon 1.5.2
|
|
|
|
* 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
|
|
|
|
|
2012-09-30 09:18:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
; Test if the app is installed
|
|
|
|
TestsTotal++
|
2012-08-15 17:57:54 +00:00
|
|
|
RegRead, UninstallerPath, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\K-Meleon, UninstallString
|
2012-09-08 08:23:51 +00:00
|
|
|
if ErrorLevel
|
2012-09-30 09:18:04 +00:00
|
|
|
TestsFailed("Either registry key does not exist or we failed to read it.")
|
2012-09-08 08:23:51 +00:00
|
|
|
else
|
2012-08-15 17:57:54 +00:00
|
|
|
{
|
|
|
|
SplitPath, UninstallerPath,, InstalledDir
|
2013-02-08 17:47:48 +00:00
|
|
|
if (InstalledDir = "")
|
|
|
|
TestsFailed("Either registry contains empty string or we failed to read it.")
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ModuleExe = %InstalledDir%\k-meleon.exe
|
|
|
|
TestsOK("")
|
|
|
|
}
|
2012-08-15 17:57:54 +00:00
|
|
|
}
|
2012-09-08 08:23:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
; Terminate application
|
2013-03-13 17:32:36 +00:00
|
|
|
if bContinue
|
|
|
|
{
|
|
|
|
SplitPath, ModuleExe, ProcessExe
|
|
|
|
bTerminateProcess(ProcessExe)
|
|
|
|
}
|
2012-09-08 08:23:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
; Delete settings separately from RunApplication() in case we want to write our own settings
|
|
|
|
TestsTotal++
|
|
|
|
IfExist, %A_AppData%\K-Meleon
|
2012-08-15 17:57:54 +00:00
|
|
|
{
|
2012-09-08 08:23:51 +00:00
|
|
|
FileRemoveDir, %A_AppData%\K-Meleon, 1
|
|
|
|
if ErrorLevel
|
|
|
|
TestsFailed("Unable to delete '" A_AppData "\K-Meleon'.")
|
|
|
|
else
|
|
|
|
TestsOK("")
|
2012-08-15 17:57:54 +00:00
|
|
|
}
|
2012-09-08 08:23:51 +00:00
|
|
|
else
|
|
|
|
TestsOK("")
|
2012-08-15 17:57:54 +00:00
|
|
|
|
2012-09-08 08:23:51 +00:00
|
|
|
|
|
|
|
; Test if can start application
|
|
|
|
RunApplication(PathToFile, Title)
|
2012-08-15 17:57:54 +00:00
|
|
|
{
|
2012-09-08 08:23:51 +00:00
|
|
|
global ModuleExe
|
|
|
|
global TestName
|
|
|
|
global TestsTotal
|
|
|
|
global ProcessExe
|
|
|
|
|
|
|
|
TestsTotal++
|
2012-09-30 09:18:04 +00:00
|
|
|
if bContinue
|
2012-08-15 17:57:54 +00:00
|
|
|
{
|
2012-09-30 09:18:04 +00:00
|
|
|
IfNotExist, %ModuleExe%
|
2013-02-08 18:30:22 +00:00
|
|
|
TestsFailed("RunApplication(): Can NOT find '" ModuleExe "'.")
|
2012-09-08 08:23:51 +00:00
|
|
|
else
|
2012-08-15 17:57:54 +00:00
|
|
|
{
|
2012-09-30 09:18:04 +00:00
|
|
|
FileCreateDir, %A_AppData%\K-Meleon\ReactOS.default
|
2012-09-08 08:23:51 +00:00
|
|
|
if ErrorLevel
|
2013-02-08 18:30:22 +00:00
|
|
|
TestsFailed("RunApplication(): Failed to create dir tree '" A_AppData "\K-Meleon\ReactOS.default'.")
|
2012-09-08 08:23:51 +00:00
|
|
|
else
|
2012-08-15 17:57:54 +00:00
|
|
|
{
|
2012-09-30 09:18:04 +00:00
|
|
|
FileAppend, [General]`nStartWithLastProfile=1`n`n[Profile0]`nName=default`nDefault=1`nIsRelative=1`nPath=ReactOS.default`n, %A_AppData%\K-Meleon\profiles.ini
|
2012-09-08 08:23:51 +00:00
|
|
|
if ErrorLevel
|
2013-02-08 18:30:22 +00:00
|
|
|
TestsFailed("RunApplication(): Failed to create and edit '" A_AppData "\K-Meleon\profiles.ini'.")
|
2012-09-08 08:23:51 +00:00
|
|
|
else
|
2012-08-15 17:57:54 +00:00
|
|
|
{
|
2012-09-30 09:18:04 +00:00
|
|
|
szNoUpdate := "user_pref(""kmeleon.plugins.update.load""`, false)`;" ; Don't check for updates
|
|
|
|
FileAppend, %szNoUpdate%`n, %A_AppData%\K-Meleon\ReactOS.default\prefs.js
|
|
|
|
if ErrorLevel
|
2013-02-08 18:30:22 +00:00
|
|
|
TestsFailed("RunApplication(): Failed to create and edit '" A_AppData "\K-Meleon\ReactOS.default\prefs.js'.")
|
2012-08-15 17:57:54 +00:00
|
|
|
else
|
2012-09-08 08:23:51 +00:00
|
|
|
{
|
2012-09-30 09:18:04 +00:00
|
|
|
; 'Title' param is ignored
|
|
|
|
If PathToFile =
|
2012-09-08 08:23:51 +00:00
|
|
|
{
|
2012-09-30 09:18:04 +00:00
|
|
|
Run, %ModuleExe% ; 'Max' doesn't work here
|
|
|
|
WinWaitActive, K-Meleon 1.5.2 (K-Meleon),, 12
|
2012-09-08 08:23:51 +00:00
|
|
|
if ErrorLevel
|
|
|
|
{
|
|
|
|
Process, Exist, %ProcessExe%
|
|
|
|
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
|
|
|
|
if NewPID = 0
|
2013-02-08 18:30:22 +00:00
|
|
|
TestsFailed("RunApplication(): 'K-Meleon 1.5.2 (K-Meleon)' window failed to appear. No '" ProcessExe "' process detected.")
|
2012-09-08 08:23:51 +00:00
|
|
|
else
|
2013-02-08 18:30:22 +00:00
|
|
|
TestsFailed("RunApplication(): 'K-Meleon 1.5.2 (K-Meleon)' window failed to appear. '" ProcessExe "' process detected.")
|
2012-09-08 08:23:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-30 09:18:04 +00:00
|
|
|
WinMaximize, K-Meleon 1.5.2 (K-Meleon)
|
2012-09-08 08:23:51 +00:00
|
|
|
TestsOK("")
|
2012-09-30 09:18:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
IfNotExist, %PathToFile%
|
2013-02-08 18:30:22 +00:00
|
|
|
TestsFailed("RunApplication(): Can NOT find '" PathToFile "'.")
|
2012-09-30 09:18:04 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
; FIXME: read <title> from HTML instead of passing it as param2.
|
|
|
|
Run, %ModuleExe% %PathToFile% ; 'Max' doesn't work here
|
|
|
|
WinWaitActive, %Title% (K-Meleon),, 12
|
|
|
|
if ErrorLevel
|
|
|
|
{
|
|
|
|
Process, Exist, %ProcessExe%
|
|
|
|
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
|
|
|
|
if NewPID = 0
|
2013-02-08 18:30:22 +00:00
|
|
|
TestsFailed("RunApplication(): '" Title " (K-Meleon)' window failed to appear. No '" ProcessExe "' process detected.")
|
2012-09-30 09:18:04 +00:00
|
|
|
else
|
2013-02-08 18:30:22 +00:00
|
|
|
TestsFailed("RunApplication(): '" Title " K-Meleon 1.5.2 (K-Meleon)' window failed to appear. '" ProcessExe "' process detected.")
|
2012-09-30 09:18:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WinMaximize, %Title% (K-Meleon)
|
|
|
|
TestsOK("")
|
|
|
|
}
|
2012-09-08 08:23:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-08-15 17:57:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|