How to use conditions in autohotkey

autohotkey

Friends I am copying data from excel sheet and pasting it in some online form. There are four fields in that online form like first is customer name, second is father name, third is address and forth is contact no. and I have all this information in an excel sheet which I am copying using the following autohotkey script-

F2::
Loop
}
Send, {CTRLDOWN}c{CTRLUP}{ALTDOWN}{TAB}{ALTUP}
SLEEP 100
Send, {CTRLDOWN}v{CTRLUP}{TAB}{ALTDOWN}{TAB}{ALTUP}
SLEEP 100
Send, {DOWN}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{ALTUP}
SLEEP 100
Send, {CTRLDOWN}v{CTRLUP}{TAB}{ALTDOWN}{ALTUP}
SLEEP 100
Send, {DOWN}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{TAB}{ALTUP}
SLEEP 100
Send, {CTRLDOWN}v{CTRLUP}{TAB}{ALTDOWN}{ALTUP}
SLEEP 100
Send, {DOWN}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{TAB}{ALTUP}
SLEEP 100
Send, {CTRLDOWN}v{CTRLUP}{ALTDOWN}{ALTUP}
SLEEP 100
Send, {right}{up}{up}{up}{up}
}
Return

But here the problem is that if the information already exists in the online form like second field i.e. father name already exist in that online form even then it pastes the data on that field and I have to reload the script and have to manually fill the rest fields and then run the script again. It causes trouble and every thing is messed up. So is there any way or method by which we can apply condition in the script that if there is already any data in any of the four fields then it should not send anything in that field in which there is already some data. Thanks.

Best Answer

Instead of worrying about conditional statements, and checking the contents of the form fields, if this is a freshly filled out form each time you run the script, why not just build in a Ctrl+A and Delete for each field before entering in the necessary data?

Related Question