This seems to be simple. I am somehow entering the wrong variable when it comes to excel.
Code: Select all
;INI INFO
Global runs, ini, track, end, override
start := A_TickCount
minutes := 45
end := start + 1000 * 60 * minutes
ini := StrReplace(A_ScriptFullPath, ".ahk", ".ini")
;___________________________________________________________________________________________________________________________________________________________________________________________
;DDL INFO
real := {"Red John": "John Red", "Blue John": "John Blue", "Green John": "John Green"} ;ACTUAL NAME AS SAVED IN THE PHONE CONTACTS
Gui, Font, s20 Bold cBlack
Gui, Add, DropDownList, h500 w300 vnick, Red John|Blue John|Green John| ; NAME IN USE
;___________________________________________________________________________________________________________________________________________________________________________________________
;DDL INFO
Gui, Font, s10 Bold cBlack
Gui, Add, Button, Default, Input
OnExit("done")
Show:
Gui, Show
Return
ButtonInput:
Gui, Submit
Gui, Destroy
Sleep, 50
;______________________________________________________________________________________________________________________________________________________________
;INI FILE ENTRIES
Gosub, Show
track := RegExReplace(nick, "[. ]", "_")
IniRead, year , %ini%, %track%, year
IniRead, month, %ini%, %track%, month
IniRead, runs , %ini%, %track%, runs, 0
If (year != A_YYYY || month != A_MM) {
IniWrite, %A_YYYY% , %ini%, %track%, year
IniWrite, %A_MM% , %ini%, %track%, month
IniWrite, % runs := 1, %ini%, %track%, runs
} Else IniWrite, % ++runs , %ini%, %track%, runs
done(ExitReason := "", ExitCode := "") {
If !override && A_TickCount < end
IniWrite, % --runs, %ini%, %track%, runs
}
;Excel
xl := ComObjCreate("excel.application")
wrkbk := xl.workbooks.open("C:\Users\user\Desktop\New Microsoft Excel Worksheet (2).xlsx")
lstrw := xl.Range("B" xl.Rows.Count).End(-4162).Row
mnth := strsplit(xl.Range("C" lstrw).value, "-").2
nwrw := lstrw + 1
nmbr := xl.Range("B" lstrw).value
if nmbr is not number
nmbr := 0
if (mnth != A_MMM) {
nmbr := 0
nwrw++
}
;ENTRIES
xl.Range("A" nwrw):= "%nick%"
xl.Range("B" nwrw):= "%runs%"
xl.Range("B" nwrw).NumberFormat := "## "
xl.Range("C" nwrw).value := A_DD "-" A_MM "-" A_YYYY
xl.Range("D" nwrw).NumberFormat := "[$-en-US]h:mm Am/Pm;@"
xl.range("D" nwrw).value := A_Hour ":" A_Min ":" A_Sec
wrkbk.close(1)
xl.quit()
In column B I want the runs to be entered
Using %runs% and %nick% worked when I tested it with a msgbox
How to make excel enter the name selected from the DDL in column A and the runs in column B
I will be very grateful if anyone can kindly educate me.
Regards.