Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it
    Registrato dal
    Apr 2007
    Messaggi
    2

    Start --> Esegui.

    Ciao ragazzi

    potreste aiutarmi a modificare questo script?


    On Error Resume Next
    strExplain="ClearRunMRU clears individual items from the Start - Run MRU (a list of recently run commands)." & vbCRLF & "The program will prompt for each item in the list." & vbCRLF & vbCRLF
    strTitle="Clear Run MRU"

    Dim Sh
    Set Sh = WScript.CreateObject("WScript.Shell")
    ReportErrors "Creating Shell"
    Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Ap p Paths\" & Wscript.ScriptName & "\", Chr(34) & Wscript.ScriptFullName & Chr(34)
    Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Ap p Paths\" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "\", Chr(34) & Wscript.ScriptFullName & Chr(34)
    ReportErrors "Updating App Paths"
    MRUList=Sh.RegRead("HKCU\Software\Microsoft\Window s\CurrentVersion\Explorer\RunMRU\MRUList")
    If Err.Number=-2147024894 then
    Err.Clear
    MRUList=0
    Else
    MRUNo=Len(MRUList)
    End If

    If MsgBox (strExplain & "Number of entries" & vbtab & MRUNo & vbCRLF & vbCRLF & "Continue?", vbYesNo + vbInformation, strTitle) = 6 then
    Dim MRUItem()
    ReDim Preserve MRUItem(0)
    For x=0 to MRUNo - 1
    MItem=Sh.RegRead("HKCU\Software\Microsoft\Windows\ CurrentVersion\Explorer\RunMRU\" & Mid(MRUList,x+1,1))
    Sh.Regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Ex plorer\RunMRU\" & Mid(MRUList,x+1,1)
    If MsgBox ("Do you want to delete " & vbcrlf & vbcrlf & Left(MItem,Len(MItem)-2) & vbcrlf & vbcrlf & "Yes" & vbtab & "To delete" & vbcrlf & "No" & vbtab & "To keep", vbYesNo + vbQuestion, strTitle) <> 6 then
    ReDim Preserve MRUItem(UBound(MRUItem)+1)
    MRUItem(UBound(MRUItem))=MItem
    End If
    Next
    MRUList=""
    For y=1 to UBound(MRUItem)
    MRUList=MRUList & Chr(y + 96)
    Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Ex plorer\RunMRU\" & Chr(y + 96),MRUItem(y)
    Next
    Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Ex plorer\RunMRU\MRUList", MRUList
    Msgbox "Click Start - Shutdown Windows then Cancel to allow changes to take effect.", vbInformation + vbOKOnly, strTitle
    End If


    ReportErrors(test)

    Sub ReportErrors(strModuleName)
    If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
    Err.clear
    End Sub




    Se salvo questo script in un file con estensione .vbs non fà altro che svuotare la cronologia di Start --> Esegui.

    Il problema è che mi chiede delle conferme io invece vorrei che operasse senza chiedere nessuna conferma, quindi una volta lanciato fà tutto da solo in automatico senza nemmeno dirmi quello che fà.

    Grazie per l'aiuto

  2. #2
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Penso che tu debba togliere la linea della

    If MsgBox (strExplain & ....

    ovviamente con la relativa End If ... (altrimenti avresti un errore)

  3. #3
    Utente di HTML.it
    Registrato dal
    Apr 2007
    Messaggi
    2
    Originariamente inviato da oregon
    Penso che tu debba togliere la linea della

    If MsgBox (strExplain & ....

    ovviamente con la relativa End If ... (altrimenti avresti un errore)

    Sei un grandissimo!!! funziona perfettamente!!

    Grazie mille!

  4. #4
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Non esagerare ... era un codice elementare ...

  5. #5
    Moderatore di Programmazione L'avatar di alka
    Registrato dal
    Oct 2001
    residenza
    Reggio Emilia
    Messaggi
    24,472

    Moderazione

    Originariamente inviato da barca76
    Ciao ragazzi
    potreste aiutarmi a modificare questo script?
    Ho spostato la discussione all'interno del forum dedicato a Visual Basic (VBx, VBA, ...) e ai linguaggi per .NET Framework (VB.NET, C#, ...).

    In futuro, poni in questo forum le domande relative a questi linguaggi.

    Ti invito inoltre a leggere il Regolamento per conoscere le altre norme da seguire nell'apertura di nuove discussioni.

    Ciao!
    MARCO BREVEGLIERI
    Software and Web Developer, Teacher and Consultant

    Home | Blog | Delphi Podcast | Twitch | Altro...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.