Skip to content

Commit

Permalink
2012-03-28_03-54-02
Browse files Browse the repository at this point in the history
  • Loading branch information
camerb committed Mar 28, 2012
1 parent 2a46522 commit bdd014a
Show file tree
Hide file tree
Showing 12 changed files with 355 additions and 50 deletions.
5 changes: 4 additions & 1 deletion FcnLib.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ CompileAhk(ahkFile, options="")
FileDelete(exePath)
WaitFileNotExist(exePath)
Sleep, 100
Sleep, 1000
;Sleep, 1000

ahk2exe:=ProgramFilesDir("AutoHotkey\Compiler\Ahk2Exe.exe")
if InStr(options, "MitsiIcon")
Expand Down Expand Up @@ -2136,3 +2136,6 @@ OpenVM()

;WRITEME make forums scraper that will pull information from each lib into a common format on a common ahk.net site (CPAN4AHK)


;WRITEME need to make a function that will run ahk code from a temp ahk file

28 changes: 14 additions & 14 deletions FindMe_Config.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[Settings]
X=2319
Y=214
Width=794
Height=850
X=2142
Y=134
Width=810
Height=888
LastDir=*C:\code\epms
LastSearch=ext.ui.
LastReplace=Firefly-2-Added.ini
Expand All @@ -21,16 +21,16 @@ LastFile9=C:\dropbox\ahks
LastFile10=*C:\dropbox\ahks

# Search field
lastSearch1=ftp:
lastSearch2=TestLynx
lastSearch3=ftp
lastSearch4=UpdatePerlPackages
lastSearch5=TestLynxSystem
lastSearch6=GetIEVersion()
lastSearch7=RegRead
lastSearch8=internetexplorer
lastSearch9=needed
lastSearch10=GetLatestLynxVersion
lastSearch1=BannerDotPlx
lastSearch2=ftp:
lastSearch3=TestLynx
lastSearch4=ftp
lastSearch5=UpdatePerlPackages
lastSearch6=TestLynxSystem
lastSearch7=GetIEVersion()
lastSearch8=RegRead
lastSearch9=internetexplorer
lastSearch10=needed

# Replace field
lastReplace1=Firefly-2-Added.ini
Expand Down
10 changes: 7 additions & 3 deletions Lynx-CompileAndRelease.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ fatalIfNotThisPc("PHOSPHORUS")
date:=CurrentTime("hyphendate")
releaseDir=C:\Lynx Server Installs\%date%\

;FIXME this function doesn't work at all? I thought I tested it
AhkClose("Lynx-InstallBootstrap.ahk")

;Create Release Dir
;Copy files to release dir
Loop, C:\Dropbox\AHKs\*.*
Expand All @@ -25,6 +28,7 @@ Loop, C:\Dropbox\AHKs\*.*
;Compile EXEs and put them in the right places
allAhksToCompile=Lynx-Upgrade
allAhksToCompile=Lynx-Maint,Lynx-Install,Lynx-Upgrade
;allAhksToCompile=Lynx-InstallBootstrap,Lynx-Install,Lynx-Upgrade,Lynx-Maint
Loop, parse, allAhksToCompile, CSV
{
thisNameOnly=%A_LoopField%
Expand All @@ -33,15 +37,15 @@ Loop, parse, allAhksToCompile, CSV

notify("Compiling Lynx Script: " . thisAhk)
exePath:=CompileAhk(thisAhk, "MitsiIcon")
Sleep, 3000
Sleep, 1000
FileMove(exePath, terminatorPath, "overwrite")
}
notify("Finishing up... almost done")

;delete this after we move all the junk to the ftp site
;exePath:=CompileAhk("C:\Dropbox\AHKs\Lynx-Install.ahk")
exePath:=CompileAhk("Lynx-Install.ahk")
FileMove(exePath, "E:\Lynx-Install.exe", "overwrite")
exePath:=CompileAhk("Lynx-InstallBootstrap.ahk")
FileMove(exePath, "E:\Lynx-InstallBootstrap.exe", "overwrite")

notify("Finished compiling Lynx scripts")
SleepSeconds(35)
Expand Down
2 changes: 1 addition & 1 deletion Lynx-FcnLib.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ DownloadLynxFile(filename)
url=%downloadPath%/%filename%
dest=%destinationFolder%\%filename%

if (filename == "7.12.zip")
if RegExMatch(filename, "(7.12.zip|Lynx-Install.exe)")
url := StringReplace(url, "/upgrade_files", "")

