dkwokgs Posted July 24, 2014 Share Posted July 24, 2014 (edited) please advise. Thanks. http://www.sevenforums.com/customization/162395-vbscript-add-program-notification-area.html expandcollapse popupparam( [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).IconStreams for($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)] = $setting Set-ItemProperty $($(Get-Item 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify').PSPath) -name IconStreams -value $bytRegKey } } Edited July 24, 2014 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 24, 2014 Moderators Share Posted July 24, 2014 dkwokgs,When you post code please use Code tags - see here how to do it. Then you get a scrolling box (and syntax colouring for AutoIt code) as you can see above now I have added the tags. M23 dkwokgs 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now