KilliK Δημοσ. 20 Μαΐου 2016 Δημοσ. 20 Μαΐου 2016 Χαίρεται. Βρηκα ενα script στο νετ το οποιο κανει unhide τα windows tray icons. το δοκιμασα και δουλευει αλλα το script ζηταει δυο παραμετρους που χρειαζεται καθε φορα που το τρεχω. επειδη οι παραμετροι στην περιπτωση μου ειναι συγκεκριμενοι και θελω να τρεχω το script στον task scheduler καθημερινα, τι πρεπει να αλλαξω στον κωδικα του ωστε να τρεχει κατευθειαν αυτες τις παραμετρους χωρις να μου τις ζηταει; οριστε ο κωδικας: source link: https://tmintner.wordpress.com/2011/07/08/windows-7-notification-area-automation-falling-back-down-the-binary-registry-rabbit-hole/ param([Parameter(Mandatory=$true,HelpMessage='The name of the program')][string]$ProgramName,[Parameter(Mandatory=$true,HelpMessage='The setting (2 = show icon and notifications 1 = hide icon and notifications, 0 = only show notifications')][ValidateScript({if ($_ -lt 0 -or $_ -gt 2) { throw 'Invalid setting' } return $true})][int16]$Setting)$encText = New-Object System.Text.UTF8Encoding[byte[]] $bytRegKey = @()$strRegKey = ""$bytRegKey = $(Get-ItemProperty $(Get-Item 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify').PSPath).IconStreamsfor($x=0; $x -le $bytRegKey.Count; $x++){$tempString = [Convert]::ToString($bytRegKey[$x], 16)switch($tempString.Length){0 {$strRegKey += "00"}1 {$strRegKey += "0" + $tempString}2 {$strRegKey += $tempString}}}[byte[]] $bytTempAppPath = @()$bytTempAppPath = $encText.GetBytes($ProgramName)[byte[]] $bytAppPath = @()$strAppPath = ""Function Rot13($byteToRot){if($byteToRot -gt 64 -and $byteToRot -lt 91){$bytRot = $($($byteToRot - 64 + 13) % 26 + 64)return $bytRot}elseif($byteToRot -gt 96 -and $byteToRot -lt 123){$bytRot = $($($byteToRot - 96 + 13) % 26 + 96)return $bytRot}else{return $byteToRot}}for($x = 0; $x -lt $bytTempAppPath.Count * 2; $x++){If($x % 2 -eq 0){$curbyte = $bytTempAppPath[$([int]($x / 2))]$bytAppPath += Rot13($curbyte)}Else{$bytAppPath += 0}}for($x=0; $x -lt $bytAppPath.Count; $x++){$tempString = [Convert]::ToString($bytAppPath[$x], 16)switch($tempString.Length){0 {$strAppPath += "00"}1 {$strAppPath += "0" + $tempString}2 {$strAppPath += $tempString}}}if(-not $strRegKey.Contains($strAppPath)){Write-Host Program not found. Programs are case sensitive.break}[byte[]] $header = @()$items = @{}for($x=0; $x -lt 20; $x++){$header += $bytRegKey[$x]}for($x=0; $x -lt $(($bytRegKey.Count-20)/1640); $x++){[byte[]] $item=@()$startingByte = 20 + ($x*1640)$item += $bytRegKey[$($startingByte)..$($startingByte+1639)]$items.Add($startingByte.ToString(), $item)}foreach($key in $items.Keys){$item = $items[$key]$strItem = ""$tempString = ""for($x=0; $x -le $item.Count; $x++){$tempString = [Convert]::ToString($item[$x], 16)switch($tempString.Length){0 {$strItem += "00"}1 {$strItem += "0" + $tempString}2 {$strItem += $tempString}}}if($strItem.Contains($strAppPath)){Write-Host Item Found with $ProgramName in item starting with byte $key$bytRegKey[$([Convert]::ToInt32($key)+528)] = $settingSet-ItemProperty $($(Get-Item 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify').PSPath) -name IconStreams -value $bytRegKey}}
Moderators Spect~ Δημοσ. 22 Μαΐου 2016 Moderators Δημοσ. 22 Μαΐου 2016 δοκιμασε αυτο! Αντικατεστησε αυτο param( [Parameter(Mandatory=$true,HelpMessage='The name of the program')][string]$ProgramName, [Parameter(Mandatory=$true,HelpMessage='The setting (2 = show icon and notifications 1 = hide icon and notifications, 0 = only show notifications')] [ValidateScript({if ($_ -lt 0 -or $_ -gt 2) { throw 'Invalid setting' } return $true})] [Int16]$Setting ) με αυτο $ProgramName = 'Χ' (Χ= το ονομα του προγραμματος) $Setting = Χ (Χ= η τιμη που εβαζες πριν) θα γινει καπως ετσι $ProgramName = 'chrome' $Setting = 0 $encText = New-Object System.Text.UTF8Encoding [byte[]] $bytRegKey = @() $strRegKey = "" ..
Προτεινόμενες αναρτήσεις
Δημιουργήστε ένα λογαριασμό ή συνδεθείτε για να σχολιάσετε
Πρέπει να είστε μέλος για να αφήσετε σχόλιο
Δημιουργία λογαριασμού
Εγγραφείτε με νέο λογαριασμό στην κοινότητα μας. Είναι πανεύκολο!
Δημιουργία νέου λογαριασμούΣύνδεση
Έχετε ήδη λογαριασμό; Συνδεθείτε εδώ.
Συνδεθείτε τώρα