FileCreateDir, %destinationFolder%
Expand Down
Binary file removed Lynx-Install.exe
Binary file not shown.
26 changes: 26 additions & 0 deletions Lynx-InstallBootstrap.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
;#singleinstance force
#include FcnLib.ahk
#include Lynx-FcnLib.ahk
#include Lynx-ProcedureParts.ahk
;#include Lynx-UpgradeParts.ahk
;#singleinstance force
Lynx_MaintenanceType := "install"

;minimalist startup
msg:="Starting LynxGuide Server Install Bootstrap"
lynx_log(msg)
notify(msg)

;downloading file
installExePath:="C:\temp\lynx_upgrade_files\Lynx-Install.exe"
FileDelete(installExePath)
DownloadLynxFile("Lynx-Install.exe")
;WaitFileExist(installExePath) ;i don't think i need this anymore

;running file
lynx_log("running lynx installer")
Run, %installExePath%

;exit
lynx_log("exiting install bootstrap")
ExitApp
189 changes: 189 additions & 0 deletions Lynx-InstallKickstarter.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
;#singleinstance force
#include FcnLib.ahk
#include Lynx-FcnLib.ahk
;#include Lynx-UpgradeParts.ahk
;#singleinstance force
Lynx_MaintenanceType := "install"

;Beginning of the actual upgrade procedure
notify("Starting Upgrade of the LynxGuide server")
SendStartMaintenanceEmail()
msg("Check to make sure you have a green messenger icon. If not, Inform level 2 support.")
TestScriptAbilities()
RunTaskManagerMinimized()

LynxOldVersion:=GetLynxVersion()
LynxDestinationVersion := GetLatestLynxVersion()
msg("Attempting an upgrade from Lynx Version: " . LynxOldVersion . " to " . LynxDestinationVersion)
CreateSmsKey()
PerlUpgradeNeeded:=IsPerlUpgradeNeeded()
ApacheUpgradeNeeded:=IsApacheUpgradeNeeded()

DownloadAllLynxFilesForUpgrade()

;TODO get client information and insert it into the database (if empty)
; log the info as well
CheckDatabaseFileSize()
GetServerSpecs()
GetClientInfo()
BackupLynxDatabase("BeforeUpdate")

notify("Start of Downtime", "Turning the LynxGuide Server off, in order to perform the upgrade")
TurnOffIisIfApplicable()
StopAllLynxServices()
EnsureAllServicesAreStopped()

UpgradePerlIfNeeded()
CopyInetpubFolder()
UpgradeApacheIfNeeded()
BannerDotPlx()

msg("Run perl checkdb.plx from C:\inetpub\wwwroot\cgi")
CheckDb()

RestartService("apache2.2")
SleepSeconds(2)
InstallAll()

notify("End of Downtime", "The LynxGuide Server should be back up, now we will begin the tests and configuration phase")
EnsureAllServicesAreRunning()

;another checkdb just to ensure that the system is awesome
CheckDb()

;admin login (web interface)
;TODO pull password out of DB and open lynx interface automatically
;TODO ensure all locations are described correctly
msg("(Admin Panel > Change system settings > File system locations and logging):`n`nChange logging to extensive, log age to yearly, message age to never, and log size to 500MB. Save your changes.")
msg("Ask the customer if they have a public subscription page`n`nIf not: Under Home Page and Subscriber Setup, change the home page to no_subscription.htm")
msg("Under back up system, set file system backups quarterly and database backups weekly")
InstallSmsKey()

;security login (web interface)
;TODO pull password out of DB and open lynx interface automatically
msg("Ensure [email protected] is added in the contact list, with the comment 'Lynx Technical Support - Automated Supervision'")
msg("Send Test SMS message, popup (to server), and email (to lynx2).")
LynxNewVersion := GetLynxVersion()
TestLynxSystem()
SendLogsHome()
msg("Disable 000 Supervision on Alarm Groups POPUP and LYNXKEYPRO, if they do not have any destinations set up.")
msg("Ensure the LynxGuide supervision channels 000 Normal, 000 Alarm, 001, 002, 006, 007, 008, 009 are enabled, with the company name in the subject line of each alarm message.")
msg("Ensure lynx2 is a contact for the LynxGuide channels 000 Normal, 000 Alarm, 001, 002, 009")
msg("For all hardware alarm groups, ensure lynx2 is a contact on 000 Normal, 000 Alarm and 990")

;testing
;msg("Note in sugar: Tested SMS and Email to [email protected], failed/passed by [initials] mm-dd-yyyy")
;msg("Note server version, last updated in sugar")
;msg("Make case in sugar for 'Server upgraded to 7.##.##.#', note specific items/concerns addressed with customer in description")

BackupLynxDatabase("AfterUpdate")
ShowUpgradeSummary()
msg("Log off of the server")
SleepMinutes(60*12)
Shutdown, 4
ExitApp


;TODO do all windows updates (if their server is acting funny)
; this is a bad idea cause it will require a reboot

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; functions

;ghetto hotkey
Appskey & r::
SetTitleMatchMode, 2
WinActivate, Notepad
WinWaitActive, Notepad
Sleep, 200
Send, {ALT}fs
Sleep, 200
reload
return


msg(message)
{
message .= "`n`nLynx Maintenance has been paused. Click OK once you have performed the action specified above."
lynx_log("Message displayed to technician...`n" . message)
MsgBox, , Lynx Upgrade Assistant, %message%
}

LynxError(message)
{
msg("ERROR: " . message)
}

;Returns a true or false, confirming that they did or didn't complete this step
;ConfirmMsgBox(message)
;{
;title=Lynx Install

;MsgBox, 4, %title%, %message%
;IfMsgBox, Yes
;return true
;else
;return false
;}

;TODO get important info and condense into a summary
;importantLogInfo(message)
;{
;}

IsPerlUpgradeNeeded()
{
version := GetPerlVersion()

if (version == "5.8.9")
returned := false
else
returned := true

delog(A_ThisFunc, "Determined if the update was needed (next line)", returned, version)
return returned
}

IsApacheUpgradeNeeded()
{
version := GetApacheVersion()

if (version == "2.2.22")
returned := false
else if (version == "2.2.21")
returned := false
else
returned := true

delog(A_ThisFunc, "Determined if the update was needed (next line)", returned, version)
return returned
}

GetLatestLynxVersion()
{
DownloadLynxFile("version.txt")
returned := FileRead("C:\temp\lynx_upgrade_files\version.txt")
return returned
}

EnsureApacheServiceNotExist()
{
serviceName:="apache2.2"
ret := CmdRet_RunReturn("sc query " . serviceName)
if NOT InStr(ret, "service does not exist")
msg("ERROR: An apache service exists, inform level 2 support")
}

AddSqlConnectStringFiles()
{
;path=C:\inetpub\
source1=C:\inetpub\tools\sql.txt
source2=C:\inetpub\tools\sql2.txt
dest1=C:\inetpub\sql.txt
dest2=C:\inetpub\sql2.txt

if NOT FileExist(dest1)
FileCopy(source1, dest1)
if NOT FileExist(dest2)
FileCopy(source2, dest2)
}

58 changes: 56 additions & 2 deletions camerb-OCR-function/OCR-tests.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@
* Tests to verify that the OCR script is running correctly
*/

/*
;usages
GetOCR()
GetOCR(1, 2, 3, 4)
GetOCR("activeWindow")
GetOCR("screenCoords")
GetOCR(1, 2, 3, 4, "activeWindow")
GetOCR(1, 2, 3, 4, "screenCoords")
GetOCR("numeric")
*/

#SingleInstance force
#Include OCR.ahk
;#Include C:\Dropbox\ahks\FcnLib.ahk

tests=GhettoBasicTest,GhettoBasicTest
tests=ReturnsTrue,ReturnsFalse
tests=ReturnsTrue,ReturnsFalse,QGThello,QGTindecision,QGTrecognition,QGTtesting
Loop, parse, tests, CSV
{
testResults .= DynamicallyRunTest(A_LoopField)
Expand Down Expand Up @@ -46,10 +58,52 @@ returnsfalse()
DynamicallyRunTest(testName)
{
results := %testName%()
fullMessage=%results%: %testName%`n

resultsWords=FAILED
if results
resultsWords=Passed

fullMessage=Test %resultsWords%: %testName%`n
return fullMessage
}

QGThello()
{
return QuickGuiUsingDynamicText("hello")
}

QGTindecision()
{
return QuickGuiUsingDynamicText("indecision")
}

QGTrecognition()
{
return QuickGuiUsingDynamicText("recognition")
}

QGTtesting()
{
return QuickGuiUsingDynamicText("testing")
}

QuickGuiUsingDynamicText(expected)
{
;expected=Please enter your name
;TODO fix this using an active window param
Gui, Font, s16
Gui, Add, Text,, %expected%
Gui, Show
;Sleep, 200
result := GetOCR("activeWindow")
;Sleep, 100
Gui, Destroy
msgbox, , , %result%, 2

if InStr(result, expected)
return true
}

GhettoBasicTest()
{
expected=Company Processes
Expand Down
Loading

0 comments on commit bdd014a

Please sign in to comment.