Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Get-FileName
- {
- param (
- [Parameter(Mandatory=$True)] [String]$Dateien = "*"
- )
- [System.Reflection.Assembly]::LoadWithPartialName(“System.windows.forms”) |
- Out-Null
- $EingabeFenster = New-Object System.Windows.Forms.OpenFileDialog
- $EingabeFenster.initialDirectory = "C:"
- $EingabeFenster.filter = “All files (*.$Dateien)| *.$Dateien”
- $EingabeFenster.ShowDialog() | Out-Null
- $EingabeFenster.filename
- }
- Function Set-Wallpaper([string]$pfad)
- {
- Remove-ItemProperty -path "HKCU:\Control Panel\Desktop" -name WallPaper
- set-itemproperty -path "HKCU:Control Panel\Desktop" -name WallPaper -value $pfad
- Sleep -seconds 5
- RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True
- }
- Function Get-Wallpaperpath
- {
- $Bildpfad = Get-FileName($Dateien = "bmp")
- Set-WallPaper -value "$Bildpfad"
- }
- Function Get-Prompthash
- {
- $Hashpfad = Get-FileName($Dateien = "*")
- $Test = Get-FileHash -Path "$Hashpfad"
- Write-Host $Test.hash
- }
- Function Get-Processname
- {
- $sortfile = Get-FileName($Dateien = "*")
- $newfile = $sortfile.split(".")[-1]
- $filename = $sortfile.split("\")[-1]
- $pathname = $sortfile.replace($filename,"")
- cd $pathname
- new-item -Path $pathname -name "Aufgeräumte $newfile" -ItemType "directory" -Force
- move-item "*.$newfile" -Destination "Aufgeräumte $newfile"
- }
- function GenerateForm {
- [reflection.assembly]::loadwithpartialname(“System.Windows.Forms”) | Out-Null
- [reflection.assembly]::loadwithpartialname(“System.Drawing”) | Out-Null
- $MainForm = New-Object System.Windows.Forms.Form
- $Button1 = New-Object System.Windows.Forms.Button
- $Button2 = New-Object System.Windows.Forms.Button
- $Button3 = New-Object System.Windows.Forms.Button
- $InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
- $handler_Button1_Click=
- {
- Get-Wallpaperpath
- }
- $handler_Button2_Click=
- {
- Get-Prompthash
- }
- $handler_Button3_Click=
- {
- Get-Processname
- }
- $OnLoadForm_StateCorrection=
- {
- $MainForm.WindowState = $InitialFormWindowState
- }
- $MainForm.Text = “Fenster”
- $MainForm.Name = “MainForm”
- $MainForm.DataBindings.DefaultDataSourceUpdateMode = 0
- $System_Drawing_Size = New-Object System.Drawing.Size
- $System_Drawing_Size.Width = 165
- $System_Drawing_Size.Height = 125
- $MainForm.ClientSize = $System_Drawing_Size
- $Button1.TabIndex = 0
- $Button1.Name = “Button1”
- $Button2.TabIndex = 1
- $Button2.Name = "Button2"
- $Button2.TabIndex = 2
- $Button2.Name = "Button3"
- $System_Drawing_Size = New-Object System.Drawing.Size
- $System_Drawing_Size.Width = 130
- $System_Drawing_Size.Height = 22
- $Button1.Size = $System_Drawing_Size
- $Button1.UseVisualStyleBackColor = $True
- $Button1.Text = “Hintergrund setzen”
- $System_Drawing_Size = New-Object System.Drawing.Size
- $System_Drawing_Size.Width = 140
- $System_Drawing_Size.Height = 22
- $Button2.Size = $System_Drawing_Size
- $Button2.UseVisualStyleBackColor = $True
- $Button2.Text = “Hashwert berechnen”
- $System_Drawing_Size = New-Object System.Drawing.Size
- $System_Drawing_Size.Width = 140
- $System_Drawing_Size.Height = 22
- $Button3.Size = $System_Drawing_Size
- $Button3.UseVisualStyleBackColor = $True
- $Button3.Text = “Aufräumen”
- $System_Drawing_Point = New-Object System.Drawing.Point
- $System_Drawing_Point.X = 13
- $System_Drawing_Point.Y = 13
- $Button1.Location = $System_Drawing_Point
- $Button1.DataBindings.DefaultDataSourceUpdateMode = 0
- $Button1.add_Click($handler_Button1_Click)
- $System_Drawing_Point = New-Object System.Drawing.Point
- $System_Drawing_Point.X = 13
- $System_Drawing_Point.Y = 53
- $Button2.Location = $System_Drawing_Point
- $Button2.DataBindings.DefaultDataSourceUpdateMode = 0
- $Button2.add_Click($handler_Button2_Click)
- $System_Drawing_Point = New-Object System.Drawing.Point
- $System_Drawing_Point.X = 13
- $System_Drawing_Point.Y = 93
- $Button3.Location = $System_Drawing_Point
- $Button3.DataBindings.DefaultDataSourceUpdateMode = 0
- $Button3.add_Click($handler_Button3_Click)
- $MainForm.Controls.Add($Button1)
- $MainForm.Controls.Add($Button2)
- $MainForm.Controls.Add($Button3)
- $InitialFormWindowState = $MainForm.WindowState
- $MainForm.add_Load($OnLoadForm_StateCorrection)
- $MainForm.ShowDialog()| Out-Null
- }
- GenerateForm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement