Help Setting Up A Script to Generate an HTML Table
Posted: 15 Nov 2019, 15:56
Hi, I'm new to Auto HotKey scripting, and scripting in general. I wanted to make this script to help me learn more about the program, but I'm stuck! The idea is to generate an HTML table based on the number of rows and columns the user defines. The biggest issue I'm having is how to increase the variable within the loop. %%variable%% is the best I could come up with, but I know this doesn't work. I'm sure there are a ton of other issues I'm unaware of. Thanks for your help!
Code: Select all
:*:addtable::
rowNum := 1
colNum := 1
varNum := 1
thNum := 1
colText := 1
InputBox, Col, How many columns?
InputBox, Row, How many rows?
Loop, %Row% {
Loop, %Col% {
InputBox, %varNum%, Row %rowNum% Column %colNum%
colNum := colNum + 1
varNum := varNum + 1
}
colNum := 1
rowNum := rowNum + 1
varNum := varNum + 1
}
send <table class="table mb-5">{enter}<tbody>
Loop, %Row% {
send <tr>{enter}<th scope="row">%thNum%</th>{enter}
Loop, %Col% {
<td>%%colText%%</td>{enter}
colText := colText + 1
}
send </tr>{enter}
varNum := varNum + 1
thNum := thNum + 1
}
send </tbody>{enter}</table>
return