Advertisement
compu_85

Apple Color Plotter Transfer

Sep 12th, 2018
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SendToPlottor.PS1
  2. #
  3. #Spoon feeds commands to the Apple 410 Plotter
  4. #
  5. # JP 9/8/2018
  6. #
  7.  
  8. $port= new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
  9. $port.Handshake="RequestToSend"
  10. $count= 1
  11.  
  12. $CmdList = Get-Content $args[0]
  13. $port.Open()
  14.  
  15. Write-Host "`nSarting up!`nThere are" $CmdList.Count "commands...`n`n"
  16.  
  17. foreach ($cmd in $CmdList){
  18.     While (-not ($port.DsrHolding)){
  19.         Start-Sleep -Milliseconds 5
  20.         }
  21.  
  22.     Write-Progress -Activity "Sending file to Plotter..." -Status "Sending command $count of $($CmdList.Count)" -PercentComplete (($count / $CmdList.Count) * 100 )
  23.     $port.WriteLine($cmd)
  24.     $count++
  25.     }
  26.  
  27. $port.Close()
  28. Write-Host "`n`nAll done!`n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement