Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SendToPlottor.PS1
- #
- #Spoon feeds commands to the Apple 410 Plotter
- #
- # JP 8/19/2018
- #
- $port= new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
- $port.Handshake="RequestToSend"
- $count= 1
- $WaitAnim ="/","-","\","|"
- $AnimState = 0
- $CmdList = Get-Content $args[0]
- $port.Open()
- Write-Host "`nSarting up!`nThere are" $CmdList.Count "commands...`n`n"
- foreach ($cmd in $CmdList){
- While (-not ($port.DsrHolding)){
- Write-Host -NoNewline $(($WaitAnim[$AnimState]))
- $AnimState++
- if ($AnimState -ge 3) {
- $AnimState = 0
- }
- Start-Sleep -Milliseconds 50
- Write-Host -NoNewline "`b"
- }
- Write-Host -NoNewline " $count "
- $port.WriteLine($cmd)
- $count++
- }
- $port.Close()
- Write-Host "`n`nAll done!`n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement