Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ########################################################################
  2. ####         sets Desktop background to color RGB(0,140,60)         ####
  3. ########################################################################
  4.  
  5. $code = @'
  6. using System;using System.Drawing;using System.Runtime.InteropServices;using Microsoft.Win32;namespace Background { public class Setter {[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]        private static extern int SystemParametersInfo(int uAction, int uParm, string lpvParam, int fuWinIni);[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError =true)]        private static extern int SetSysColors(int cElements, int[] lpaElements, int[] lpRgbValues);        public const int UpdateIniFile = 0x01;        public const int SendWinIniChange = 0x02;        public const int SetDesktopBackground = 0x0014;        public const int COLOR_DESKTOP = 1;        public int[] first = {COLOR_DESKTOP};        public static void RemoveWallPaper() {        SystemParametersInfo( SetDesktopBackground, 0, "", SendWinIniChange | UpdateIniFile );        RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true);        key.SetValue(@"WallPaper", 0);        key.Close();        }        public static void SetBackground(byte r, byte g, byte b) {            RemoveWallPaper();            System.Drawing.Color color= System.Drawing.Color.FromArgb(r,g,b);            int[] elements = {COLOR_DESKTOP};            int[] colors = { System.Drawing.ColorTranslator.ToWin32(color) };            SetSysColors(elements.Length, elements, colors);            RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Colors", true);            key.SetValue(@"Background", string.Format("{0} {1} {2}", color.R, color.G, color.B));            key.Close();        }    }}
  7. '@
  8.            
  9. Add-Type -TypeDefinition $code -ReferencedAssemblies System.Drawing.dll -PassThru
  10. Function Set-OSCDesktopColor{    Process    {        [Background.Setter]::SetBackground(0,140,60)        return    }}
  11.  
  12. Set-OSCDesktopColor
  13.  
  14.  
  15.  
  16.  
  17. ########################################################################
  18. ####              Add A Lot Of Text Files to Desktop                ####
  19. ########################################################################
  20.  
  21. $desktop = $home + "\Desktop\"
  22.  
  23. cd $desktop
  24. $urls = @("https://i.redd.it/us8jkfst2du21.jpg", "https://i.redd.it/ifeal9box0a21.jpg", "https://i.redd.it/q6utpkxkdh411.png", "https://i.redd.it/hohph8sqjuw11.jpg",
  25.             "https://i.redd.it/rrmx650qw8f21.jpg", "https://i.redd.it/kxwmilb75hw11.jpg", "https://i.redd.it/6p9fsr0rwrc21.jpg", "https://i.imgur.com/DzHWBRE.jpg", "https://i.redd.it/m74rv8svr4o11.jpg",
  26.             "https://i.imgur.com/82uj8f7.jpg", "https://i.redd.it/0u408ctxxhl21.jpg", "https://i.redd.it/hw5m0sjxtyd11.jpg", "https://i.redd.it/uy8cucln0ec21.jpg", "https://i.imgur.com/JgpajdL.jpg",
  27.             "https://i.redd.it/m6rrhmgg3fb01.jpg", "https://i.redd.it/pynj45igul821.jpg", "https://i.imgur.com/u91v5qw.jpg", "https://i.redd.it/ajl01hubyyg01.jpg", "https://i.redd.it/rsw5kvolx5w11.jpg",
  28.             "https://i.redd.it/0mquutruic821.jpg", "https://i.redd.it/72nycfabvea21.jpg", "https://i.redd.it/0nd89dgqbd201.jpg", "https://i.redd.it/wdlkk9xtyfvz.jpg")
  29.  
  30. for ($i=0; $i -lt $urls.length; $i++) {
  31.     $file = "megan" + $i + ".jpg"
  32.     Invoke-WebRequest -Uri $urls[$i] -OutFile $file
  33. }
  34.  
  35. gci -Path $desktop -Filter '*.jpg' | ii
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement