I'd like to increment the number after M by 1 in "$wshell.SendKeys('M1 ABCD')" every loop based on user input. The first loop will type "M1 ABCD", 2nd "M2 ABCD", 3rd "M3 ABCD" until the script reaches the requested number of loop from user input.
Here is a small part of the script (Pre-reqs not included)
Param(
[Parameter(
Mandatory=$true,
Position=0,
HelpMessage="how many times do you want to run?")
]
$Number
)
$i = 0
while($i -lt $number){ #Number of times the loop repeats
Write-host "Loop run #$($i + 1)"
[Clicker]::LeftClickAtPoint(744,277)
$wshell.SendKeys('{DOWN}')
$wshell.SendKeys('{ENTER}')
$wshell.SendKeys('{TAB}')
Sleep -Milliseconds 600
$wshell.SendKeys('M1 ABCD')
$wshell.SendKeys('{DOWN}')
$wshell.SendKeys('{ENTER}')
$i++
}
$wshell.SendKeys('M1 ABCD')to$wshell.SendKeys("M$($i++) ABCD")(note the double quotes!)