SCF Advanced Search



Members
  • Total Members: 14197
  • Latest: Levine
Stats
  • Total Posts: 43455
  • Total Topics: 16546
  • Online today: 2845
  • Online ever: 51419
  • (01. January 2010., 10:27:49)
Users Online
Users: 1
Guests: 2842
Total: 2843









Author Topic: Help with vbscript  (Read 4026 times)

0 Members and 1 Guest are viewing this topic.

F3RL

  • SCF Advanced Member
  • ***
  • Posts: 171
  • KARMA: 18
  • Gender: Male
Help with vbscript
« on: 20. November 2009., 23:56:48 »
Hi,

I got this vbscript that clears system tray notification icons by deleting two registry entries.
The problem is I want to execute this when logging off but it displays two messages;
and I want someone to instruct me how to remove that message but continue executing the script.

here is the script;
------------------------------------------------------------------------------
Message = "To work correctly, the script will close" & vbCR
Message = Message & "and restart the Windows Explorer shell." & vbCR
Message = Message & "This will not harm your system." & vbCR & vbCR
Message = Message & "Continue?"

X = MsgBox(Message, vbYesNo, "Notice")

If X = 6 Then

On Error Resume Next

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify\IconStreams"
WshShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify\PastIconsStream"

Set WshShell = Nothing

On Error GoTo 0

For Each Process in GetObject("winmgmts:"). _
   ExecQuery ("select * from Win32_Process where name='explorer.exe'")
   Process.terminate(0)
Next

MsgBox "Finished." & vbcr & vbcr & "© Doug Knox and Kelly Theriot", 4096, "Done"

Else

MsgBox "No changes were made to your system." & vbcr & vbcr & "© Doug Knox and Kelly Theriot", 4096, "User Cancelled"

End If
------------------------------------------------------------------------------

Can you help me remove the message popups?

Thank you in advance.
well? understand ma bad English.

Samker's Computer Forum - SCforum.info

Help with vbscript
« on: 20. November 2009., 23:56:48 »

hazedaze

  • SCF VIP Member
  • *****
  • Posts: 85
  • KARMA: 19
  • Gender: Male
Re: Help with vbscript
« Reply #1 on: 18. January 2010., 13:58:31 »
OMG I'm trying to rember my VB days at College!!!lol

If my thinking is correct can't you simply put "REM" at the begining of the Msgbox sentence,

Your Code for example Would Read:

Message = "To work correctly, the script will close" & vbCR
Message = Message & "and restart the Windows Explorer shell." & vbCR
Message = Message & "This will not harm your system." & vbCR & vbCR
Message = Message & "Continue?"

X = MsgBox(Message, vbYesNo, "Notice")

If X = 6 Then

On Error Resume Next

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify\IconStreams"
WshShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify\PastIconsStream"

Set WshShell = Nothing

On Error GoTo 0

For Each Process in GetObject("winmgmts:"). _
   ExecQuery ("select * from Win32_Process where name='explorer.exe'")
   Process.terminate(0)
Next

Rem MsgBox "Finished." & vbcr & vbcr & "© Doug Knox and Kelly Theriot", 4096, "Done"

Else

Rem MsgBox "No changes were made to your system." & vbcr & vbcr & "© Doug Knox and Kelly Theriot", 4096, "User Cancelled"

End If

Samker's Computer Forum - SCforum.info

Re: Help with vbscript
« Reply #1 on: 18. January 2010., 13:58:31 »

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
Second Anti-Bot trap, type or simply copy-paste below (only the red letters):www.codekids.ba:

Enter your email address to receive daily email with 'SCforum.info - Samker's Computer Forum' newest content:

Kursevi programiranja za ucenike u Sarajevu

Terms of Use | Privacy Policy | Advertising
TinyPortal 2.3.1 © 2005-2023