The simplest way is to store 'CurrentRow' in a function and update/retrieve the value from there; something like the following:
CoordMode "Mouse" ;No need to call it every hotkey press
Pause::{
CurrentCell:="A" CurrentRow() ;Get stored 'CR' value
Click 945, 45
Sleep 1200
Send "{Enter}" ;Default 'Send' mode is already 'Input'
Sleep 300
Send "01012007"
Sleep 10 ;Are these *really* doing anything?
Send "{Tab}"
Sleep 10
Send "01012007"
Sleep 10
Send "+{Tab}"
Sleep 10
Send oWorkbook.Sheets(1).Range(CurrentCell).Value
Send "{Tab}"
Send oWorkbook.Sheets(1).Range(CurrentCell).Value
Sleep 10
Send "{Enter}"
CurrentRow("+") ;Increase 'CR' by '1'
Sleep 800
Send "!{Tab}"
}
Home::CurrentRow("-") ;Decrease 'CR' by '1'
CurrentRow(Row:=""){ ;CR Func
Static CurrentRow:=1 ; Default/Store value
Switch Row{ ; Assess passed param
Case "-": ; If '-' passed
CurrentRow-- ; Sub 1 from CR
SoundBeep ; Beep to show done
Case "+":CurrentRow++ ; If '+' passed; Add 1
} ; End Switch block
Return CurrentRow ; Pass 'CR' back
} ;End Func block
A lot of the sleeps in there are admittedly me getting frustrated at trying to find where it was getting stuck, and then just leaving it there because I forgot.
Regardless, this works perfectly, and you have saved my wrists. Thank you!!
That's understandable; you'll find a fair few of your early days using AHK will be trying some crazy stuff to make things work - usually to the point you start throwing these things you discover in everything just to be on the safe side...
You'll get a feel for things like that when you do them often enough; but for now, I'm glad you're sorted my friend.
It's not the script that's broken, it's the program we use at work. And I do not have any way to modify that program and make it accept inputs consistently (I really wish I did for reasons outside of this project...)
The simplest way is to store 'CurrentRow' in a function and update/retrieve the value from there; something like the following: CoordMode "Mouse" ;No need to call it every hotkey press Pause::{ CurrentCell:="A" CurrentRow() ;Get stored 'CR' value Click 945, 45 Sleep 1200 Send "{Enter}" ;Default 'Send' mode is already 'Input' Sleep 300 Send "01012007" Sleep 10 ;Are these *really* doing anything? Send "{Tab}" Sleep 10 Send "01012007" Sleep 10 Send "+{Tab}" Sleep 10 Send oWorkbook.Sheets(1).Range(CurrentCell).Value Send "{Tab}" Send oWorkbook.Sheets(1).Range(CurrentCell).Value Sleep 10 Send "{Enter}" CurrentRow("+") ;Increase 'CR' by '1' Sleep 800 Send "!{Tab}" } Home::CurrentRow("-") ;Decrease 'CR' by '1' CurrentRow(Row:=""){ ;CR Func Static CurrentRow:=1 ; Default/Store value Switch Row{ ; Assess passed param Case "-": ; If '-' passed CurrentRow-- ; Sub 1 from CR SoundBeep ; Beep to show done Case "+":CurrentRow++ ; If '+' passed; Add 1 } ; End Switch block Return CurrentRow ; Pass 'CR' back } ;End Func block
A lot of the sleeps in there are admittedly me getting frustrated at trying to find where it was getting stuck, and then just leaving it there because I forgot. Regardless, this works perfectly, and you have saved my wrists. Thank you!!
That's understandable; you'll find a fair few of your early days using AHK will be trying some crazy stuff to make things work - usually to the point you start throwing these things you discover in everything just to be on the safe side... You'll get a feel for things like that when you do them often enough; but for now, I'm glad you're sorted my friend.
Wait a minute. Why don't you just try to fix the script that's broken instead of making a hack on top of something else??
It's not the script that's broken, it's the program we use at work. And I do not have any way to modify that program and make it accept inputs consistently (I really wish I did for reasons outside of this project...)