Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. # Итак, план
  2. # Понимаем какой день недели
  3. # Забиваем ворк-дей на следующий четверг
  4. # Делаем замену в шаблоне
  5. # Сохраняем его в нужную папку под нужным именем
  6. # Печатаем его.
  7.  
  8. $strSourceRTFTpl = "template\template.rtf"
  9. $datePlannedDay = (get-date).AddDays(11 - (Get-Date).DayOfWeek.value__)
  10. $strPlannedDay = $datePlannedDay.ToString("dd.MM.yyyy")
  11. $strCurrYear = get-date -Format yyyy
  12. $strOutputPlan = $env:userprofile + "\Documents\Рабочий архив\Планы работ\" + $datePlannedDay.ToString("yyyyMMdd") + "_план работ.rtf"
  13. Get-Content $strSourceRTFTpl | ForEach-Object {$_ -replace 'curryear', $strCurrYear} | ForEach-Object {$_ -replace 'workdate', $strPlannedDay} | Set-Content $strOutputPlan
  14. Start-Process -FilePath $strOutputPlan -Verb Print
  15.  
  16. [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
  17.  
  18. $objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon
  19.  
  20. $objNotifyIcon.Icon = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SetupCache\v4.5.51209\RUS\Graphics\warn.ico"
  21. $objNotifyIcon.BalloonTipIcon = "Warning"
  22. $objNotifyIcon.BalloonTipText = "На принтер отправлен новый план работ. Сходи и подпиши!"
  23. $objNotifyIcon.BalloonTipTitle = "Подготовлен план работ"
  24.  
  25. $objNotifyIcon.Visible = $True
  26. $objNotifyIcon.ShowBalloonTip(10000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement