Skip to content

Commit

Permalink
2012-02-22_03-53-56
Browse files Browse the repository at this point in the history
  • Loading branch information
camerb committed Feb 22, 2012
1 parent bc11269 commit 13d2351
Show file tree
Hide file tree
Showing 8 changed files with 237 additions and 108 deletions.
26 changes: 13 additions & 13 deletions FindMe_Config.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[Settings]
X=
Y=
Width=
Height=
X=740
Y=311
Width=666
Height=546
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=helper
lastSearch2=forcereload
lastSearch3=error 14
lastSearch4=logs.trace.txt
lastSearch5=trace
lastSearch6=getpath..trace
lastSearch1=FeeAdded
lastSearch2=submitted
lastSearch3=helper
lastSearch4=forcereload
lastSearch5=error 14
lastSearch6=logs.trace.txt
lastSearch7=trace
lastSearch8=getpath("trace")
lastSearch9=fireflybot.ini
lastSearch10=fireflyui.ini
lastSearch8=getpath..trace
lastSearch9=trace
lastSearch10=getpath("trace")

# Replace field
lastReplace1=Firefly-2-Added.ini
Expand Down
89 changes: 62 additions & 27 deletions FireflyFeesBot.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,41 @@ Loop, parse, uiSections, CSV
Loop, parse, listFees, CSV
{
thisFee:=A_LoopField
thisKeySubmitted=FeeSubmitted-%thisFee%
thisKeyAdded=FeeAdded-%thisFee%

uiValue:=IniFolderRead(iniFolder, thisReferenceNumber, thisKeySubmitted)
botValue:=IniFolderRead(iniFolder, thisReferenceNumber, thisKeyAdded)

if (botValue == uiValue)
;checking if already added
if IsFeeAddedCorrectly(thisReferenceNumber, thisFee)
continue

;go to the correct file
;if ( Mod(feesAddedCountSoFar, 5) == 0)
RefreshLogin()
ArrangeWindows()
OpenReferenceNumber(thisReferenceNumber)
AddFees(thisFee, uiValue)
IniFolderWrite(iniFolder, thisReferenceNumber, thisKeyAdded, uiValue)
GetFees()

;checking if already added
if IsFeeAddedCorrectly(thisReferenceNumber, thisFee)
continue

;add the friggin fee!
thisKeySubmitted=DesiredFees-%thisFee%
desiredAmount:=IniFolderRead(iniFolder, thisReferenceNumber, "DesiredFees-" . thisFee)
AddFees(thisFee, desiredAmount)
IniFolderWrite(iniFolder, thisReferenceNumber, "BotAddedFee-" . thisFee, desiredAmount)

GetFees()
feesAddedCountSoFar++

msg=Added %feesAddedCountSoFar% fees so far
AddToTrace(msg)
iniPP("Bot Is Working")
;msg=Added %feesAddedCountSoFar% fees so far
;AddToTrace(msg)
;iniPP("Bot Is Working")

;checkin
FireflyCheckin("Bot", "Working")
;displayableIniFolder(inifolder)
}
}
;msg=Added %feesAddedCountSoFar% fees so far
;AddToTrace(msg)
;AddToTrace("chillin")
iniPP("Bot Is Chillin")
;iniPP("Bot Is Chillin")

Sleep, 1000
KillFirefox()
Expand All @@ -66,6 +72,7 @@ ExitApp
;works great on bot
AddFees(name, amount)
{
iniFolder:=GetPath("FireflyIniFolder")
feesJson := GetSimpleFeesJson()
type := json(feesJson, name . ".type")

Expand Down Expand Up @@ -119,22 +126,24 @@ AddFees(name, amount)
Sleep, 30000

;POLISH sanity check using GetFees()
AllTheFeesJson := GetFees()
result := json(AllTheFeesJson, name)
if (result == amount)
msg=fee added correctly
else
msg=ERROR-looks like bot failed to add the fee correctly

ArrangeWindows()
FindTopOfFirefoxPage()
referenceNumber:=GetReferenceNumber()

IniFolderWrite(GetPath("FireflyIniFolder"), referenceNumber, "FeesAddedMessage-" . name, msg)
;AllTheFeesJson := GetFees()
;result := json(AllTheFeesJson, name)
;if (result == amount)
;msg=fee added correctly
;else
;msg=ERROR-looks like bot failed to add the fee correctly

;ArrangeWindows()
;FindTopOfFirefoxPage()
;referenceNumber:=GetReferenceNumber()

;IniFolderWrite(iniFolder, referenceNumber, "FeesAddedMessage-" . name, msg)
}

GetFees()
{
iniFolder:=GetPath("FireflyIniFolder")

OpenFeesWindow()

WFCIImageSearch(FixImagePathIfBot("images/firefly/fees/referenceNumber.bmp"))
Expand Down Expand Up @@ -175,8 +184,12 @@ GetFees()
FeeType%i%:=thisFeeType
FeeName%i%:=thisFee
json(AllTheFeesJson, thisFee, thisFeeAmount)

if (thisFeeAmount != "")
{
numberOfFeesCounted++
IniFolderWrite(iniFolder, referenceNumber, "FeesOnFile-" . thisFee, thisFeeAmount)
}
}

;this probably isn't a big error, cause I wrote the stuff above to only account for some of the fees
Expand Down Expand Up @@ -226,6 +239,28 @@ IsFeesWindowOpen()
return %joe% AND %bob%
}

IsFeeAddedCorrectly(referenceNumber, fee)
{
iniFolder:=GetPath("FireflyIniFolder")
thisKeySubmitted=DesiredFees-%fee%
thisKeyAdded=FeesOnFile-%fee%

;checking if already added
desiredValue := IniFolderRead(iniFolder, referenceNumber, thisKeySubmitted)
actualValue := IniFolderRead(iniFolder, referenceNumber, thisKeyAdded)

;if there are additional fees, that's ok
;only fuss about fees that Melinda told the bot she wanted to add
if (desiredValue == "ERROR")
return true

;the fee is already there
if (desiredValue == actualValue)
return true
else
return false
}

ExitApp

/*
Expand Down
5 changes: 4 additions & 1 deletion cliprun.ahk
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include FcnLib.ahk

Run, C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe
205.6
217
219
201.4


~esc::ExitApp
4 changes: 3 additions & 1 deletion firefly-FcnLib.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ DisplayableIniFolder(iniFolder)
{
iniFolder := EnsureEndsWith(iniFolder, "\")
destIni := iniFolder . "viewable\viewable.ini"
FileDelete(destIni)

sections:=IniFolderListAllSections(iniFolder)
Loop, parse, sections, CSV
Expand Down Expand Up @@ -727,7 +728,8 @@ IniFolderListAllKeys(iniFolder, section="") ;defaults to all sections
;np=[^()]
;haystack=\((%notParen%+)\)\-\(%notParen%+\)
;returned := RegExReplace(returned, haystack, "$1")
returned := RegExReplace(returned, "\-(value|timestamp)$")
;returned := RegExReplace(returned, "\-(value|timestamp)$")
returned := RegExReplace(returned, "\-(value|timestamp)")

return returned
}
Expand Down
Loading

0 comments on commit 13d2351

Please sign in to comment.