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 9/8/2018
- #
- $port= new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
- $port.Handshake="RequestToSend"
- $count= 1
- $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)){
- Start-Sleep -Milliseconds 5
- }
- Write-Progress -Activity "Sending file to Plotter..." -Status "Sending command $count of $($CmdList.Count)" -PercentComplete (($count / $CmdList.Count) * 100 )
- $port.WriteLine($cmd)
- $count++
- }
- $port.Close()
- Write-Host "`n`nAll done!`n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement